Question 8)
Which of the following are valid statements
1) public class MyCalc extends Math
2) Math.max(s);
3) Math.round(9.99,1);
4)Math.mod(4,10);
Answer to Question 8)
--------------------------------------------------------------------------------
Question 9)
Which of the following are methods of the Runnable interface
1) run
2) start
3) yield
4) stop
Answer to Question 9)
--------------------------------------------------------------------------------
Question 10)
Which of the following statements are true?
1) A byte can represent between -128 to 127
2) A byte can represent between -127 to 128
3) A byte can represent between -256 to 256
4) A char can represent between -2x2 pow 16 2 x2 pow 16 - 1
Answer to Question 10)
--------------------------------------------------------------------------------
Question 11)
What will happen when you attempt to compile and run the following code
class Base{
public void Base(){
System.out.println("Base");
}
}
public class In extends Base{
public static void main(String argv[]){
In i=new In();
}
}
1) Compile time error Base is a keyword
2) Compilation and no output at runtime
3) Output of Base
4) Runtime error Base has no valid constructor
Answer to Question 11)
--------------------------------------------------------------------------------
Question 12)
You have a public class called myclass with the main method defined as follows
public static void main(String parm[]){
System.out.println(parm[0]);
}
If you attempt to compile the class and run the program as follows
java myclass hello
What will happen?
1) Compile time error, main is not correctly defined
2) Run time error, main is not correctly defined
3) Compilation and output of java
4) Compilation and output of hello
Answer to Question 12)
--------------------------------------------------------------------------------
Question 13)
Which of the following statements are true?
1) If a class has any abstract methods it must be declared abstract itself.
2) All methods in an abstract class must be declared as abstract
3) When applied to a class, the final modifier means it cannot be sub-classed
4) transient and volatile are Java modifiers
Answer to Question 13)