Order PDF of any content from our website with a little minor Fee to donate for hard work. Online MCQs are fully free but PDF books are paid. For details: contact whatsapp +923028700085 Important notes based PDF Books are available in very little price, starting from 500/-PKR; Order Now: contact whatsapp +923028700085

Synchronization Examples – MCQs

Q#1: The Producer-Consumer problem is:
(A) A classical synchronization problem
(B) Only CPU scheduling
(C) Only memory allocation
(D) Only disk I/O
Answer: (A) A classical synchronization problem

Q#2: In the Producer-Consumer problem, the producer:
(A) Generates data and puts it into a buffer
(B) Consumes data
(C) Only allocates memory
(D) Only schedules CPU
Answer: (A) Generates data and puts it into a buffer

Q#3: In the Producer-Consumer problem, the consumer:
(A) Removes data from the buffer and processes it
(B) Produces data
(C) Only allocates CPU
(D) Only manages memory
Answer: (A) Removes data from the buffer and processes it

Q#4: The buffer in Producer-Consumer is:
(A) Shared resource between producer and consumer
(B) Only CPU register
(C) Only disk
(D) Only memory block
Answer: (A) Shared resource between producer and consumer

Q#5: Synchronization tools used in Producer-Consumer include:
(A) Semaphores
(B) Only mutex
(C) Only monitors
(D) Only threads
Answer: (A) Semaphores

Q#6: Semaphore ‘empty’ counts:
(A) Number of empty slots in the buffer
(B) Number of full slots
(C) Only CPU cycles
(D) Only memory blocks
Answer: (A) Number of empty slots in the buffer

Q#7: Semaphore ‘full’ counts:
(A) Number of filled slots in the buffer
(B) Number of empty slots
(C) Only CPU cycles
(D) Only memory blocks
Answer: (A) Number of filled slots in the buffer

Q#8: Semaphore ‘mutex’ ensures:
(A) Mutual exclusion while accessing the buffer
(B) Counting resources
(C) Only CPU scheduling
(D) Only memory allocation
Answer: (A) Mutual exclusion while accessing the buffer

Q#9: The bounded-buffer problem is:
(A) Producer-Consumer with limited buffer size
(B) Only CPU scheduling
(C) Only memory management
(D) Only disk I/O
Answer: (A) Producer-Consumer with limited buffer size

Q#10: In the Reader-Writer problem, readers:
(A) Can read simultaneously if no writer is writing
(B) Can write simultaneously
(C) Only access CPU
(D) Only manage memory
Answer: (A) Can read simultaneously if no writer is writing

Q#11: In the Reader-Writer problem, writers:
(A) Require exclusive access to the shared data
(B) Can read simultaneously
(C) Only CPU-bound
(D) Only memory-bound
Answer: (A) Require exclusive access to the shared data

Q#12: Reader-Writer synchronization tools include:
(A) Semaphores or mutexes
(B) Only CPU scheduling
(C) Only memory allocation
(D) Only disk management
Answer: (A) Semaphores or mutexes

Q#13: First readers-writers problem:
(A) No reader is kept waiting unless a writer has the resource
(B) Only writers have priority
(C) Only CPU allocation
(D) Only memory management
Answer: (A) No reader is kept waiting unless a writer has the resource

Q#14: Second readers-writers problem:
(A) Writers have priority to prevent starvation
(B) Readers have priority
(C) Only CPU scheduling
(D) Only memory allocation
Answer: (A) Writers have priority to prevent starvation

Q#15: Dining Philosophers problem is:
(A) Classical synchronization problem
(B) Only CPU scheduling
(C) Only memory allocation
(D) Only disk I/O
Answer: (A) Classical synchronization problem

Q#16: In Dining Philosophers problem, forks are:
(A) Shared resources
(B) Only CPU registers
(C) Only memory blocks
(D) Only disk sectors
Answer: (A) Shared resources

Q#17: Deadlock can occur in Dining Philosophers if:
(A) All philosophers pick up one fork and wait for the second
(B) Only one philosopher eats
(C) Only CPU idle
(D) Only memory full
Answer: (A) All philosophers pick up one fork and wait for the second

Q#18: Solutions to Dining Philosophers include:
(A) Resource hierarchy, semaphore, or avoiding circular wait
(B) Only CPU scheduling
(C) Only memory allocation
(D) Only disk I/O
Answer: (A) Resource hierarchy, semaphore, or avoiding circular wait

Q#19: Barriers are:
(A) Synchronization tools to make threads wait until all reach a certain point
(B) Only memory allocation
(C) Only CPU scheduling
(D) Only disk I/O
Answer: (A) Synchronization tools to make threads wait until all reach a certain point

Q#20: Barrier example:
(A) Threads in parallel computation wait until all finish a phase
(B) Only CPU idle
(C) Only memory full
(D) Only disk busy
Answer: (A) Threads in parallel computation wait until all finish a phase

Q#21: Semaphore P operation:
(A) Decrements semaphore and may block the process
(B) Increments semaphore
(C) Only CPU usage
(D) Only memory allocation
Answer: (A) Decrements semaphore and may block the process

Q#22: Semaphore V operation:
(A) Increments semaphore and may wake a blocked process
(B) Decrements semaphore
(C) Only CPU usage
(D) Only memory allocation
Answer: (A) Increments semaphore and may wake a blocked process

Q#23: Deadlock occurs in synchronization examples when:
(A) Processes wait indefinitely for resources held by each other
(B) CPU idle
(C) Only memory full
(D) Only disk failure
Answer: (A) Processes wait indefinitely for resources held by each other

Q#24: Starvation occurs in:
(A) Priority-based synchronization
(B) FCFS synchronization
(C) Round-robin only
(D) SJF only
Answer: (A) Priority-based synchronization

Q#25: Solution to starvation:
(A) Aging
(B) Ignore priorities
(C) Random selection
(D) CPU reset
Answer: (A) Aging

Q#26: Semaphore can prevent:
(A) Race conditions
(B) Only CPU idle
(C) Only memory overflow
(D) Only disk failure
Answer: (A) Race conditions

Q#27: Mutex ensures:
(A) Only one process accesses shared resource at a time
(B) Multiple processes simultaneously
(C) Only CPU scheduling
(D) Only memory allocation
Answer: (A) Only one process accesses shared resource at a time

Q#28: Monitors are:
(A) High-level synchronization tools with mutex and condition variables
(B) Only CPU registers
(C) Only memory blocks
(D) Only disk management
Answer: (A) High-level synchronization tools with mutex and condition variables

Q#29: Condition variables are used:
(A) To make processes wait for a condition in monitors
(B) Only memory allocation
(C) Only CPU scheduling
(D) Only disk management
Answer: (A) To make processes wait for a condition in monitors

Q#30: Binary semaphore can take values:
(A) 0 or 1
(B) 1 or 2
(C) Any positive number
(D) Only CPU registers
Answer: (A) 0 or 1

Q#31: Counting semaphore can take values:
(A) 0 or positive integers
(B) Only 0 or 1
(C) Only CPU registers
(D) Only memory blocks
Answer: (A) 0 or positive integers

Q#32: Synchronization examples aim to:
(A) Avoid race conditions, deadlock, and ensure mutual exclusion
(B) Only CPU optimization
(C) Only memory allocation
(D) Only disk management
Answer: (A) Avoid race conditions, deadlock, and ensure mutual exclusion

Q#33: Producer-Consumer with infinite buffer:
(A) No need for full buffer check
(B) Still requires mutual exclusion
(C) Only CPU scheduling
(D) Only memory allocation
Answer: (A) No need for full buffer check

Q#34: Reader-Writer problem allows:
(A) Multiple readers simultaneously, one writer exclusively
(B) Multiple writers simultaneously
(C) Only one reader
(D) Only CPU-bound threads
Answer: (A) Multiple readers simultaneously, one writer exclusively

Q#35: Dining Philosophers deadlock can be prevented by:
(A) Resource ordering or odd/even philosophers pick forks differently
(B) Random picking
(C) CPU reset
(D) Memory allocation
Answer: (A) Resource ordering or odd/even philosophers pick forks differently

Q#36: Barrier example in matrix multiplication:
(A) Threads wait until all finish one step before moving to next
(B) Only CPU idle
(C) Only memory allocation
(D) Only disk I/O
Answer: (A) Threads wait until all finish one step before moving to next

Q#37: Critical section protection prevents:
(A) Race conditions
(B) CPU idle
(C) Memory overflow
(D) Disk failure
Answer: (A) Race conditions

Q#38: Semaphore operations are:
(A) Atomic to prevent race conditions
(B) Non-atomic
(C) Only memory-bound
(D) Only CPU-bound
Answer: (A) Atomic to prevent race conditions

Q#39: Thread safety in synchronization examples ensures:
(A) Correct behavior when multiple threads access shared data
(B) Only CPU scheduling
(C) Only memory allocation
(D) Only disk management
Answer: (A) Correct behavior when multiple threads access shared data

Q#40: Reentrant functions are:
(A) Safe to call by multiple threads simultaneously
(B) Only memory-bound
(C) Only CPU-bound
(D) Only I/O-bound
Answer: (A) Safe to call by multiple threads simultaneously

Q#41: Semaphore can cause:
(A) Deadlock if used improperly
(B) Only CPU efficiency
(C) Only memory allocation
(D) Only disk management
Answer: (A) Deadlock if used improperly

Q#42: Mutex can be used for:
(A) Mutual exclusion in shared resources
(B) Counting resources
(C) Only CPU scheduling
(D) Only memory allocation
Answer: (A) Mutual exclusion in shared resources

Q#43: Monitor simplifies:
(A) Synchronization and mutual exclusion management
(B) Only CPU scheduling
(C) Only memory allocation
(D) Only disk I/O
Answer: (A) Synchronization and mutual exclusion management

Q#44: Semaphore initial value in bounded buffer indicates:
(A) Number of available slots
(B) CPU cycles
(C) Memory blocks
(D) Disk sectors
Answer: (A) Number of available slots

Q#45: Producer waits if:
(A) Buffer is full
(B) Buffer is empty
(C) CPU idle
(D) Memory full
Answer: (A) Buffer is full

Q#46: Consumer waits if:
(A) Buffer is empty
(B) Buffer is full
(C) CPU idle
(D) Memory full
Answer: (A) Buffer is empty

Q#47: Starvation prevention in synchronization examples uses:
(A) Aging
(B) Random selection
(C) Ignore priorities
(D) CPU reset
Answer: (A) Aging

Q#48: Spinlock is useful for:
(A) Short critical sections in multiprocessor systems
(B) Long critical sections
(C) Only CPU scheduling
(D) Only memory allocation
Answer: (A) Short critical sections in multiprocessor systems

Q#49: Semaphore can implement:
(A) Producer-Consumer, Reader-Writer, Barriers
(B) Only FCFS
(C) Only Round-Robin
(D) Only SJF
Answer: (A) Producer-Consumer, Reader-Writer, Barriers

Q#50: Overall goal of synchronization examples:
(A) Correct and safe execution of concurrent processes
(B) Only CPU optimization
(C) Only memory allocation
(D) Only disk management
Answer: (A) Correct and safe execution of concurrent processes

Contents Copyrights Reserved By T4Tutorials