NEW
Font size
WorksheetsJava MCQ Test Day-2
Total questions: 20
Worksheet time: 10mins
Which of these is not abstract?
Thread
List
Array
String
Which of these is not a correct statement?
Every class containing abstract method must be declared abstract
Abstract class defines only the structure of the class not its implementation
Abstract class can be initiated by new operator
Abstract class can be inherited
Which of these packages contains abstract keyword?
java.lang
java.io
java.util
java.System
what is the output of the following code?
2 2
3 3
Run Time Error
Compile Time Error
Which of these can be used to fully abstract a class from its implementation?
Object
Package
Abstract Class
Interfaces
Which of the following access specifiers should be used with interfaces?
public
private
protected
default
Which of the following is the correct way of implementing an interface salary by class manager?
class manager extends salary {}
class manager implements salary {}
class manager imports salary {}
class manager gets salary{}
What is the output of the following code
0
2
4
compile time error
what is the output of the following code
0 1 2
0 2 4
0 0 4
0 1 4
What type of variable can be defined in an interface?
public static
public final
private final
static final
Which among the following best describes polymorphism?
It is the ability for a message/data to be processed in more than one form
It is the ability for a message/data to be processed in only 1 form
It is the ability for many messages/data to be processed in one way
It is the ability for undefined message/data to be processed in at least one way
If same message is passed to objects of several different classes and all of those can respond in a different way, what is this feature called?
Inheritance
Overloading
Polymorphism
Overriding
Which among the following is not true for polymorphism?
It is feature of OOP
Ease in readability of program
Helps in redefining the same functionality
Increases overhead of function definition always
In Java, which concept allows us to implement runtime polymorphism?
Method Overloading
Method Overriding
Constructors
static methods
What is the output of the following code?
Some sound
Bark
Some Sound
Bark
compile time error
Which of these keywords must be used to monitor for exceptions?
try
catch
throw
finally
Which of these keywords is used to manually throw an exception?
try
catch
throw
finally
What is the output of the following code?
Hello
World
Hello World
HelloWorld
Which of these is a super class of all exceptional type classes?
Throwable
Exception
Error
Catchable
What is the output of the following code?
A
B
Hello
Runtime Exception
