WorksheetsJavaLab-534
Total questions: 10
Worksheet time: 4mins
'static' & 'this' always go together
True
False
Function with Var-Args and 'For-each' loop usually go together.
True
False
What will be the output :
int a=12;
Sop(a>>2);
Compile Error
6
3
24
Any 'for' loop can be replaced with 'Enhanced For' loop.
True
False
When is the Garbage collector invoked? (You can select multiple answers if required)
As soon as an object is de-referenced.
JVM will schedule the activity for Garbage collector (Automatic)
Programmer can invoke whenever required
There is no Garbage Collector in Java
Analyse the program and select the best answer(s). Click on the image to zoom. Can select multiple answers if required.
No error
Creates a new object
Compile error
Run-time exception
class Test{
public static void main(String[] args) {
new Test();
---- }
What does 'new Test()' do in the above program?
Gives compiler error
Creates an object
Generates run-time exception
Does nothing.
class Test{
public static void main(String[] args) {
new Test();
---- }
Objects created like above are called?
Unknown objects
Anonymous objects
Zero-argument objects
What will be the output of:
int a=1, b=9;
Sop("a+b=",a+b);
10
a+b=10
a+b=19
Error
What is your opinion about the code:
int a[ ] = { 1, 2, 3};
int[ ] b = { 1, 2, 3, 4, 5};
a=b;
Compiler error
'b' cannot be assigned to 'a' : Runtime exception
No error
