Submitted by c-admin on Tue, 05/28/2019 - 04:56
Which of the following statements are true?
Select 2 options
A. System.out.println(1 + 2 + "3"); would print 33.
B. System.out.println("1" + 2 + 3); would print 15.
C. System.out.println(4 + 1.0f); would print 5.0
D. System.out.println(5/4); would print 1.25
E. System.out.println('a' + 1 ); would print b.
Submitted by c-admin on Tue, 05/28/2019 - 04:52
Which statements about the output of the following programs are true?
public class TestClass{
public static void main(String args[ ] ){
int i = 0 ;
boolean bool1 = true;
boolean bool2 = false;
boolean bool = false;
bool = (bool2 & method1("1")); //1
bool = (bool2 && method1("2")); //2
bool = (bool1 | method1("3")); //3
bool = (bool1 || method1("4")); //4
}
public static boolean method1(String str){
System.out.println(str);
return true;
}
}
Select 2 options
A. 1 will be the part of the output.
B. 2 will be the part of the output.
C. 3 will be the part of the output.
D. 4 will be the part of the output.
E. None of the above
Submitted by c-admin on Tue, 05/28/2019 - 04:48
Which operators will always evaluate all the operands?
Select 2 options
A. &&
B. |
C. ||
D. ? :
E. %
Submitted by c-admin on Tue, 05/28/2019 - 04:46
What will be the output when the following class is compiled and run?
class ScopeTest{
static int x = 5;
public static void main(String[] args){
int x = ( x=3 ) * 4; // 1
System.out.println(x);
}
}
Select 1 option
A. It will not compile because line //1 cannot be parsed correctly.
B. It will not compile because x is used before initialization.
C. It will not compile because there is an ambiguous reference to x.
D. It will print 12.
E. It will print 3.
Submitted by c-admin on Tue, 05/28/2019 - 04:43
Given the following declarations, identify which statements will return true:
Integer i1 = 1;
Integer i2 = new Integer(1);
int i3 = 1;
Byte b1 = 1;
Long g1 = 1L;
Note: Although primitive wrapper classes are not explicitly mentioned in the exam objectives, we have seen some candidates get questions on this aspect of wrapper classes.
Select 2 options
A. i1 == i2
B. i1 == i3
C. i1 == b1
D. i1.equals(i2)
E. i1.equals(g1)
F. i1.equals(b1)
Pages