0% found this document useful (0 votes)
5 views3 pages

Object Oriented Programming III MCQs

The document is a question bank for a course on Object Oriented Programming, specifically focusing on Java Threads. It includes multiple choice questions, short questions, and long questions related to thread methods, characteristics, and synchronization in Java. The content is structured to aid students in understanding and revising key concepts in multithreading.

Uploaded by

devr07j
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Object Oriented Programming III MCQs

The document is a question bank for a course on Object Oriented Programming, specifically focusing on Java Threads. It includes multiple choice questions, short questions, and long questions related to thread methods, characteristics, and synchronization in Java. The content is structured to aid students in understanding and revising key concepts in multithreading.

Uploaded by

devr07j
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

TYBCA – Semester V

US05CBCA25 – Object Oriented Programming - III


Unit-4 Question Bank
Multiple Choice Questions

1. Which are the methods of the object class?


A. notify(); C. wait(long msces);
B. notifyAll(); D. All of them

2. Which will contain the body of the thread?


A. run(); C. start();
B. wait(); D. terminate();

3. Which is the name of the method used to start a thread execution?


A. wait(); C. terminate();
B. start(); D. notify();

4. Which class or interface defines the wait(), notify() and notifyAll() methods?
A. Runnable C. Object
B. Thread D. None of Above

5. What are the two valid constructor for Thread?


A. Thread() , Thread(int priority) C. Thread(), Thread(Runnable r, String name)
B. Thread() ,Thread(Runnable r, ThreadGroup g) D. Thread(), Thread(int pripority)

6. Which is not the method defined in class Thread?


A. wait(): C. start();
B. run(); D. stop();

7. Which method of the thread class is used to find out the priority given to a thread?
A. get(); C. getPriority();
B. threadPriority(); D. getThreadPriority();

8. What is the output in the following thread java program?


Class thread_example
{
public static void main(String args[])
{
Thread t = [Link]();
[Link]([Link]());
}
}
A. 0 C. false
B. 1 D. true

9. Which function of pre defined class Thread is used to check if current thread being
checked is still running?
A. join(); C. alive();
B. isRunning(); D. isAlive();
10. When a class extends the thread class, it should override ____________ method of
thread class to start the thread.
A. start(); C. run();
B. go(); D. init();

11. In java a thread can be created by ___________


A. Extended the thread class C. Implementing Runnable interface.
B. Both of above() D. None of these

12. Which method is called internally by Thread start() method?


A. run(); C. execute();
B. main(); D. launch();

13. Thread synchronization in a process will be required when ___________________


A. All thread sharing same address space C. All thread sharing same files
B. All thread sharing same global variable D. All of above

14. Which method is used to get current running thread object?


A. runningThread(); C. currentThread();
B. runnableThread(); D. None of Above

15. The life cycle of thread in java is controlled by ____________


A. JVM C. JRE
B. JDK D. None of Above

16. Min and Max priority of thread in java multithreading are_____________


A. 1, 10 C. 0, 255
B. 0, 10 D. 1, 256

17. Which method we implement from runnable interface?


A. start(); C. execute();
B. run(); D. call();

18. What is sometimes called a lightweight process?


A. Process C. JVM
B. Thread D All of above

19. Which method restart the thread?


A. start(); C. restartThread();
B. restart(); D. None of above.

20. Which method we implement from runnable interface?


A. StringBuilder C. StringBuffer
B. All of above D. None of Above
Short Questions

1. What is Java Thread?


2. Write down Thread characteristics.
3. List Thread implementation in java. Explain any one.
[ or explain Java Thread implementation By extending thread class / By
Implementing Runnable interface]
4. List Java Thread Methods.
5. Define the following.[Any]
a. String getName()
b. void setName(String s)
c. [Link] getState()
d. void start()
e. void run()
f. void join()
g. boolean isAlive()
h. void sleep(int time)
i. void yield()
j. void wait()
k. void notify()
l. void notifyAll
m. void interrupt()
n. boolean interrupted()
o. void setPriority(int p)
p. int getPriority()
6. What is Thread Scheduling?

Long Questions
1. What is Threads? Which are the Characteristics of Thread and why we use
Thread?
2. Draw Life Cycle of a Thread and explain in detail.
3. Explain Thread creation in Java.
4. List Thread methods and explain any five.
5. Explain Thread Synchronization and how to Implement synchronization
with example.

You might also like