Question 1
Given: What is the result?
- 200.0 : 100.0
- 400.0 : 200.0
- 400.0 : 100.0
- Compilation fails.
Question 2
Which statement is true about the switch statement?
- It must contain the default section.
- The break statement, at the end of each case block, is optional.
- Its case label literals can be changed at runtime.
- Its expression must evaluate to a collection of values.
Question 3
Given the code fragment: What is the result?
- May 04, 2014T00:00:00.000
- 2014-05-04T00:00: 00.000
- 5/4/14T00:00:00.000
- An exception is thrown at runtime.
Question 4
Given the code fragment: What is the result?
- Sum is 600
- Compilation fails at line n1.
- Compilation fails at line n2.
- A ClassCastException is thrown at line n1.
- A ClassCastException is thrown at line n2.
Question 5
What is the name of the Java concept that uses access modifiers to protect variables and hide them within a class?
- Encapsulation
- Inheritance
- Abstraction
- Instantiation
- Polymorphism