Phase 1
Phase 1 Checkpoint: 15 questions on processes, fork, threads and IPC.
15 questions · 20 marks · 45 minutes. Negative marking on MCQ only: −1/3 mark for a wrong 1-mark MCQ, −2/3 for a wrong 2-mark MCQ. No negative marking for MSQ or NAT; MSQ has no partial credit.
Q1 · MCQ · 1 mark(s) — States
Which transition happens when a higher-priority process arrives under pre-emptive scheduling?
- (A) Ready → Terminated
- (B) Running → Ready
- (C) Running → Waiting
- (D) Waiting → Ready
Q2 · MSQ · 2 mark(s) — Transitions
Which transitions are possible in the five-state model?
- (A) Waiting → Ready
- (B) Ready → Waiting
- (C) Running → Terminated
- (D) New → Ready
Q3 · MCQ · 1 mark(s) — PCB
When a process is pre-empted, its register values are saved in:
- (A) the program's text segment
- (B) the disk's boot sector
- (C) the heap
- (D) its PCB
Q4 · NAT · 1 mark(s) — Fork
for (i = 0; i < 4; i++) fork(); Total number of processes (including the original)?
Numerical answer: ________
Q5 · NAT · 2 mark(s) — Fork
printf("start"); fork(); printf("A"); fork(); printf("B"); Total number of prints?
Numerical answer: ________
Q6 · NAT · 2 mark(s) — Fork
if (fork() == 0) { fork(); printf("1"); } else printf("2"); How many times is 1 printed?
Numerical answer: ________
Q7 · MCQ · 2 mark(s) — Fork values
int x = 5; if (fork() == 0) x = x + 5; else x = x − 5; printf("%d", x); What is printed?
- (A) 10 only
- (B) 10 and 0, in some order
- (C) 5 only
- (D) 5 and 5
Q8 · MCQ · 1 mark(s) — Schedulers
Which scheduler runs most often?
- (A) Long-term
- (B) Medium-term
- (C) Short-term
- (D) All equally
Q9 · MCQ · 1 mark(s) — Orphan
A parent exits while its child is still running. The child becomes:
- (A) an orphan, adopted by init
- (B) terminated automatically
- (C) a zombie
- (D) a thread
Q10 · MSQ · 2 mark(s) — Threads
Which are private to each thread?
- (A) Heap
- (B) Stack
- (C) Program counter
- (D) Registers
Q11 · MCQ · 1 mark(s) — User threads
Switching between user-level threads of the same process is fast because:
- (A) it switches the CPU to kernel mode
- (B) it reloads the whole process's memory
- (C) it does not require a system call
- (D) it is done by the disk
Q12 · MCQ · 1 mark(s) — Threads vs processes
Compared with processes, threads of one process:
- (A) share an address space
- (B) cannot run concurrently
- (C) have separate address spaces
- (D) need pipes to share data
Q13 · MCQ · 1 mark(s) — IPC
Which IPC method works between processes on different computers?
- (A) Shared memory
- (B) Shared heap
- (C) Ordinary pipes
- (D) Message passing (sockets)
Q14 · NAT · 1 mark(s) — Pipes
A parent communicates two-way with each of its 4 children using ordinary pipes. Minimum number of pipes?
Numerical answer: ________
Q15 · MCQ · 1 mark(s) — Producer–consumer
The consumer must wait when the shared buffer is:
- (A) never
- (B) empty
- (C) full
- (D) half full
✓Answer Vault
Try the questions first. Open when you are ready to check.
🔐 Open the Answer Vault
Q1 Answer: (B) · 1 mark(s)
The running process is pre-empted.
- (A) is wrong: Impossible.
- (C) is wrong: Waiting is for events.
- (D) is wrong: Unrelated.
Re-read: Lesson 1.1.1 — Processes: memory layout, process control block and process states
Q2 Answer: (A) (C) (D) · 2 mark(s)
A ready process cannot request I/O.
- (B) is wrong: Impossible.
Re-read: Lesson 1.1.1 — Processes: memory layout, process control block and process states
Q3 Answer: (D) · 1 mark(s)
To be restored later.
- (A) is wrong: Code is read-only.
- (B) is wrong: Unrelated.
- (C) is wrong: Not the heap.
Re-read: Lesson 1.1.1 — Processes: memory layout, process control block and process states
Q4 Answer: 16 · 1 mark(s)
2⁴.
Re-read: Lesson 1.1.2 — Creating processes with fork(), exec() and wait(); context switches and schedulers
Q5 Answer: 7 · 2 mark(s)
1 + 2 + 4.
Re-read: Lesson 1.1.2 — Creating processes with fork(), exec() and wait(); context switches and schedulers
Q6 Answer: 2 · 2 mark(s)
The child and the child's child print 1.
Re-read: Lesson 1.1.2 — Creating processes with fork(), exec() and wait(); context switches and schedulers
Q7 Answer: (B) · 2 mark(s)
Separate copies of x.
- (A) is wrong: The parent prints too.
- (C) is wrong: Both change x.
- (D) is wrong: Both change their copy.
Re-read: Lesson 1.1.2 — Creating processes with fork(), exec() and wait(); context switches and schedulers
Q8 Answer: (C) · 1 mark(s)
It picks the next process every few milliseconds.
- (A) is wrong: Rare.
- (B) is wrong: Occasional.
- (D) is wrong: No.
Re-read: Lesson 1.1.2 — Creating processes with fork(), exec() and wait(); context switches and schedulers
Q9 Answer: (A) · 1 mark(s)
It has lost its parent.
- (B) is wrong: It continues.
- (C) is wrong: Zombie = exited child not reaped.
- (D) is wrong: Unrelated.
Re-read: Lesson 1.1.2 — Creating processes with fork(), exec() and wait(); context switches and schedulers
Q10 Answer: (B) (C) (D) · 2 mark(s)
The heap is shared.
- (A) is wrong: Shared.
Re-read: Lesson 1.2.1 — Threads: what they share, user-level vs kernel-level threads
Q11 Answer: (C) · 1 mark(s)
The library switches in user mode.
- (A) is wrong: No mode switch happens.
- (B) is wrong: Threads share the same memory; nothing is reloaded.
- (D) is wrong: Unrelated.
Re-read: Lesson 1.2.1 — Threads: what they share, user-level vs kernel-level threads
Q12 Answer: (A) · 1 mark(s)
Same memory.
- (B) is wrong: They can.
- (C) is wrong: That is processes.
- (D) is wrong: They share memory directly.
Re-read: Lesson 1.2.1 — Threads: what they share, user-level vs kernel-level threads
Q13 Answer: (D) · 1 mark(s)
Messages travel over the network.
- (A) is wrong: Same machine only.
- (B) is wrong: Not a mechanism.
- (C) is wrong: Same machine only.
Re-read: Lesson 1.2.2 — Inter-process communication: shared memory, message passing and pipes
Q14 Answer: 8 · 1 mark(s)
Two per child.
Re-read: Lesson 1.2.2 — Inter-process communication: shared memory, message passing and pipes
Q15 Answer: (B) · 1 mark(s)
Nothing to consume.
- (A) is wrong: It must wait when empty.
- (C) is wrong: The producer waits then.
- (D) is wrong: Fine to consume.
Re-read: Lesson 1.2.2 — Inter-process communication: shared memory, message passing and pipes