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
Submitted by c-admin on Wed, 05/29/2019 - 00:55
Consider the following class and interface definitions (in separate files):
public class Sample implements IInt{
public static void main(String[] args){
Sample s = new Sample(); //1
int j = s.thevalue; //2
int k = IInt.thevalue; //3
int l = thevalue; //4
}
}public interface IInt{
int thevalue = 0;
}
What will happen when the above code is compiled and run?
Select 1 option
A. It will give an error at compile time at line //1.
B. It will give an error at compile time at line //2.
C. It will give an error at compile time at line //3
D. It will give an error at compile time at line //4.
E. It will compile and run without any problem.
Submitted by c-admin on Wed, 05/29/2019 - 00:50
Which of the following statements are correct?
Select 3 options
A. An abstract class can be extended by an abstract or a concrete class.
B. A concrete class can be extended by an abstract or a concrete class.
C. An interface can be extended by another interface.
D. An interface can be extended by an abstract class.
E. An interface can be extended by a concrete class.
F. An abstract class cannot implement an interface.
Submitted by c-admin on Wed, 05/29/2019 - 00:48
An abstract method cannot be overridden.
Select 1 option
A. True
B. False
Pages