1.
Please select signed integrals
A. char, byte, and short
B. byte, short, int, and long
C. char, short, and long
Answer B
2.
Java characters are ...
A. ASCII code
B. Binary code
C. Unicode
D. ANSI code
Answer C
3.
Select default value of boolean type
A. true
B. false
C. 0
D. 1
Answer B
4.
Consider the following line of code:
char x[]=new char[10];
After execution, what is value of x[0]?
A. 0
B. '\u0000'
C. null
Answer B
5.
Please choose invalid identifiers
A. temp
B. BIGint
C. 25_length
D. !length
Answer C, D
6.
Consider the following line of code:
byte x=64;
byte y=5;
byte z= (byte)(x*y);
After execution what is value of z?
A. 320
B. 0
C. 645
D. 64
Answer D
7.
A protected method may be overridden by ...
A. A private method
B. A protected method
C. A public method
D. All of the above
Answer : B, C
8.
The abstract modifier can NOT be applied to ...
A. A variable
B. A method
C. A class
D. A constructor
Answer: A, D
9.
The switch() construct is used to make a choice based upon ...
A. A char value
B. An int value
C. A String value
Answer : A, B
10.
Answer : A, B
11.
How can you declare an overriding method?
A. Using the same method name with identical arguments and return type
B. Using the same method name with identical arguments and different return type
C. Using the same method name with different arguments and same return type
D. All of the above
Answer A
12.
When a default constructor is provided by the compiler?
A. If you define no constructor at all in a class
B. When you define at least one constructor
C. It is always provided whether you define a constructor or not
Answer A
13.
Please identify invalid use of comparison operator for the following code:
String s=new String("S");
String t=new String("T");
int x=83;
int y=84;
A. s == t
B. x!=y
C. x==s
D. s!=t
Answer: C
14.
The default priority of the thread is
A. 0
B. 1
C. 5
D. 10
Answer: C
15.
Select correct statements for a java.lang.String
A. Strings are sequences of 16 bit Unicode characters.
B. Strings are immutable.
C. Both of the above
Answer C
16.
Which of the following statements are NOT true about Java garbage collection Thread?
A. The garbage collection thread has a low priority
B. The garbage collection thread can be invoked at any time
C. A call to System.gc() is guaranteed to invoke garbage collection thread
immediately
D. A call to Runtime.getRuntime().gc() is guaranteed to invoke garbage collection
thread immediately
Answer: B,C,D
17.
Answer A,B,C
18.
Answer: A, D
19.
Which of the following classes can store null value for a key?
A. java.util.Hashtable
B. java.util.HashMap
C. java.util.Properties
Answer B
20.
The circumstances that can prevent execution of the code in a finally block are
A. The death of the thread
B. The use of System.exit()
C. It is always guaranteed to be executed.
Answer : A, B
21.
Answer : D
22.
The following types of loop are guaranteed to be executed at least once
A. The do loop
B. The while loop
C. The for loop
Answer : A
23.
Please select invalid java keywords
A. include
B. ifdef
C. sizeof
D. goto
Answer : A,B,C
24.
Please identify correct assignment for boolean type.
A. boolean javaExam=true;
B. boolean javaExam=True;
C. boolean javaExam=1;
Answer A
25.
Answer A
26.
Answer : B
27.
Which of the following collections maintain object references in the order they were
added?
A. java.util.Vector
B. java.util.Hashtable
C. java.util.HashMap
D. java.util.ArrayList
Answer : A, D
28.
When can't you override a method?
A. when method is declared abstract
B. When method is declared final
C. when method is declared private
D. when method is declared static
Answer: B,C,D
29.
What method(s) needed to be declared by a class implementing Runnable interface?
A. public void start()
B. public void run()
C. public boolean start()
D. public boolean run()
Answer : B
30.
A class variable is declared using following modifiers
A. protected
B. private
C. public
D. static
Answer : D