Font size
WorksheetsJava Programming Quiz
Total questions: 20
Worksheet time: 10mins
What is the return type of a constructor in Java[ ]
int
void
No return type
Object
Java is a ______________ language.[ ]
Platform dependent
Platform Independent
Machine
none
How many bytes are occupied by float data type in java[ ]
2 bytes
4 bytes
8 bytes
4 bits
Return type _________ indicates that a method will not return a value.[ ]
int
double
void
Boolean
Methods that perform common tasks and do not require objects are called ______methods.[ ]
final
non-static
dynamic
static
If a=5, then what is the value of result, if result = a++ + ++a + --a - a--;[ ]
13
18
11
12
If a=8, then what is the value of x and y x=a>>2 y=a<<2;[ ]
x=2 y=2
x=2 y=32
x=32 y=2
x=32 y=32
If one or both operands is a floating-point value, we get a ____________ type result[ ]
int
float
boolean
char
Java applications begin execution at method ___________.[ ]
public static void main()
public final void main()
private static void main()
public static int main()
Which of the following is a method having same name as that of its class?[ ]
final
static
class
constructor
What is the output of the following code? System.out.println(5 + "5");[ ]
10
55
Compilation Error
Runtime Error
_________keeps together code and the data it manipulates and keeps both safe from outside interference.[ ]
Encapsulation
Abstraction
Polymorphism
Inheritance
this() is used for ____________________[ ]
call the method
call the Constructor
call the object
none
Variables defined inside methods, constructors or blocks are called ________variables[ ]
class
instance
local
global
Assigning an int data type to a double data type will be considered as ___________[ ]
Narrowing
Widening
Downcasting
Casting
(a) is the OOPs concept to create new class by using existing class.
(a) is the symbol to use Bitwise exclusive OR
Static block is executed before (a) method.
Keyword (a) requests memory from the system to store an object.
Java code needs to be compiled into (a) code before it can be executed.
