1. Which of the following are valid statements
A. Math.round(9.99,1);
B. public class MyCalc extends Math
C. Math.max(s);
D. Math.mod(4,10);
E. None of the above is true
2. Which are related to the main thread? (choose three)
A. It is daemon thread
B. It is the thread from which child threads will be created
C. The moment the main thread stops executing, the program is terminated.
D. It is the last thread to finish execution.
3. ___ method notifies the thread that is currently in the waiting state.
A. Waite()
B. Notify()
C. NotifyAll()
D. finalize()
4. Which of those are the types of threads in a Java program?
A. Main thread
B. Daemon
C. User Thread
D. System thread
5. Which of the following terminates a thread execution?
A. Calling the stop() method
B. An external JVM event
C. A thread returning from its run() method
D. All of above
6. Which Utility class would you use if you want to have an array which can be extended dynamically while your Java program runs?
A. An Enumeration
B. A Malloc
C. A Vector
D. A Hashtable
7. Which of following classes are not a non-abstract class of java.util
A. Vector
B. Random
C. Hashtable
D. StringBuffer
8. Which of the following are methods of the Collection interface? (choose 3)
A. setText
B. iterator
C. toArray
D. isEmpty
9. Which are related to the main thread? (choose three)
A. It is the thread from which child threads will be created
B. It is daemon thread
C. It is the last thread to finish execution.
D. The moment the main thread stops executing, the program is terminated.
10. The ___________ method suspends a thread for a certain period of time
A. start()
B. destroy()
C. sleep()
D. interrupt()
11. Daemon threads are service providers for other threads running in the different process
A. FALSE
B. TRUE
12. LinkedHasSet maintains the sorting of the items added to the set
A. FALSE
B. TRUE
13. A newly created thread inherits the priority of its parent thread
A. FALSE
B. TRUE
14. Parameters in annotation are declared as fields in a class
A. FALSE
B. TRUE
15. The @Deprecated annotation indicated that when a deprecated program element is used, the compiler should NOT give a warning.
A. TRUE
B. FALSE
16. What the predefined-character “\D” is?
A. a digit
B. a non-digit
C. a character
D. a non-character
17. The following code snippet is TRUE or FALSE?
List list = new LinkedList();
list.add(0);
A. TRUE
B. FALSE
18. Analyze the following code:
class MyThread implements Runnable {
public static void main(String[] args) {
Thread t = new Thread(this);
t.start();
}
public void run(){
System.out.println("hi");
}
}
Select the one right answer.
A. This program does not compile
B. This program compiles and the word "hi" appears in the standard output, once
C. This program compiles but nothing appears in the standard output
D. This program compiles and the word "hi" appears continuously in the standard output until the user hits control-c to stop the program
19. Which class is the superclass of all the input stream class
A. InputStream
B. FileInputStream
C. Stream
D. Input
20. The____ method returns the name of the thread
A. public final String receiveName()
B. public final String requestName()
C. public final String checkName()
D. public final String isName()
E. public final String returmName()
F. public final String getName()