Java Multithreading: 17 MCQs

All 17 multiple-choice questions from this kit, free and with no sign-up.

Warm-up · 6 questions

Q1. What is a thread in Java?

Beginner
A A lightweight sub-process that runs concurrently with other threads
B A collection of objects
C A separate program running independently
D A class that contains only static methods

Answers and explanations are in the Veda app.

Q2. Which of the following is the correct way to create a thread by implementing an interface?

Beginner
A Extend the Thread class
B Implement the Thread interface
C Implement the Runnable interface
D Extend the Runnable class

Answers and explanations are in the Veda app.

Q3. Which method is called to start a thread's execution?

Beginner
A begin()
B start()
C execute()
D run()

Answers and explanations are in the Veda app.

Q4. What is the purpose of the run() method in a thread?

Beginner
A To pause the thread
B To contain the code that executes when the thread is running
C To start the thread
D To stop the thread

Answers and explanations are in the Veda app.

Q5. Which of the following is a benefit of multithreading?

Beginner
A It reduces memory usage by sharing all data
B It always makes programs run faster on single-core CPUs
C It allows concurrent execution of tasks, improving resource utilization
D It eliminates the need for synchronization

Answers and explanations are in the Veda app.

Q6. The start() method can be called multiple times on the same thread object.

Beginner
A True
B False

Answers and explanations are in the Veda app.

Building up · 8 questions

Q7. What is the default priority of a thread in Java?

Intermediate
A 0
B 5
C 1
D 10

Answers and explanations are in the Veda app.

Q8. Which method causes the currently executing thread to pause temporarily and allow other threads to execute?

Intermediate
A wait()
B yield()
C sleep()
D join()

Answers and explanations are in the Veda app.

Q9. What is the purpose of the join() method?

Intermediate
A To interrupt a thread
B To synchronize threads
C To wait for a thread to finish before continuing
D To combine two threads into one

Answers and explanations are in the Veda app.

Q10. Which keyword is used to make a method or block thread-safe?

Intermediate
A synchronized
B volatile
C final
D transient

Answers and explanations are in the Veda app.

Q11. What is a race condition?

Intermediate
A A condition where two threads run at different speeds
B A thread that runs faster than others
C A deadlock between threads
D A situation where multiple threads access shared data concurrently, leading to inconsistent results

Answers and explanations are in the Veda app.

Q12. Which method is used to interrupt a thread?

Intermediate
A cancel()
B interrupt()
C stop()
D terminate()

Answers and explanations are in the Veda app.

Q13. Which of the following is NOT a thread state in Java?

Intermediate
A WAITING
B NEW
C RUNNABLE
D PAUSED

Answers and explanations are in the Veda app.

Q14. Synchronization is used to prevent race conditions.

Intermediate
A True
B False

Answers and explanations are in the Veda app.

Topper level · 3 questions

Q15. What is the state of a thread when it is waiting for a monitor lock?

Advanced
A BLOCKED
B WAITING
C RUNNABLE
D TERMINATED

Answers and explanations are in the Veda app.

Q16. What is the purpose of the volatile keyword?

Advanced
A To make a variable thread-safe by ensuring visibility of changes across threads
B To prevent a variable from being serialized
C To increase the priority of a thread
D To make a variable immutable

Answers and explanations are in the Veda app.

Q17. What is a deadlock?

Advanced
A A thread that runs forever
B A thread that is terminated abruptly
C A thread that never starts
D Two or more threads waiting indefinitely for each other's locks

Answers and explanations are in the Veda app.

Make your own

Your notes can be a kit like these

Every kit here was made from real study material. Point Veda at a chapter, a PDF, a photo or a link and get notes, flashcards, practice MCQs, games and a scored test — free to start, in more than 40 languages.

  • Chapter notes
  • Flashcards
  • Practice MCQs
  • Scored tests
  • Paper Solver

Get Veda free See what students get

Free to start · Android app and web · More than 40 languages