Process vs Thread — Concept Check
Questions on Process vs Thread. A process is an independent program in execution with its own memory space, while a thread is a lightweight unit of execution that shares memory within the same process.
Questions in this quiz
6 questions on Process vs Thread — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A Java application is experiencing slow performance. Profiling shows high context-switching overhead. What could be a likely cause?
- AInsufficient memory leading to paging
- BToo many threads causing frequent context switches
- CNetwork latency issues
- DToo many processes causing frequent context switches
2.A developer wants to improve concurrency in an application. What is a major advantage of using threads over processes?
- AThreads are isolated from each other
- BThreads have separate memory spaces
- CThreads do not require synchronization
- DThreads are cheaper to create and manage
3.Two threads in a Java application are deadlocked. What is the most likely cause?
- AThe threads are in a race condition
- BEach thread is holding a lock and waiting for the other's lock
- COne thread has crashed
- DThe JVM has run out of memory
4.In a Java application, why might a developer choose to use virtual threads (Project Loom)?
- ATo ensure thread isolation
- BTo eliminate the need for synchronization
- CTo reduce the overhead of kernel-level threads
- DTo avoid race conditions
5.In Java, what does the java.lang.Thread class represent?
- AA process
- BA kernel-level process
- CA virtual machine
- DA thread within a process
6.Why is context-switching between threads faster than between processes?
- AThreads share the same memory space
- BThreads are isolated from each other
- CThreads do not require synchronization
- DThreads have separate memory spaces