1. : What is multithreading?
(A) Executing multiple processes at the same time
(B) Executing multiple threads simultaneously
(C) Running multiple operating systems concurrently
(D) Running multiple programs sequentially
2. : Which of the following is a benefit of multithreading?
(A) Reduced CPU utilization
(B) Simpler program design
(C) Increased responsiveness
(D) Reduced memory usage
3. : In multithreading, what is a thread?
(A) A type of process
(B) The smallest unit of CPU execution
(C) A program counter
(D) A single execution of an instruction
4. : What is the relationship between a process and a thread?
(A) A thread can exist without a process
(B) A process can have multiple threads
(C) A thread can have multiple processes
(D) A process is smaller than a thread
5. : Which of the following is an example of multithreaded application?
(A) Word processing
(B) Web browsers
(C) Media players
(D) All of the above
6. : Which type of multithreading executes threads in a round-robin fashion?
(A) Concurrent multithreading
(B) Cooperative multithreading
(C) Preemptive multithreading
(D) Time-slicing multithreading
7. : Which multithreading model maps multiple user threads to a single kernel thread?
(A) Many-to-One model
(B) One-to-One model
(C) Many-to-Many model
(D) None of the above
8. : In the context of multithreading, what is thread synchronization?
(A) Ensuring that all threads run at the same speed
(B) Coordinating thread execution to avoid conflicts
(C) Allowing threads to access shared resources freely
(D) Preventing multiple threads from running
9. : Which of the following is a common issue in multithreaded programming?
(A) Deadlock
(B) Increased CPU speed
(C) Faster execution
(D) Memory overuse
10. : What is a mutex in multithreading?
(A) A variable used to avoid memory allocation issues
(B) A type of thread that controls other threads
(C) A lock that ensures mutual exclusion of threads
(D) A way to speed up thread execution
11. : How does a thread differ from a process?
(A) A thread is a complete independent program
(B) A thread shares resources with other threads within the same process
(C) A process is faster than a thread
(D) A process does not contain any threads
12. : In a multithreaded environment, what is a race condition?
(A) When two threads compete for CPU time
(B) When the execution outcome depends on the timing of threads
(C) When threads are waiting for shared resources
(D) When one thread prevents others from running
13. : What is the difference between concurrent and parallel execution?
(A) Concurrent execution is faster
(B) Parallel execution runs threads simultaneously on multiple processors
(C) Concurrent execution can only run on one processor
(D) Parallel execution and concurrent execution are the same
14. : Which multithreading model maps each user thread to a kernel thread?
(A) Many-to-One
(B) One-to-One
(C) Many-to-Many
(D) None of the above
15. : What is the main purpose of thread pools in multithreading?
(A) To prevent threads from terminating
(B) To pre-create a set of threads for reuse
(C) To make thread creation faster
(D) To eliminate the need for synchronization
16. : What is context switching in multithreading?
(A) Switching between multiple programs
(B) Saving and restoring the state of a thread
(C) Moving a thread to the background
(D) Killing a thread and creating a new one
17. : Which of the following is true about threads in Java?
(A) Java does not support multithreading
(B) Java uses the Many-to-One threading model
(C) Java threads can be created by implementing the Runnable interface
(D) Java threads cannot access shared resources
18. : Which of the following is used for thread synchronization in multithreading?
(A) Semaphore
(B) Cache
(C) Clock
(D) Stack
19. : What is deadlock in multithreading?
(A) When threads run faster than expected
(B) When threads wait indefinitely for resources held by each other
(C) When threads stop executing after completion
(D) When threads execute in parallel without interruption
20. : Which method is used to start a thread in Java?
(A) startThread()
(B) begin()
(C) run()
(D) start()
21. : In multithreading, which statement is true about the join() method?
(A) It joins two threads into one
(B) It allows one thread to wait for another to finish
(C) It starts a new thread
(D) It kills a thread
22. : Which multithreading model allows both user and kernel threads to be mapped dynamically?
(A) Many-to-One model
(B) One-to-One model
(C) Many-to-Many model
(D) One-to-Many model
23. : What is the main disadvantage of multithreading?
(A) Increased CPU speed
(B) Complex debugging and synchronization issues
(C) Reduced execution time
(D) Simpler design
24. : Which method in Java is used to check if a thread is currently alive?
(A) isRunning()
(B) isAlive()
(C) getState()
(D) checkAlive()
25. : What happens when the sleep() method is called on a thread?
(A) The thread terminates
(B) The thread enters a non-runnable state for a specified period
(C) The thread starts executing immediately
(D) The thread releases all locks
26. : In multithreading, what is thread starvation?
(A) When a thread runs out of memory
(B) When a thread is blocked from accessing resources indefinitely
(C) When a thread uses all available CPU time
(D) When a thread is executed continuously
27. : Which of the following mechanisms ensures that only one thread can access a resource at a time?
(A) Scheduling
(B) Mutual exclusion (Mutex)
(C) Parallel execution
(D) Thread pooling
28. : What is a thread-safe function?
(A) A function that cannot be accessed by multiple threads
(B) A function that ensures consistent behavior when executed by multiple threads
(C) A function that terminates all threads
(D) A function that runs in the background
29. : What is the purpose of the yield() method in multithreading?
(A) To start a new thread
(B) To allow other threads to execute
(C) To terminate a thread
(D) To increase thread priority
30. : Which of the following best describes cooperative multithreading?
(A) Threads are scheduled based on priority
(B) Threads voluntarily give up control
(C) Threads are forced to give up control by the scheduler
(D) Threads execute simultaneously
31. : Which of the following statements is true about preemptive multithreading?
(A) Threads cannot be interrupted
(B) The system scheduler can forcibly switch between threads
(C) Threads run until they voluntarily yield control
(D) Threads run one after another in sequence
32. : Which method is used to suspend the execution of a thread?
(A) wait()
(B) suspend()
(C) sleep()
(D) pause()
33. : What is thread priority in multithreading?
(A) The amount of memory allocated to a thread
(B) The relative importance assigned to a thread by the scheduler
(C) The order in which threads are created
(D) The amount of time a thread can run
34. : Which of the following is a condition required to prevent deadlock in multithreading?
(A) Mutual exclusion
(B) Hold and wait
(C) No preemption
(D) Circular wait
35. : Which method causes the currently executing thread to temporarily pause and allow other threads to execute?
(A) yield()
(B) pause()
(C) stop()
(D) wait()
36. : Which of the following can be used to handle exceptions in multithreading?
(A) try-catch block
(B) synchronized block
(C) Thread pooling
(D) Thread scheduling
37. : Which of the following is NOT a benefit of using multithreading?
(A) Increased responsiveness
(B) Better resource utilization
(C) Simplified program design
(D) Increased throughput
38. : How is multithreading implemented in Java?
(A) By extending the Thread class
(B) By implementing the Runnable interface
(C) Both a) and b)
(D) None of the above
39. : What is the purpose of the synchronized keyword in Java?
(A) To stop a thread
(B) To run multiple threads concurrently
(C) To ensure that only one thread can access a block of code at a time
(D) To increase the speed of thread execution
40. : What is the major drawback of using locks for thread synchronization?
(A) Deadlocks
(B) Increased thread priority
(C) Faster execution
(D) Simplified code
41. : Which of the following methods causes the current thread to wait for another thread to finish execution?
(A) join()
(B) wait()
(C) sleep()
(D) suspend()
42. : What is the main advantage of thread pooling?
(A) Faster thread creation
(B) Reusing existing threads to avoid the overhead of thread creation
(C) Reducing CPU utilization
(D) Increasing memory usage
43. : Which of the following is a common solution to avoid thread starvation?
(A) Lowering thread priority
(B) Using fair scheduling algorithms
(C) Suspending high-priority threads
(D) Allocating more CPU time to low-priority threads
44. : How does Java handle multithreading internally?
(A) By assigning each thread to a separate core
(B) By using the JVM’s built-in thread scheduler
(C) By allowing threads to share the same memory space
(D) By using thread priority exclusively
45. : In a multithreaded environment, what is the purpose of a semaphore?
(A) To signal thread termination
(B) To control access to shared resources
(C) To block all threads except one
(D) To assign CPU time to threads
46. : What is the term used when multiple threads access shared resources without proper synchronization?
(A) Thread safety
(B) Race condition
(C) Deadlock
(D) Thread starvation