Submitted by c-admin on Thu, 05/30/2019 - 00:19
Note: This question may be considered too advanced for this exam.
What will the following code print when run?
public class TestClass{
public static Integer wiggler(Integer x){
Integer y = x + 10;
x++;
System.out.println(x);
return y; }
public static void main(String[] args){
Integer dataWrapper = new Integer(5);
Integer value = wiggler(dataWrapper);
System.out.println(dataWrapper+value); } }
Select 1 option
A. 5 and 20
B. 6 and 515
C. 6 and 20
D. 6 and 615
E. It will not compile.
Submitted by c-admin on Thu, 05/30/2019 - 00:15
Note: This question may be considered too advanced for this exam.
Given:
String mStr = "123";
long m = // 1
Which of the following options when put at //1 will assign 123 to m?
Select 3 options
A. new Long(mStr);
B. Long.parseLong(mStr);
C. Long.longValue(mStr);
D. (new Long()).parseLong(mStr);
E. Long.valueOf(mStr).longValue();
Submitted by c-admin on Thu, 05/30/2019 - 00:14
Given the following code, which statements can be placed at the indicated position without causing compile and run time errors?
public class Test{
int i1;
static int i2;
public void method1(){
int i; // ... insert statements here
}
}
Select 3 options
A. i = this.i1;
B. i = this.i2;
C. this = new Test( );
D. this.i = 4;
E. this.i1 = i2;
Submitted by c-admin on Thu, 05/30/2019 - 00:09
The following code snippet will print 4.
int i1 = 1, i2 = 2, i3 = 3;
int i4 = i1 + (i2=i3 );
System.out.println(i4);
Select 1 option
A. True
B. False
Submitted by c-admin on Thu, 05/30/2019 - 00:06
Which of these are not legal declarations within a class?
Select 1 option
A. static volatile int sa ;
B. final Object[ ] objArr = { null } ;
C. abstract int t ;
D. native void format( ) ;
E. final transient static private double PI = 3.14159265358979323846;
Pages