Questions
Question 1 Multiple Choice (Single Answer)
What is the size of a Char?
- 4 bits
- 7 bits
- 8 bits
- 16 bits
Question 2 Multiple Choice (Single Answer)
A class cannot be declared:
- Static
- Private
- Default
Question 3 Multiple Choice (Single Answer)
Following code will result in: int a = 3.5;
- Compilation error
- Runtime error
- a being 3.5
- a being 3.
Question 4 Multiple Choice (Single Answer)
Following code will result in: int a1 = 5; double a2 = (float)a1;
- Compilation error
- Runtime error
- No errors
Question 5 Multiple Choice (Single Answer)
Following code will result in: int a = 9/0;
- Compilation error: Divisions must be in a try block.
- Compilation error: DivideByZeroException
- Runtime Exception
- No Error: a is NaN
Question 6 Multiple Choice (Single Answer)
Following code will result in: float a = 9/0;
- Compilation error: Divisions must be in a try block
- Compilation error: DivideByZeroException
- Runtime Exception
- No Error: a is NaN
Question 7 Multiple Choice (Single Answer)
A class can be transient
- True
- False
Question 8 Multiple Choice (Single Answer)
Following code will result in: class A { int b = 1; public static void main(String [] args) { System.out.println("b is " + b); }}
- Compilation error
- Runtime Error
- Runtime Exception
- Output of b is 1
Question 9 Multiple Choice (Single Answer)
Following code will result in: class A { public static void main(String [] args) {B b = new A(); }} class B extends A {}
- Compile error
- Runtime Exception
- No error
Question 10 Multiple Choice (Single Answer)
Following code will result in: class A { public static void main(String [] args) {A a = new B(); }} class B extends A {}
- Compiler error
- Runtime Exception
- No errors