Object Oriented Programming - I (3140705) MCQs

MCQs of Concurrency

Showing 11 to 20 out of 29 Questions
11.
Which of these method of Thread class is used to Suspend a thread for a period of time?
(a) sleep()
(b) terminate()
(c) suspend()
(d) stop()
Answer:

Option (a)

12.
Which method of predefined class Thread is used to check whether current thread being checked is still running?
(a) isAlive()
(b) Join()
(c) isRunning()
(d) Alive()
Answer:

Option (a)

13.
Which of these keywords are used to implement synchronization?
(a) synchronize
(b) syn
(c) synch
(d) synchronized
Answer:

Option (d)

14.
Which of the interface contains all the methods used for handling thread related operations in Java?
(a) Runnable interface
(b) Math interface
(c) System interface
(d) ThreadHandling interface
Answer:

Option (a)

15.
Which of these class is used to make a thread?
(a) String
(b) System
(c) Thread
(d) Runnable
Answer:

Option (c)

16.
Which of this interface is implemented by Thread class?
(a) Runnable
(b) Connections
(c) Set
(d) MapConnections
Answer:

Option (a)

17.
What is the name of the method used to start a thread execution?
(a) init();
(b) start();
(c) run();
(d) resume();
Answer:

Option (b)

18.
Which two are valid constructors for Thread?
1. Thread(Runnable r, String name)
2. Thread()
3. Thread(int priority)
4. Thread(Runnable r, ThreadGroup g)
5. Thread(Runnable r, int priority)
(a) 1 and 3
(b) 2 and 4
(c) 1 and 2
(d) 2 and 5
Answer:

Option (c)

19.
Which two of the following methods are defined in class Thread?
1. start()
2. wait()
3. notify()
4. run()
5. terminate()
(a) 1 and 4
(b) 2 and 3
(c) 3 and 4
(d) 2 and 4
Answer:

Option (a)

20.
Which method must be defined by a class implementing the java.lang.Runnable interface?
(a) void run()
(b) public void run()
(c) public void start()
(d) void run(int priority)
Answer:

Option (b)

Showing 11 to 20 out of 29 Questions