T4Tutorials .PK

NSCT – Concurrency & Parallelism (Introductory) MCQs

1. What is concurrency in programming?

(A) Executing tasks one after another


(B) Executing multiple tasks at the same time


(C) Allocating memory


(D) Creating loops




2. What is parallelism in programming?

(A) Handling exceptions


(B) Running tasks sequentially


(C) Performing multiple operations exactly at the same time


(D) Defining variables




3. Which is the main difference between concurrency and parallelism?

(A) There is no difference


(B) Concurrency is faster than parallelism


(C) Parallelism uses loops, concurrency does not


(D) Concurrency is about managing multiple tasks; parallelism is about executing them simultaneously




4. What is a thread?

(A) A loop structure


(B) A type of variable


(C) The smallest unit of a process that can be executed independently


(D) A function




5. What is a process in programming?

(A) An instance of a program in execution


(B) A function


(C) A loop


(D) A variable




6. Which problem occurs when two threads try to access the same resource simultaneously?

(A) Memory leak


(B) Deadlock


(C) Syntax error


(D) Race condition




7. What is a deadlock?

(A) A memory allocation issue


(B) A type of loop


(C) A syntax error


(D) A situation where two or more processes wait indefinitely for resources




8. What is a critical section?

(A) A loop


(B) A part of the program where shared resources are accessed


(C) A variable declaration


(D) A function




9. Which of the following is used to control access to shared resources?

(A) Locks / Mutex


(B) Loops


(C) Variables


(D) Functions




10. What is synchronization in concurrent programming?

(A) Running tasks sequentially


(B) Coordinating threads or processes to avoid conflicts


(C) Allocating memory


(D) Defining variables




11. Which of the following can improve program performance by executing tasks simultaneously?

(A) Concurrency


(B) Parallelism


(C) Loops


(D) Variables




12. Which is a common method to implement concurrency in programming?

(A) Functions


(B) Loops


(C) Multithreading


(D) Variables




13. What is a thread-safe operation?

(A) An operation executed only in a single loop


(B) An operation that can be executed by multiple threads without causing conflicts


(C) An operation that uses variables


(D) An operation inside a function




14. Which is a common challenge in concurrent programming?

(A) Syntax errors


(B) Race conditions and deadlocks


(C) Infinite loops


(D) Memory allocation




15. Which scheduling technique allows multiple tasks to share CPU time effectively?

(A) Time slicing


(B) Loop iteration


(C) Function calling


(D) Variable assignment




16. Which programming model divides a program into independent threads for execution?

(A) Multithreading


(B) Single-threaded


(C) Sequential


(D) Loop-based




17. Which of the following is true about parallelism?

(A) Handles exceptions automatically


(B) Can be done with a single core only


(C) Avoids loops


(D) Requires multiple cores or processors




18. Which of the following helps prevent conflicts when multiple threads access shared data?

(A) Loops


(B) Synchronization mechanisms


(C) Variables


(D) Functions




19. What is context switching?

(A) Saving and restoring the state of a thread or process so the CPU can switch to another task


(B) Allocating memory


(C) Running loops


(D) Handling exceptions




20. What is the main goal of concurrency and parallelism?

(A) To improve performance and resource utilization by executing multiple tasks efficiently


(B) To create loops


(C) To store variables


(D) To handle input/output




Exit mobile version