SlideShare a Scribd company logo
Both the methods sleep and join throws Interrupted Exception.
Select an answer
*A. TRUE
B. FALSE
This is a legal int x[]={2,3,7,9};
Select an answer
*A. TRUE
B. FALSE
Can you automatically convert a long to an int if the long value is small enough
to fit into an int?
Select an answer
A. Yes
*B. No
Collection will not represent a single unit of objects.
Select an answer
A. TRUE
*B. FALSE
By default, all program import the java.lang package.
Select an answer
*A. TRUE
B. FALSE
Is it legal to access a static method using an instance of an class?
Select an answer
A. Yes
*B. No
A method can have more than one access modifier?
Select an answer
*A. TRUE
B. FALSE
A source stream initiates the flow of data, also called an input stream.
Select an answer
*A. TRUE
B. FALSE
ou can pass an object reference as an argument to a method call.
Select an answer
*A. TRUE
B. FALSE
When you pass a variable an argument to a method is called.
Select an answer
*A. TRUE
B. FALSE
When a Java program tries to divide by zero; the runtime will create and throw
an object of Arithmetic Exception.
Select an answer
*A. TRUE
B. FALSE
An object means, anything that can D25be seen or touched; material thing.
Select an answer
*A. TRUE
B. FALSE
Suppose that Marketing is a subclass of Department. What is casting used for in
the code? public organize (Department sales) { Marketing marketing1 =
(Marketing) sales ; }
(Please select ALL that apply)
Select an answer
A. To cast sales to a Marketing reference
B. To convert a Department object into a Marketing object
C. To make the code clearer
*D. To perform a narrowing conversion
Which constructs can you make private?
(Please select ALL that apply)
Select an answer
A. Local variables
*B. Member variables
*C. Methods
*D. Top-level classes
A byte can be of what size?
Select an answer
*A. -128 to 127
B. (-2 power 8)-1 to 2 power 8
C. -255 to 256
D. Depends on the particular implementation of the Java Virtual machine
What is a constructor?
Select an answer
A. A constructor is a special kind of method that determines how a
class is initialized when created
B. A constructor is a special kind of class that determines how an
object is initialized when created
*C. A constructor is a special kind of method that determines how an
object is initialized when created
D. A constructor is a special kind of method that determines how a
message is
A ref is a:
Select an answer
*A. Method of passing the values of parameters
B. Pointer to an object
C. Method of compiling the PL/SQL
D. A wrapper for encrypting the source
E. None of the options are correct
Identify the best examples of an inheritance hierarchy.
(Please select ALL that apply)
Select an answer
A. Animal extends Dog extends Cat
*B. Cappuccino extends Coffee extends Beverage
C. Director extends Manager extends Employee
D. Vehicle extends Car
<p>What happens when you put this expression in your code? </p>int x=0; int y =
4%x;
Select an answer
*A. Compile time error
B. Compiles and runs
C. Runtime exception
Can we create one or more package declaration per source file?
Select an answer
A. Yes, specify multiple package declaration at starting of the program
*B. No you can have only one package declaration per file
C. Yes, you can use scope braces to show which package definition holds
good for respected blocks
D. None of the options are correct
You have a method that throws a checked exception. What is required to ensure
that the code correctly compiles and any potential exceptions are handled by all
callers to this method?
(Please select ALL that apply)
Select an answer
*A. The called method must be declared with a throws clause
*B. The calling method must either enclose the method call in a
try...catch block or declare the relevant exception to be thrown
C. The calling method must include a catch block for each specific type
of exception thrown by the called method
D. The calling method must override a method of a superclass
Suppose you have an abstract Vehicle class. The Ford class extends the Car
class, which extends the Vehicle class, and overrides its getSpec method. You
assign a Ford reference to a variable, vehicle, of type Vehicle. Which getSpec
method is called through vehicle? Vehicle a = new Ford(); a.getSpec();
Select an answer
A. The getSpec method of the Car object
*B. The getSpec method of the Ford object
C. The getSpec method of the Vehicle object
Suppose you needed to pass a variable number of integer arguments to the
newMethod method and have to make use of the varargs feature. Which statement is
syntactically correct?
Select an answer
A. static void newMethod ( intnumbr[] )
*B. static void newMethod ( int ... numbr )
C. static void newMethod ( int --- numbr )
D. static void newMethod ( boolean ... numbr )
The three basic read methods are:
(Please select ALL that apply)
Select an answer
A. int read([]char)
B. int read()
*C. int read(char[] cbuf)
*D. int read(char[] cbuf, int offset, int length
What is the work of java Runtime environment?
(Please select ALL that apply)
Select an answer
A. Creates code
B. Loads code
C. Verifies code
D. Executes code
*E. None of the options are correct
What will be the output of the program?
public class Foo
{
public static void main(String[] args)
{
try
{
return;
}
finally
{
System.out.println( "Finally" );
}
}
}
Select an answer
*A. Finally
B. Compilation fails.
C. The code runs with no output.
D. An exception is thrown at runtime.
Which three form part of correct array declarations?
(Please select ALL that apply)
Select an answer
*A. public int a [ ]
*B. static int [ ] a
*C. public [ ] int a
D. private int a [3]
E. private int [3] a [ ]
F. public final int [ ] a

More Related Content

TXT
CORE JAVA
PPT
Generic Programming seminar
PDF
Generic Programming
PPT
Thin Template Explained
PPSX
C++ Programming Language
PPT
Static and dynamic polymorphism
PPTX
Primitives in Generics
PDF
Learn the Art of Writing Clean Code
CORE JAVA
Generic Programming seminar
Generic Programming
Thin Template Explained
C++ Programming Language
Static and dynamic polymorphism
Primitives in Generics
Learn the Art of Writing Clean Code

What's hot (19)

PDF
Functions
PPTX
Polymorphism
PDF
Pinkle Makhijani ,BCA 2nd Year
PDF
Rahul Saini, BCA 2nd Year
PPTX
Pointers,virtual functions and polymorphism cpp
PPT
02 functions, variables, basic input and output of c++
PPTX
Polymorphism and its types
PDF
Rakesh Bijawat, BCA 2nd Year
PDF
Rakesh Bijawat , BCA Third Year
PDF
Kajal Gaharwal,BCA 2nd Year
PDF
Deepak Soni,BCA 2nd Year
PDF
Aanchal Gupta,BCA 2nd year
PPTX
Type casting in java
PDF
Farhaan Ahmed, BCA 2nd Year
PPT
Input and output in C++
PDF
Ram Prasad ,BCA 2nd Year
PPTX
Code smells and remedies
DOCX
งานย่อย 6
PPTX
Type conversion
Functions
Polymorphism
Pinkle Makhijani ,BCA 2nd Year
Rahul Saini, BCA 2nd Year
Pointers,virtual functions and polymorphism cpp
02 functions, variables, basic input and output of c++
Polymorphism and its types
Rakesh Bijawat, BCA 2nd Year
Rakesh Bijawat , BCA Third Year
Kajal Gaharwal,BCA 2nd Year
Deepak Soni,BCA 2nd Year
Aanchal Gupta,BCA 2nd year
Type casting in java
Farhaan Ahmed, BCA 2nd Year
Input and output in C++
Ram Prasad ,BCA 2nd Year
Code smells and remedies
งานย่อย 6
Type conversion
Ad

Viewers also liked (8)

PPT
PPTX
Presentation on Core java
PPSX
Seminar on java
PPT
Core java concepts
PPT
Java Tutorial
PPT
Core java slides
PPT
Java tutorial PPT
PPT
Core Java Slides
Presentation on Core java
Seminar on java
Core java concepts
Java Tutorial
Core java slides
Java tutorial PPT
Core Java Slides
Ad

Similar to CORE JAVA (20)

TXT
TXT
DOCX
Goals1)Be able to work with individual bits in java.2).docx
DOCX
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
PPTX
FAIZAN JAVED BUTT_845544_assignsubmission_file_ppt VP.pptx
PPTX
Part - 2 Cpp programming Solved MCQ
PPT
Express 070 536
DOCX
Prueba de conociemientos Fullsctack NET v2.docx
PPT
Java căn bản - Chapter7
PDF
Developer Android Tools
PPT
Chapter 7 - Defining Your Own Classes - Part II
PDF
Big Java Early Objects 5th Edition Horstmann Test Bank
PPTX
Advanced programming topics asma
PDF
Big Java Early Objects 5th Edition Horstmann Test Bank
PDF
Intake 37 2
PDF
Big Java Early Objects 5th Edition Horstmann Test Bank
PPT
java tutorial 3
PDF
Big Java Early Objects 5th Edition Horstmann Test Bank
ODP
Ppt of c vs c#
PPTX
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2
Goals1)Be able to work with individual bits in java.2).docx
Consider this code using the ArrayBag of Section 5.2 and the Locat.docx
FAIZAN JAVED BUTT_845544_assignsubmission_file_ppt VP.pptx
Part - 2 Cpp programming Solved MCQ
Express 070 536
Prueba de conociemientos Fullsctack NET v2.docx
Java căn bản - Chapter7
Developer Android Tools
Chapter 7 - Defining Your Own Classes - Part II
Big Java Early Objects 5th Edition Horstmann Test Bank
Advanced programming topics asma
Big Java Early Objects 5th Edition Horstmann Test Bank
Intake 37 2
Big Java Early Objects 5th Edition Horstmann Test Bank
java tutorial 3
Big Java Early Objects 5th Edition Horstmann Test Bank
Ppt of c vs c#
UGC-NET, GATE and all IT Companies Interview C++ Solved Questions PART - 2

Recently uploaded (20)

PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
web development for engineering and engineering
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
Construction Project Organization Group 2.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
Geodesy 1.pptx...............................................
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Internet of Things (IOT) - A guide to understanding
Operating System & Kernel Study Guide-1 - converted.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
web development for engineering and engineering
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
OOP with Java - Java Introduction (Basics)
Construction Project Organization Group 2.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
bas. eng. economics group 4 presentation 1.pptx
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Geodesy 1.pptx...............................................
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Foundation to blockchain - A guide to Blockchain Tech
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Lecture Notes Electrical Wiring System Components
Internet of Things (IOT) - A guide to understanding

CORE JAVA

  • 1. Both the methods sleep and join throws Interrupted Exception. Select an answer *A. TRUE B. FALSE This is a legal int x[]={2,3,7,9}; Select an answer *A. TRUE B. FALSE Can you automatically convert a long to an int if the long value is small enough to fit into an int? Select an answer A. Yes *B. No Collection will not represent a single unit of objects. Select an answer A. TRUE *B. FALSE By default, all program import the java.lang package. Select an answer *A. TRUE B. FALSE Is it legal to access a static method using an instance of an class? Select an answer A. Yes *B. No A method can have more than one access modifier? Select an answer *A. TRUE B. FALSE A source stream initiates the flow of data, also called an input stream. Select an answer *A. TRUE B. FALSE ou can pass an object reference as an argument to a method call. Select an answer *A. TRUE B. FALSE When you pass a variable an argument to a method is called. Select an answer *A. TRUE B. FALSE When a Java program tries to divide by zero; the runtime will create and throw an object of Arithmetic Exception.
  • 2. Select an answer *A. TRUE B. FALSE An object means, anything that can D25be seen or touched; material thing. Select an answer *A. TRUE B. FALSE Suppose that Marketing is a subclass of Department. What is casting used for in the code? public organize (Department sales) { Marketing marketing1 = (Marketing) sales ; } (Please select ALL that apply) Select an answer A. To cast sales to a Marketing reference B. To convert a Department object into a Marketing object C. To make the code clearer *D. To perform a narrowing conversion Which constructs can you make private? (Please select ALL that apply) Select an answer A. Local variables *B. Member variables *C. Methods *D. Top-level classes A byte can be of what size? Select an answer *A. -128 to 127 B. (-2 power 8)-1 to 2 power 8 C. -255 to 256 D. Depends on the particular implementation of the Java Virtual machine What is a constructor? Select an answer A. A constructor is a special kind of method that determines how a class is initialized when created B. A constructor is a special kind of class that determines how an object is initialized when created *C. A constructor is a special kind of method that determines how an object is initialized when created D. A constructor is a special kind of method that determines how a message is A ref is a: Select an answer *A. Method of passing the values of parameters B. Pointer to an object C. Method of compiling the PL/SQL D. A wrapper for encrypting the source E. None of the options are correct Identify the best examples of an inheritance hierarchy. (Please select ALL that apply)
  • 3. Select an answer A. Animal extends Dog extends Cat *B. Cappuccino extends Coffee extends Beverage C. Director extends Manager extends Employee D. Vehicle extends Car <p>What happens when you put this expression in your code? </p>int x=0; int y = 4%x; Select an answer *A. Compile time error B. Compiles and runs C. Runtime exception Can we create one or more package declaration per source file? Select an answer A. Yes, specify multiple package declaration at starting of the program *B. No you can have only one package declaration per file C. Yes, you can use scope braces to show which package definition holds good for respected blocks D. None of the options are correct You have a method that throws a checked exception. What is required to ensure that the code correctly compiles and any potential exceptions are handled by all callers to this method? (Please select ALL that apply) Select an answer *A. The called method must be declared with a throws clause *B. The calling method must either enclose the method call in a try...catch block or declare the relevant exception to be thrown C. The calling method must include a catch block for each specific type of exception thrown by the called method D. The calling method must override a method of a superclass Suppose you have an abstract Vehicle class. The Ford class extends the Car class, which extends the Vehicle class, and overrides its getSpec method. You assign a Ford reference to a variable, vehicle, of type Vehicle. Which getSpec method is called through vehicle? Vehicle a = new Ford(); a.getSpec(); Select an answer A. The getSpec method of the Car object *B. The getSpec method of the Ford object C. The getSpec method of the Vehicle object Suppose you needed to pass a variable number of integer arguments to the newMethod method and have to make use of the varargs feature. Which statement is syntactically correct? Select an answer A. static void newMethod ( intnumbr[] ) *B. static void newMethod ( int ... numbr ) C. static void newMethod ( int --- numbr ) D. static void newMethod ( boolean ... numbr ) The three basic read methods are: (Please select ALL that apply) Select an answer A. int read([]char)
  • 4. B. int read() *C. int read(char[] cbuf) *D. int read(char[] cbuf, int offset, int length What is the work of java Runtime environment? (Please select ALL that apply) Select an answer A. Creates code B. Loads code C. Verifies code D. Executes code *E. None of the options are correct What will be the output of the program? public class Foo { public static void main(String[] args) { try { return; } finally { System.out.println( "Finally" ); } } } Select an answer *A. Finally B. Compilation fails. C. The code runs with no output. D. An exception is thrown at runtime. Which three form part of correct array declarations? (Please select ALL that apply) Select an answer *A. public int a [ ] *B. static int [ ] a *C. public [ ] int a D. private int a [3] E. private int [3] a [ ] F. public final int [ ] a