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.
Submitted by c-admin on Wed, 05/29/2019 - 23:52
Which of the following statements is correct?
Select 1 option
A. new, delete and goto are keywords in the Java language
B. try, catch and thrown are keywords in the Java language
C. static, unsigned and long are keywords in the Java language
D. exit, class and while are keywords in the Java language
E. return, goto and default are keywords in the Java language
Submitted by c-admin on Wed, 05/29/2019 - 23:48
What will be the result of attempting to compile this class?
import java.util.*;
package test;
public class TestClass{
public OtherClass oc = new OtherClass();
}class OtherClass{
int value;
}
Select 1 option
A. The class will fail to compile, since the class OtherClass is used before it is defined.
B. There is no problem with the code.
C. The class will fail to compile, since the class OtherClass must be defined in a file called OtherClass.java
D. The class will fail to compile .
E. None of the above.
Submitted by c-admin on Wed, 05/29/2019 - 23:44
Given the following code snippet:
int rate = 10;
int t = 5;
XXX amount = 1000.0;
for(int i=0; i<t; t++){
amount = amount*(1 - rate/100);
}
What can XXX be?
Select 1 option
A. int
B. long
C. only double
D. double or float
E. float
Pages