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;
Submitted by c-admin on Thu, 05/30/2019 - 00:04
What will the following program print?
public class TestClass{
static String str;
public static void main(String[] args){
System.out.println(str);
}
}
Select 1 option
A. It will not compile.
B. It will compile but throw an exception at runtime.
C. It will print 'null' (without quotes).
D. It will print nothing.
E. None of the above.
Submitted by c-admin on Thu, 05/30/2019 - 00:01
An instance member ...
Select 2 options
A. can be a variable, a constant or a method.
B. is a variable or a constant.
C. belongs to the class.
D. belongs to an instance of the class.
E. is same as a local variable.
Pages