1/49
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
A developer wants two independent tasks to execute simultaneously while sharing the same memory space. Which approach is most appropriate?
Create two threads within the same process
A Java application performs file downloading and user interface rendering. The UI becomes unresponsive during downloads. What is the BEST solution?
Move downloading logic to a separate thread
What is the PRIMARY advantage of implementing Runnable instead of extending Thread?
Supports multiple inheritance of behavior
A programmer directly invokes run() instead of start(). What will most likely happen?
The method executes in the current thread
A banking application processes deposits and withdrawals simultaneously. Which concept makes this possible?
Concurrency
A context switch occurs when:
The CPU stores and restores thread states
Which scenario demonstrates true multithreading?
Multiple tasks sharing execution time
Why might a developer choose join()?
To wait for another thread to finish
Suppose Thread A calls join() on Thread B. What happens?
Thread A waits for B
A programmer wants a thread to pause for five seconds. Which method should be used?
sleep()
Why is multithreading beneficial in a web server?
Allows handling multiple client requests concurrently
A thread's priority is set to 10. What can be concluded?
It has greater chance of CPU access
Which statement about thread priority is TRUE?
Priority affects scheduling decisions but not guarantees
A thread's isAlive() method returns false. Which conclusion is MOST reasonable?
The thread has terminated
Why is the main thread considered special?
It starts execution of the application
Which design is more scalable for creating hundreds of worker tasks?
Implementing Runnable tasks
A thread is waiting for a network response. What benefit does multithreading provide?
Allows other threads to continue working
A developer observes unpredictable output ordering among threads. Why?
Thread scheduling is controlled by the OS scheduler
What is the biggest risk of assuming thread execution order?
Unreliable program behavior
A thread is sleeping. Which statement is correct?
It temporarily stops execution
Which method serves as the entry point of a thread?
run()
What happens if start() is never called?
The thread never begins execution as a separate thread
A thread scheduler primarily determines:
CPU allocation among threads
Which situation best illustrates concurrency?
Downloading a file while updating a progress bar
Why is Runnable often preferred in enterprise applications?
It allows separation of task and thread management
If Thread A sleeps for 10 seconds, what happens to other threads?
They may continue executing
A process differs from a thread because a process:
Is a collection of associated threads
Which scenario requires join() most?
Generating a report after data processing threads finish
A programmer creates three threads and expects exact output order. Why is this problematic?
Scheduling is nondeterministic
What is the default thread priority in Java?
5
Which priority value is invalid?
11
A system creates too many threads unnecessarily. What is a likely consequence?
Increased overhead and context switching
What is the purpose of Thread.currentThread()?
Returns the currently executing thread object
Which statement best explains shared memory?
Threads within a process can access common data
Which feature makes multithreading suitable for games?
Supports simultaneous input, rendering, and audio processing
What is the effect of calling join() after start()?
Waits until the specified thread finishes
Which scenario most likely benefits from sleep()?
Polling a resource periodically
What is the main purpose of setName()?
Simplify debugging and identification
A developer notices that high-priority threads do not always execute first. Why?
Priority is only a scheduling hint
Which method helps determine whether a thread has completed execution?
isAlive()
Why might extending Thread be less flexible?
Java allows only one class inheritance
A thread completes execution. What is its state regarding isAlive()?
false
Which design best separates business logic from thread execution?
Runnable implementation
What is the likely result if a program depends on thread execution order without synchronization?
Inconsistent outcomes
Which application is LEAST likely to benefit from multithreading?
Batch calculator performing one simple operation once
What is the most accurate description of concurrency?
Simultaneous management of multiple tasks
Why is context switching necessary?
To allow multiple threads to share CPU time
A developer wants to ensure that data processing completes before report generation starts. Which method is most suitable?
join()
Which statement best reflects real-world thread scheduling?
Scheduling decisions depend on the OS and JVM implementation
A software architect is designing a system that must remain responsive while performing long-running tasks. Which principle should guide the design?
Divide tasks into concurrent threads when appropriate