Submitted by c-admin on Fri, 05/31/2019 - 00:29
Consider the following lines of code:
System.out.println(null + true); //1
System.out.println(true + null); //2
System.out.println(null + null); //3
Which of the following statements are correct?
Select 1 option
A. None of the 3 lines will compile.
B. All the 3 line will compile and print null true, true null and null null respectively.
C. Line 1 and 2 won't compile but line 3 will print null null.
D. Line 3 won't compile but line 1 and 2 will print null true and true null respectively.
E. None of the above.
Submitted by c-admin on Fri, 05/31/2019 - 00:25
Consider the following lines of code:
boolean greenLight = true;
boolean pedestrian = false;
boolean rightTurn = true;
boolean otherLane = false;
You can go ahead only if the following expression evaluates to 'true' :
(( (rightTurn && !pedestrian || otherLane) || ( ? && !pedestrian &&
greenLight ) ) == true )
What variables can you put in place of '?' so that you can go ahead?
Select 1 option
A. rightTurn
B. otherLane
C. Any variable would do.
D. None of the variable would allow to go.
Submitted by c-admin on Fri, 05/31/2019 - 00:21
Which line in the following code will cause the compilation to fail?
public class TestClass {
public static void main(String[] args) throws Exception {
work(); //LINE 10
int j = j1; //LINE 11
int j1 = (double) x; //LINE 12
}
public static void work() throws Exception{
System.out.println(x); //LINE 15
}
static double x; //19
}
Select 1 option
A. Line 10
B. Line 11
C. Line 12
D. Line 15
E. Line 19
Submitted by c-admin on Fri, 05/31/2019 - 00:19
Drag and Drop valid operators in boxes.
= operator can be used more than once.
= += *=
public class TestClass
{
public static void main(String[] args)
{
Short k = 9;
Integer I =9;
Boolean b = false;
char c = ‘a’;
String str = “123”;

Submitted by c-admin on Fri, 05/31/2019 - 00:11
Given:
byte b = 1;
char c = 1;
short s = 1;
int i = 1;
which of the following expressions are valid?
Select 3 options
A. s = b * b ;
B. i = b << b ;
C. s <<= b ;
D. c = c + b ;
E. s += i ;
Pages