Operating System MCQ and Answers – Semaphores

These Operating System MCQ and Answers – Semaphores are asked in various examinations including BCA, MCA, GATE, and other tests. The questions based on the below Operating System MCQ and Answers – Semaphores test your basic knowledge of MCQs on the topic of Operating Systems and the level of comprehension and grasp that you hold.

Operating System MCQ and Answers – Semaphores

1. What are the two atomic operations permissible on semaphores?

a) wait

b) stop

c) hold

d) none of the mentioned

Answer: a

2. What are Spinlocks?

a) CPU cycles wasting locks over critical sections of programs

b) Locks that avoid time wastage in context switches

c) Locks that work better on multiprocessor systems

d) All of the mentioned

Answer: d

3. What is the main disadvantage of spinlocks?

a) they are not sufficient for many process

b) they require busy waiting

c) they are unreliable sometimes

d) they are too complex for programmers

Answer: b

4. The wait operation of the semaphore basically works on the basic _______ system call.

a) stop()

b) block()

c) hold()

d) wait()

Answer: b

5. The signal operation of the semaphore basically works on the basic _______ system call.

a) continue()

b) wakeup()

c) getup()

d) start()

Answer: b

6. If the semaphore value is negative ____________

a) its magnitude is the number of processes waiting on that semaphore

b) it is invalid

c) no operation can be further performed on it until the signal operation is performed on it

d) none of the mentioned

Answer: a

7. The code that changes the value of the semaphore is ____________

a) remainder section code

b) non – critical section code

c) critical section code

d) none of the mentioned

Answer: c

8. An un-interruptible unit is known as ____________

a) single

b) atomic

c) static

d) none of the mentioned

Answer: b

9. TestAndSet instruction is executed ____________

a) after a particular process

b) periodically

c) atomically

d) none of the mentioned

Answer: c

10. Semaphore is a/an _______ to solve the critical section problem.

a) hardware for a system

b) special program for a system

c) integer variable

d) none of the mentioned

Answer: c

11. What will happen if a non-recursive mutex is locked more than once?

a) Starvation

b) Deadlock

c) Aging

d) Signaling

Answer: b

12. What is a semaphore?

a) is a binary mutex

b) must be accessed from only one process

c) can be accessed from multiple processes

d) none of the mentioned

Answer: c

13. What are the two kinds of semaphores?

a) mutex & counting

b) binary & counting

c) counting & decimal

d) decimal & binary

Answer: b

4. What is a mutex?

a) is a binary mutex

b) must be accessed from only one process

c) can be accessed from multiple processes

d) none of the mentioned

Answer: b

15. At a particular time of computation the value of a counting semaphore is 7.Then 20 P operations and 15 V operations were completed on this semaphore. The resulting value of the semaphore is? (GATE 1987)

a) 42

b) 2

c) 7

d) 12

Answer: b

16. A binary semaphore is a semaphore with integer values ____________

a) 1

b) -1

c) 0.8

d) 0.5

Answer: a

17. Semaphores are mostly used to implement ____________

a) System calls

b) IPC mechanisms

c) System protection

d) None of the mentioned

Answer: b

18. Spinlocks are intended to provide __________ only.

a) Mutual Exclusion

b) Bounded Waiting

c) Aging

d) Progress

Answer: b

Comments