WorksheetsDay 2 Wipro
Total questions: 20
Worksheet time: 20mins
Which of the following concepts means "wrapping up of data and methods"?
Inheritance
Encapsulation
Abstraction
Polymorphism
Which concept of OOP is used for code reusability?
Inheritance
Encapsulation
Polymorphism
Abstraction
Which of the following allows runtime method binding?
Static polymorphism
Function overloading
Dynamic polymorphism
Method hiding
Which keyword is used to call the constructor of a superclass?
super
this
extends
base
Which of these cannot be used to achieve polymorphism?
Method overloading
Method overriding
Constructor overloading
Variable hiding
Which modifier makes a variable accessible in subclasses only?
private
protected
public
default
Which keyword is used to prevent method overriding?
static
private
final
abstract
Which concept hides internal implementation from the user?
Inheritance
Abstraction
Polymorphism
Overloading
What is the base class of all classes in Java?
java.base
java.lang.Object
System
Main
Which interface should a class implement to become threadable?
Runnable
Callable
Cloneable
Threadable
What is the size of an int variable in Java?
2 bytes
4 bytes
8 bytes
Depends on OS
Which of the following can be used to terminate a loop in Java?
break
continue
exit
end
What is the output of:
java
System.out.println(3 + 5 + "7");
87
357
12
75
Which keyword is used to define a constant in Java?
static
const
final
immutable
Which statement is true about switch in Java?
It can only be used with integers
It cannot use String values
It can be used with char and String
It always requires default
Which of these is not a Java keyword?
static
interface
unsigned
volatile
Which of the following correctly declares an array in Java?
int arr[] = new int(5);
int arr[] = new int[5];
int arr = new int[5];
int arr() = new int[5];
Which of the following allows multidimensional arrays in Java?
int[][] arr = new int[3][4];
int arr = new int[3,4];
int[3][4] arr;
int arr(3)(4);
What is the output?
int[] a = {1, 2, 3};
System.out.println(a.length);
0
2
3
Compilation error
Can arrays in Java hold objects?
No
Yes, only Strings
Yes, any type of object
Only primitive types
