Submitted by c-admin on Wed, 05/29/2019 - 01:21
Consider the following variable declaration within the definition of an interface:
int i = 10;
Which of the following declarations defined in a non-abstract class, is equivalent to the above?
Select 1 option
A. public static int i = 10;
B. public final int i = 10;
C. public static final int i = 10;
D. public int i = 10;
E. final int i = 10;
Submitted by c-admin on Wed, 05/29/2019 - 01:19
What, if anything, is wrong with the following code?
abstract class TestClass{
transient int j;
synchronized int k;
final void TestClass(){}
static void f(){}
}
Select 1 option
A. The class TestClass cannot be declared abstract.
B. The variable j cannot be declared transient.
C. The variable k cannot be declared synchronized.
D. The constructor TestClass( ) cannot be declared final.
E. The method f( ) cannot be declared static.
F. This code has no errors.
Submitted by c-admin on Wed, 05/29/2019 - 01:09
Which of the following method definitions will prevent overriding of that method?
Select 4 options
A. public final void m1()
B. public static void m1()
C. public static final void m1()
D. public abstract void m1()
E. private void m1()
Submitted by c-admin on Wed, 05/29/2019 - 01:06
Which of the following are valid declarations inside an interface?
Select 2 options
A. void compute();
B. public void compute();
C. public final void compute();
D. static void compute();
E. protected void compute();
Submitted by c-admin on Wed, 05/29/2019 - 01:03
Note: Option 4 of this question may be considered too advanced for this exam.
Which lines of code will not be acceptable to the compiler?
import java.*; //1
public abstract class InternalLogic //2 {
float density = 20.0; //3
public class Doer //4 {
void do() //5 { //lot of valid code.
}
} }
Select 2 options
A. 1
B. 2
C. 3
D. 4
E. 5
Pages