1. | Which of the following classes are available in the java.lang package? (A) Stack (B) Object (C) Math (D) Random (E) String (F) StringBuffer (G) Vector |
|
Hint
Half-n-half Clue
| |
|
2. | Which of the following contain error? (A) int x[] = int[10]; (B) int[] y = new int[5]; (C) float d[] = |
| Half-n-half Clue
| |
|
3. | Which of the following are the wrapper classes? (A) Random (B) Byte (C) Vector (D) Integer (E) Short (F) Double (G) String |
| Half-n-half Clue
| |
|
4. | Which of the following methods belong to the String class? |
| Half-n-half Clue
| |
|
5. | Given the class definitions class Base { void display () { System.out.println("Base"); } } class Derived extends Base { void display () { System.out.println("Derived"); } } and objects Base b = new Base(); Derived d = new Derived(); Base bd = new Derived;
then the print statements System.out.print(b.display() + " "); System.out.print(d.display() + " "); System.out.print(bd.display() + " "); System.out.println(); will display: |
| Half-n-half Clue
| |
|
6. | When we implement the Runnable interface, we must define the method |
| Half-n-half Clue
| |
|
7. | Given the code String s = new String("abc"); Which of the following calls are valid? (A) s.trim() (B) s.replace('a', 'A') (C) s.substring(3) (D) s.toUppercase() (E) s.setCharAt(1,'A') (F) s.append("xyz") |
| Half-n-half Clue
| |
|