WorksheetsWCF Training Test II
Total questions: 20
Worksheet time: 23mins
Choose the correct statement about the given code:
The code will not compile because of line 2.
The code will not compile because of line 4.
The code will not compile because of line 7.
It compiles but throws an exception at runtime.
Choose the correct statement about the given code:
The code will not compile because of line 3.
The code will not compile because of line 4.
The code will not compile because of lines 3 and 4.
It compiles and runs without issue.
Choose the correct statement about the given code:
It compiles without issue.
The code will not compile because of line 2.
The code will not compile because of line 4.
The code will not compile because of lines 2 and 5.
Which statements are true about the given code? (Choose all that apply)
The CanBark interface doesn’t compile.
A class that implements CanBark inherits both the makeSound() and bark() methods.
A class that implements CanBark only inherits the bark() method.
An interface cannot extend another interface.
What is the output of the given code?
Lizard laying eggs
The code will not compile because of line 4.
The code will not compile because of line 2.
The code will not compile because of line 9.
What is the result of the given code?
Bird is flying
Pelican is flying
The code will not compile because of line 4.
The code will not compile because of line 9.
Given that a class exists in both the and packages, what is the result of compiling the following class?
The code does not compile because of lines 1 and 2.
The code does not compile because of line 4.
The code does not compile because of line 5.
The code compiles without issue.
What is the result of compiling and executing the following class?
It does not compile.
It compiles but throws an exception at runtime.
It compiles and outputs 5.
It compiles and outputs 15.
Given the code, what values inserted in order into the blank lines, allow the code to compile?
import, class, null
import, interface, void
package, int, int
package, class, long
Which statement about the given code is correct?
The code does not compile due to line g1.
The code does not compile due to line g2.
The code does not compile due to line g3.
The code compiles and runs without issue.
Which of these class is highest in hierarchy in java
java.lang.Exception
java.lang.Error
java.lang.Throwable
java.lang.Object
Choose the CORRECT exception
String department="JTMK";
Integer no=Integer.parseInt(department);
ArithmeticException
NullPointerException
NumberFormatException
ArrayIndexOutOfBoundsException
What is the output of the following?
12: String b = "12";
13: b += "3";
14: b.reverse();
15: System.out.println(b.toString());
12
123
321
The code does not compile.
What is the output of the following?
String teams = new String("694");
teams.concat(" 1155");
teams.concat(" 2265");
teams.concat(" 2869");
System.out.println(teams);
694
694 1155 2265 2869
The code compiles but outputs something else.
The code does not compile.
What is the output of the following?
false 1
false 2
true 1
true 2
Choose correct option.
Base::show() called
Derived::show() called
Compiler Error
Runtime Error
Which of the following are checked exceptions? (Choose all that apply.)
class One extends RuntimeException{}
class Two extends Exception{}
class Three extends Error{}
class Four extends One{}
class Five extends Two{}
class Six extends Three{}
One
Two
Three
Four
Five
Which represent the order in which the following statements can be assembled into a program
that will compile successfully? (Choose all that apply)
A: class Rabbit {}
B: import java.util.*;
C: package animals;
A, B, C
B, C, A
C, B, A
B, A
C, A
Which of the following lines of code compile? (Choose all that apply)
int i1 = 1_234;
double d1 = 1_234_.0;
double d2 = 1_234._0;
double d3 = 1_234.0_;
double d4 = 1_234.0;
Which of these operators is used to allocate memory for an object?
malloc
alloc
new
this
