Submitted by c-admin on Tue, 05/28/2019 - 04:38
Which of the given lines can be inserted at //1 of the following program?
public class TestClass{
public static void main(String[] args){
short s = 9;
//1
}
}
Select 2 options
A. Short k = new Short(9); System.out.println(k instanceof Short);
B. System.out.println(s instanceof Short);
C. Short k = 9; System.out.println( k instanceof s);
D. int i = 9; System.out.println(s == i);
E. Boolean b = s instanceof Number;
F. Short k = 9; Integer i = 9; System.out.println(k == i);
G. Integer i = 9; System.out.println( s == i );
Submitted by c-admin on Tue, 05/28/2019 - 04:35
Given the following LOCs:
int rate = 10;
XXX amount = 1 - rate/100*1 - rate/100;
What can XXX be?
Select 1 option
A. only int or long
B. only long or double
C. only double
D. double or float
E. long or double but not int or float.
F. int, long, float or double
Submitted by c-admin on Tue, 05/28/2019 - 04:33
The following code snippet will not compile:
int i = 10;
System.out.println( i<20 ? out1() : out2() );
Assume that out1 and out2 have method signature: public void out1(); and public void out2();
Select 1 option
A. True
B. False
Submitted by c-admin on Tue, 05/28/2019 - 04:31
The following code snippet will print 'true'.
short s = Short.MAX_VALUE;
char c = s;
System.out.println( c == Short.MAX_VALUE);
Select 1 option
A. True
B. False
Submitted by c-admin on Tue, 05/28/2019 - 04:27
Assume that a, b, and c refer to instances of primitive wrapper classes. Which of the following statements are correct?
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. a.equals(a) will always return true.
B. b.equals(c) may return false even if c.equals(b) returns true.
C. a.equals(b) returns same as a == b.
D. a.equals(b) throws an exception if they refer to instances of different classes.
E. a.equals(b) returns false if they refer to instances of different classes.
Pages