Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Os MCQ Unit2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

UNIT I

1. What is the critical section in process synchronization?

a) A segment of code where shared resources are accessed

b) A method of process communication

c) A section of a program that never accesses shared data

d) A technique to prevent deadlock

Answer: a

2. Which of the following is true about Peterson’s solution?

a) It uses semaphores for process synchronization

b) It allows multiple processes to enter the critical section simultaneously

c) It works for only two processes

d) It cannot guarantee mutual exclusion

Answer: c

3. What does synchronization hardware typically do?

a) Ensures that only one process can enter the critical section at a time

b) Detects deadlocks automatically

c) Allocates memory to processes

d) Enables swapping between processes

Answer: a

4. Which of the following is a property of semaphores?

a) Semaphores can only be used for deadlock detection


b) Semaphores are a signaling mechanism

c) Semaphores do not ensure mutual exclusion

d) Semaphores are used to swap processes

Answer: b

5. In process synchronization, which problem involves readers and writers trying to access a shared
database?

a) Producer-consumer problem

b) Dining philosophers problem

c) Readers-writers problem

d) Banker's algorithm

Answer: c

6. What is a system model in deadlock characterization?

a) A method for deadlock prevention

b) A representation of processes and resources as a graph

c) A scheduling algorithm for processes

d) A technique for synchronization

Answer: b

7. Which of the following is a method for deadlock prevention?

a) Allow circular wait conditions

b) Ensure at least one process can acquire all resources

c) Allow processes to request resources only in a specific order

d) Make processes wait indefinitely


Answer: c

8. What does deadlock avoidance involve?

a) Detecting deadlocks after they occur

b) Allocating resources dynamically based on current availability

c) Swapping processes to avoid deadlocks

d) Killing processes to avoid deadlocks

Answer: b

9. In memory management, what does paging do?

a) Allocates entire memory to a single process

b) Divides the process memory into equal-sized pages

c) Prevents deadlocks from occurring

d) Ensures processes access memory in sequential order

Answer: b

10. What is the purpose of the page table in a paging system?

a) To track free memory

b) To map virtual addresses to physical addresses

c) To detect deadlocks

d) To manage process communication

Answer: b

11. What is the main purpose of process synchronization?


a) To prevent processes from entering the critical section

b) To avoid deadlocks

c) To ensure that multiple processes access shared resources correctly

d) To enable process communication

Answer: c

12. In Peterson's solution, which variables are used to ensure synchronization?

a) lock and signal

b) turn and flag

c) wait and signal

d) semaphore and mutex

Answer: b

13. Which of the following is a classical problem of synchronization?

a) Page replacement problem

b) Dining philosophers problem

c) Paging and segmentation

d) Priority inversion problem

Answer: b

14. What is the main disadvantage of Peterson's solution?

a) It cannot guarantee mutual exclusion

b) It only works for multiple processes

c) It is not suitable for modern multiprocessor systems

d) It does not prevent deadlocks


Answer: c

15. What is a mutex lock?

a) A software-based synchronization technique

b) A hardware-based memory management technique

c) A type of semaphore

d) A scheduling algorithm

Answer: a

16. How do semaphores differ from mutexes?

a) Semaphores are used for single-threaded applications

b) Mutexes can have a value greater than 1

c) Semaphores can be used to signal multiple processes

d) Mutexes are software-based while semaphores are hardware-based

Answer: c

17. What is the key idea behind the Banker's algorithm for deadlock avoidance?

a) Processes must wait for resources in a circular manner

b) Resources are allocated dynamically to prevent deadlocks

c) All resources must be pre-allocated to processes

d) It ensures the system always remains in a safe state

Answer: d

18. Which condition must hold for deadlock to occur?


a) Preemption

b) Circular wait

c) Shared resources

d) Paging

Answer: b

19. What is a safe state in the context of deadlock avoidance?

a) A state where the system can allocate resources without entering deadlock

b) A state where processes wait for resources indefinitely

c) A state where all processes are terminated

d) A state where all resources are allocated to one process

Answer: a

20. Which of the following methods handles deadlocks by periodically checking for their
occurrence?

a) Deadlock avoidance

b) Deadlock detection

c) Deadlock prevention

d) Mutual exclusion

Answer: b

21. What is the main idea behind deadlock prevention?

a) To allow deadlocks but recover from them later

b) To restrict the ways processes can request resources


c) To ignore deadlocks and hope they don’t occur

d) To preempt processes to avoid deadlocks

Answer: b

22. In the context of paging, what does a page frame refer to?

a) A fixed-size block of memory allocated to processes

b) A variable-size segment of memory

c) A hardware-based solution to process synchronization

d) A section of code that accesses shared resources

Answer: a

23. Which of the following is an advantage of paging in memory management?

a) It increases internal fragmentation

b) It allows dynamic memory allocation

c) It reduces the complexity of process synchronization

d) It ensures processes run faster

Answer: b

24. In deadlock detection, what is the resource allocation graph used for?

a) To track process execution times

b) To determine if a deadlock has occurred

c) To allocate memory dynamically

d) To swap processes between memory and disk

Answer: b
25. What is the purpose of the "turn" variable in Peterson's solution?

a) It indicates which process should enter the critical section

b) It tracks the number of processes in the system

c) It manages memory allocation for processes

d) It handles the swapping of pages

Answer: a

26. Which of the following is an essential condition for deadlock to occur?

a) No process can be preempted

b) Resources are allocated dynamically

c) Processes can freely communicate

d) Processes share memory segments

Answer: a

27. What is a deadlock?

a) A situation where two processes exchange data

b) A condition where a set of processes cannot proceed because they are waiting on each other

c) A method to improve memory allocation

d) A strategy to manage process communication

Answer: b

28. What is mutual exclusion in the context of synchronization?

a) A condition where only one process can access a shared resource at a time
b) A strategy to prevent deadlock

c) A technique for memory management

d) A method to synchronize I/O devices

Answer: a

29. Which of the following prevents the circular wait condition in deadlock?

a) Allowing processes to request all resources at once

b) Using preemption to allocate resources

c) Allocating resources in a circular manner

d) Allowing processes to communicate directly

Answer: a

30. What is swapping in memory management?

a) Swapping processes between CPU and I/O

b) Moving pages between main memory and disk

c) Allocating all resources to one process

d) Allocating resources dynamically based on demand

Answer: b

31. What role does the "flag" variable play in Peterson's solution?

a) It tracks the number of processes

b) It determines which process wants to enter the critical section

c) It is used for memory allocation

d) It swaps pages between memory and disk


Answer: b

32. In deadlock avoidance, what is a "safe sequence"?

a) A sequence where no process can be preempted

b) A sequence of resource allocation that guarantees deadlock avoidance

c) A scheduling order where all processes run without I/O

d) A condition where processes access shared resources sequentially

Answer: b

33. What is the role of the operating system in handling deadlocks?

a) It prevents deadlocks by blocking resource allocation

b) It detects, prevents, or recovers from deadlocks

c) It allows processes to access resources freely

d) It terminates processes that are running too long

Answer: b

34. Which of the following synchronization tools can be used to avoid the critical section problem?

a) Virtual memory

b) Paging

c) Semaphores

d) Swapping

Answer: c

35. Which of the following is a disadvantage of deadlock detection and recovery?


a) It requires that processes be terminated

b) It increases system performance

c) It ensures no deadlocks occur

d) It allows resources to be allocated indefinitely

Answer: a

36. In memory management, what is the purpose of the "frame table"?

a) To track allocated pages

b) To manage the size of page files

c) To allocate resources in a safe sequence

d) To handle process synchronization

Answer: a

37. What is preemption in deadlock prevention?

a) Preempting processes based on priority

b) Forcing processes to release resources

c) Swapping pages between memory and disk

d) Allowing circular wait

Answer: b

38. What is the advantage of using a monitor for synchronization?

a) It simplifies process communication

b) It provides a high-level abstraction for mutual exclusion

c) It avoids the need for paging

d) It automatically detects deadlocks


Answer: b

39. What is the primary difference between deadlock prevention and deadlock avoidance?

a) Deadlock prevention guarantees no deadlocks, while deadlock avoidance may allow deadlocks

b) Deadlock prevention uses resource allocation graphs

c) Deadlock avoidance allows the system to enter an unsafe state

d) Deadlock prevention only works for single-threaded applications

Answer: a

40. What happens when a system is in an unsafe state?

a) Deadlock is guaranteed to occur

b) The system will allocate resources indefinitely

c) The system may enter deadlock but it’s not guaranteed

d) The system cannot execute any process

Answer: c

41. What is the function of the "wait" operation in semaphores?

a) It decreases the semaphore value by 1

b) It increases the semaphore value by 1

c) It swaps memory pages between disk and RAM

d) It allocates resources to processes

Answer: a

42. What is the "signal" operation in semaphores?


a) It decreases the semaphore value

b) It checks for deadlocks

c) It increases the semaphore value by 1

d) It detects memory fragmentation

Answer: c

43. In which condition can paging cause external fragmentation?

a) When pages are not of equal size

b) When the page size is too small

c) When the process size is not divisible by the page size

d) Paging does not cause external fragmentation

Answer: d

44. What is the "hold and wait" condition in deadlock characterization?

a) A process holding some resources can request additional resources

b) A process holds resources indefinitely

c) A process waits for all resources to be released

d) A process releases resources as soon as it holds them

Answer: a

45. What is the purpose of a page table in memory management?

a) To manage the number of processes in the system

b) To map virtual memory addresses to physical memory addresses

c) To detect and prevent deadlocks


d) To track the number of semaphores

Answer: b

46. How does the Banker's algorithm avoid deadlock?

a) By allocating all resources at once

b) By determining a safe sequence of resource allocation

c) By allowing circular wait

d) By preempting resources from processes

Answer: b

47. What is the role of "starvation" in deadlock management?

a) A process never gets the resources it needs

b) A process holds resources indefinitely

c) A process cannot communicate with other processes

d) A process always has access to resources

Answer: a

48. Which of the following deadlock handling methods involves killing one or more processes?

a) Deadlock prevention

b) Deadlock detection

c) Deadlock recovery

d) Deadlock avoidance

Answer: c
49. Which of the following conditions is necessary for deadlock avoidance?

a) The system must be in a safe state

b) Processes must not communicate with each other

c) Processes must hold all resources simultaneously

d) Resources must be preempted frequently

Answer: a

50. What is the main purpose of the paging mechanism?

a) To increase system speed

b) To prevent deadlocks

c) To efficiently manage memory allocation

d) To synchronize process communication

Answer: c

51. What is a semaphore?

a) A signaling mechanism to control access to shared resources

b) A memory management technique

c) A process scheduling algorithm

d) A method for handling page faults

Answer: a

52. What happens when a process performs a "wait" operation on a semaphore with a value of 0?

a) The process is terminated

b) The process waits until the semaphore becomes positive


c) The process enters the critical section

d) The semaphore value increases

Answer: b

53. How does deadlock detection work?

a) By checking resource allocation graphs for cycles

b) By preventing processes from requesting resources

c) By preempting all resources

d) By swapping pages between memory and disk

Answer: a

54. What is the effect of deadlock avoidance on system performance?

a) It increases system performance by allocating resources efficiently

b) It decreases system performance due to constant checking of safe states

c) It has no effect on system performance

d) It improves process communication

Answer: b

55. Which of the following memory management techniques can cause internal fragmentation?

a) Segmentation

b) Paging

c) Swapping

d) Virtual memory

Answer: b
56. What is the main characteristic of the "Dining Philosophers" problem?

a) It illustrates how processes can cause deadlock if they don’t communicate properly

b) It prevents memory fragmentation

c) It allows resource allocation dynamically

d) It ensures processes enter a safe state

Answer: a

57. What happens when a system enters a deadlock?

a) All processes continue running indefinitely

b) The system halts as processes wait for each other

c) Processes preempt resources from each other

d) Memory allocation is increased

Answer: b

58. What is the "No preemption" condition in deadlock characterization?

a) Processes cannot release resources

b) Resources cannot be forcibly taken from a process

c) Processes cannot request new resources

d) Processes must release resources after every operation

Answer: b

59. Which condition is necessary for a resource allocation graph to indicate a deadlock?

a) No available resources
b) A cycle in the graph

c) A deadlock detection algorithm

d) Multiple semaphores

Answer: b

60. What is the primary goal of memory swapping?

a) To improve process synchronization

b) To move processes between main memory and secondary storage

c) To prevent deadlocks

d) To handle resource allocation dynamically

Answer: b

61. What does the term "bounded buffer" refer to in process synchronization?

a) A buffer that allows unlimited storage

b) A buffer with a fixed size limit for producer-consumer processes

c) A buffer used for paging

d) A memory management technique

Answer: b

62. In which of the following situations is a monitor used?

a) To manage shared memory allocation

b) To enforce mutual exclusion in concurrent processes

c) To preempt processes during deadlock

d) To handle page faults in memory management


Answer: b

63. In the dining philosophers problem, what can cause deadlock?

a) All philosophers pick up their left forks simultaneously

b) Only one philosopher is allowed to eat at a time

c) Philosophers randomly select which fork to pick up first

d) Philosophers wait indefinitely for both forks

Answer: d

64. What is the role of "test and set" in synchronization hardware?

a) It swaps memory pages between main memory and disk

b) It checks and sets a lock in one atomic operation

c) It allocates resources to processes dynamically

d) It ensures deadlocks do not occur

Answer: b

65. What does the term "busy waiting" refer to?

a) A process that constantly checks a condition until it is satisfied

b) A method to prevent deadlock

c) A technique used in paging

d) A memory management strategy

Answer: a

66. Which of the following is a condition for mutual exclusion?


a) Processes can access shared resources simultaneously

b) Only one process can execute in the critical section at a time

c) Processes wait indefinitely for resources

d) Multiple processes are preempted to access shared resources

Answer: b

67. What does the "circular wait" condition describe in deadlock?

a) Processes wait on each other in a cycle for resources

b) Processes wait indefinitely for memory allocation

c) A scheduling algorithm where processes are given circular access to resources

d) A method to handle page faults

Answer: a

68. In deadlock prevention, how can the hold and wait condition be avoided?

a) By allowing processes to hold resources indefinitely

b) By ensuring processes request all resources at once

c) By forcing processes to wait in a circular manner

d) By allowing processes to request resources one at a time

Answer: b

69. What is a "wait-for graph" used for?

a) To track memory allocation

b) To check for deadlocks by showing which processes are waiting for resources

c) To determine the order in which pages are swapped

d) To allocate resources in a safe sequence


Answer: b

70. How does deadlock recovery using process termination work?

a) Processes are allowed to run indefinitely

b) The system terminates all processes and restarts them

c) One or more processes involved in the deadlock are terminated

d) The system preempts resources from all processes

Answer: c

71. In memory management, what is a page fault?

a) When a requested page is not found in main memory

b) When a page is swapped between main memory and disk

c) When a process accesses an invalid memory address

d) When two processes access the same page simultaneously

Answer: a

72. What is the purpose of using segmentation in memory management?

a) To divide memory into equal-sized pages

b) To divide a program into logical segments based on function

c) To detect deadlocks in memory allocation

d) To allocate memory based on process priorities

Answer: b

73. How does the "Banker's algorithm" ensure deadlock avoidance?


a) By terminating all processes involved in a deadlock

b) By preempting resources from processes

c) By allocating resources only if the system remains in a safe state

d) By swapping processes between main memory and disk

Answer: c

74. Which condition is violated if a resource can be forcibly taken away from a process?

a) Mutual exclusion

b) Hold and wait

c) Circular wait

d) No preemption

Answer: d

75. What does "starvation" mean in process scheduling?

a) A process never gets scheduled for execution

b) A process releases resources too early

c) A process enters the critical section repeatedly

d) A process never enters deadlock

Answer: a

76. What is the difference between internal and external fragmentation?

a) Internal fragmentation occurs within a process; external fragmentation occurs between


processes

b) Internal fragmentation wastes space inside memory partitions; external fragmentation wastes
space outside partitions
c) Internal fragmentation occurs during deadlock; external fragmentation occurs during paging

d) Internal fragmentation happens with virtual memory; external fragmentation happens with
physical memory

Answer: b

77. What does the "turn" variable control in Peterson’s solution?

a) It controls which process can enter the critical section

b) It manages the memory allocation for processes

c) It tracks the number of pages in a page table

d) It signals deadlock occurrence

Answer: a

78. In process synchronization, what is the "Readers-Writers" problem?

a) A problem where processes must alternate between reading and writing shared data

b) A memory management technique

c) A synchronization issue where multiple readers or writers want to access shared data

d) A deadlock prevention algorithm

Answer: c

79. What is the main purpose of swapping in operating systems?

a) To allocate memory in fixed-size pages

b) To move processes between main memory and disk when memory is full

c) To detect deadlock conditions

d) To synchronize processes in the critical section


Answer: b

80. What is the primary challenge in the "Dining Philosophers" problem?

a) Avoiding memory fragmentation

b) Preventing deadlock by managing resource sharing

c) Ensuring mutual exclusion in the critical section

d) Allocating resources dynamically

Answer: b

You might also like