0% found this document useful (0 votes)
272 views8 pages

Operating System Midterm Exam 2025

The document is a mid-term examination paper for a Bachelor of Computer Science course, specifically focusing on the Operating System module. It includes instructions for candidates, three sections of questions (Multiple Choice, Short Answer, and Long Answer), and covers various topics related to operating systems, processes, and memory management. The exam is scheduled for 3 hours, starting at 7:00 A.M. and ending at 10:00 A.M.

Uploaded by

Prashant Sapkota
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
272 views8 pages

Operating System Midterm Exam 2025

The document is a mid-term examination paper for a Bachelor of Computer Science course, specifically focusing on the Operating System module. It includes instructions for candidates, three sections of questions (Multiple Choice, Short Answer, and Long Answer), and covers various topics related to operating systems, processes, and memory management. The exam is scheduled for 3 hours, starting at 7:00 A.M. and ending at 10:00 A.M.

Uploaded by

Prashant Sapkota
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MID TERM EXAMINATION PAPER

2025

FACULTY : COMPUTER SCIENCE AND MULTIMEDIA

COURSE : BACHELOR OF COMPUTER SCIENCE (HONS)

YEAR/ SEMESTER : FIRST YEAR / SECOND SEMESTER

MODULE TITLE : OPERATING SYSTEM

CODE : ECM -123

TIME ALLOWED : 3 HOURS

START : 7:00 A.M. FINISH: 10:00 A.M.

Instruction to Candidates

1. This question paper has THREE (3) Sections


2. Answer ALL questions in Section A, MCQ
3. Answer 5 questions in Section B, MSAQ
4. Answer 2 questions in Section C, MEQ
5. No scripts or answer sheets are to be taken out of the Examination Hall.
6. For Section A, answer in the OMR form provided.

Do not open this question paper until instructed.

(Candidates are required to give their answers in their own words as far as practicable.)

1
SECTION A

Multiple Choice Question

Attempt all questions (1 × 30 = 30)

1. What is an operating system?


a) Hardware management tool
b) System that manages software and hardware
c) Language translation program
d) File management utility

2. Which of the following is NOT a function of an operating system?


a) Process Management
b) Memory Management
c) File Management
d) Hardware Maintenance

3. What is a monolithic operating system structure?


a) All functions in a single, large module
b) Functions separated into layers
c) Uses microkernel architecture
d) Uses a virtual machine approach

4. What is the role of system calls in an operating system?


a) To schedule processes
b) To allow user applications to interact with the OS
c) To translate programming languages
d) To manage memory allocation

5. Which system call is used to terminate a process?


a) exit()
b) fork()
c) wait()
d) exec()

6. Which type of system call is used for directory management?


a) open()
b) mkdir()

2
c) exec()
d) close()

7. Which operating system type allows multiple users to work simultaneously?


a) Batch Operating System
b) Multiuser Operating System
c) Real-Time Operating System
d) Single-User Operating System

8. What is the primary goal of an operating system?


a) To manage hardware and software resources efficiently
b) To compile source code
c) To protect the user from viruses
d) To enable direct hardware communication

9. What is a process?
a) A program in execution
b) A passive entity
c) A collection of threads
d) A compiler routine

10. What does the Process Control Block (PCB) contain?


a) The program code
b) Information about a process
c) The physical memory address
d) The system call table

11. Which of the following best differentiates a thread from a process?


a) Threads have independent memory; processes share memory.
b) Processes have independent memory; threads share memory.
c) Both share memory.
d) Both have independent memory.

12. What is the main issue addressed by mutual exclusion?


a) Deadlock prevention
b) Process synchronization in critical sections
c) Scheduling processes in order
d) Memory allocation

3
13. Which of the following is an example of busy-waiting for mutual exclusion?
a) Semaphores
b) Lock Variables
c) Monitors
d) Message Passing

14. What is the key idea behind Peterson’s solution?


a) It is a hardware-based solution for mutual exclusion.
b) It uses software to ensure mutual exclusion for two processes.
c) It uses semaphores for process synchronization.
d) It avoids deadlock by preempting resources.

15. What does a semaphore value represent?


a) Number of processes waiting for a resource
b) Number of available resources
c) Process priority
d) CPU scheduling time

16. Which scheduling algorithm gives the CPU to the process with the smallest execution
time?
a) Round-Robin Scheduling
b) Shortest Job First
c) Priority Scheduling
d) First-Come First-Served

17. What is a critical section?


a) A section of code where processes compete for resources
b) A memory block allocated to processes
c) A page in virtual memory
d) A file directory shared among users

18. Which IPC problem involves multiple consumers and producers accessing a shared
buffer?
a) Sleeping Barber Problem
b) Dining Philosopher Problem
c) Producer-Consumer Problem
d) Critical Section Problem

4
19. What is deadlock?
a) A system slowdown due to high CPU usage
b) A situation where processes are blocked, waiting for resources
c) An error in process scheduling
d) A type of memory fragmentation

20. Which of the following is NOT a condition for deadlock?


a) Circular Wait
b) Hold and Wait
c) Mutual Exclusion
d) Process Synchronization

21. What is the Ostrich Algorithm?


a) A strategy to ignore deadlocks
b) A scheduling algorithm
c) A deadlock recovery method
d) A method to prevent deadlocks

22. Which deadlock handling method prevents circular wait?


a) Using preemption
b) Banker’s Algorithm
c) Preventing Hold and Wait
d) Resource Allocation Graph

23. Which strategy does the Banker’s Algorithm use?


a) Deadlock Prevention
b) Deadlock Detection
c) Deadlock Avoidance
d) Deadlock Recovery

24. What is resource preemption?


a) A method of scheduling processes
b) Forcibly taking resources from a process to resolve deadlock
c) Allocating resources in advance
d) Detecting resource usage conflicts

25. What does logical address space refer to?


a) Memory address seen by the process
b) Memory address used by hardware

5
c) Physical address in memory
d) Address used for file storage

26. What is swapping?


a) Allocating memory in contiguous blocks
b) Moving processes in and out of memory
c) Creating logical memory segments
d) Managing virtual memory

27. What causes external fragmentation?


a) Processes not utilizing full pages
b) Free memory scattered in non-contiguous blocks
c) Incorrect paging algorithms
d) Poor virtual memory allocation

28. What is a page fault?


a) A process accesses memory outside its allocated segment.
b) The required page is not in memory.
c) A deadlock occurs in memory management.
d) The page table fails to load.

29. Which memory management technique eliminates external fragmentation?


a) Contiguous Allocation
b) Paging
c) Swapping
d) Segmentation

30. What is the primary disadvantage of paging?


a) External fragmentation
b) Internal fragmentation
c) Complex address translation
d) Inefficient CPU usage

6
SECTION B

Short Answer Question

Attempt any five (5) questions (6 × 5 = 30)

1. Name the main components of an operating system.


2. Define a system call and explain its purpose.
3. Differentiate between a process and a program.
4. What is a Process Control Block (PCB), and why is it important?
5. Explain the concept of a critical section in Inter-Process Communication (IPC).
6. List and explain the four conditions necessary for a deadlock to occur.
7. What is the difference between paging and segmentation in memory management?
8. Write a short note (any two)
a. primary functions of an operating system
b. Round Robin Scheduling Algorithm
c. Ostrich Algorithm

7
SECTION C

Long Answer Question

Attempt any two (2) questions (20 × 2 = 40)

Question 1

Explain the key functions and components of an operating system. How do processes differ from
programs, and what role does multiprogramming play in improving system efficiency? Discuss two
process scheduling algorithms (e.g., Round-Robin and Shortest Job First) and their advantages in
managing CPU resources.

Question 2

Define mutual exclusion and its importance in process synchronization. Explain two solutions for
achieving mutual exclusion (e.g., Peterson’s Solution, Semaphores). Additionally, describe the
conditions required for deadlock to occur and briefly discuss deadlock prevention techniques.

Question 3

Discuss the four necessary conditions for deadlock in an operating system. Explain the methods used
to handle deadlocks, such as deadlock prevention and detection. In addition, describe the difference
between contiguous memory allocation and paging in memory management.

***Best of Luck***

Common questions

Powered by AI

A process is a program in execution, which includes the program code, current activity represented by the program counter, and the contents of the processor's registers. It is an active entity, with a lifecycle managed by the operating system, and can be in states such as running, waiting, or terminated. A program, on the other hand, is a passive entity that consists of executable instructions stored on a disk. It does not have a state and cannot change on its own. The relationship is such that a single program can be the source of multiple processes in a multitasking environment.

System calls provide an interface between the operating system and user applications, allowing programs to request services from the operating system such as file operations, process control, and communication. They act as a way for programs to interact directly with the hardware for functionalities that are abstracted by the operating system. Examples include the 'open()', 'read()', 'write()', 'close()', which manage file operations, and 'fork()', 'exec()', 'exit()', which handle process creation, execution, and termination.

The main components of an operating system include the kernel, process management, memory management, file system, and device management. The kernel acts as the core interface between the hardware and processes. Process management handles the execution, scheduling, and termination of processes, ensuring efficient usage of CPU. Memory management keeps track of each byte in a computer's memory and allocates/deallocates memory spaces as needed. The file system organizes and stores information on storage devices. Device management provides I/O operations by interacting with hardware devices. These components interact to provide a stable and efficient operating environment by coordinating hardware resource access, managing running applications, and maintaining system integrity.

Multiprogramming improves system efficiency by allowing multiple processes to reside in memory at the same time, enabling the CPU to switch between tasks without waiting for I/O operations to complete. This leads to better CPU utilization as it always has a process to execute, thereby reducing idle time. It organizes jobs so that the CPU remains busy executing one program while others are waiting for I/O operations to complete, maximizing throughput and system performance.

The Round-Robin scheduling algorithm gives each process an equal time slot in a cyclic order, which prevents any process from monopolizing the CPU. Its advantages include simplicity and fairness, as every process gets a chance to execute. It is particularly effective in time-sharing systems where the goal is to ensure a responsive system for all users. However, the disadvantages include higher context-switching overhead, which can degrade performance if the time quantum is too small. Conversely, if the time quantum is too large, it can lead to poor response times for short processes. Round-Robin needs careful tuning of the time quantum to balance performance and responsiveness.

Paging divides memory into fixed-size units called pages, solving external fragmentation by allowing programs to be non-contiguous in memory. This enhances memory utilization and simplifies allocation but can lead to internal fragmentation if the last page is partially filled. Address translation involves page tables, making it complex and can introduce overhead. Segmentation, on the other hand, divides programs into logical units or segments. It reflects the logical structure of programs, such as functions or arrays, aiding programmer understanding. It can, however, suffer from external fragmentation, as segments are of varying sizes and need contiguous space in memory. Each method's pros and cons depend on the type of applications and the system's memory management needs.

The four necessary conditions for deadlock to occur are mutual exclusion (resources cannot be shared), hold and wait (processes holding resources can request additional resources), no preemption (resources cannot be forcibly taken from a process), and circular wait (a closed loop of processes exist, each holding resources the next process needs). To prevent or manage deadlocks, we can apply techniques such as eliminating one or more of these conditions. For instance, deadlock prevention involves negating one of the conditions, whereas deadlock avoidance uses algorithms like Banker’s algorithm to ensure safe resource allocation sequences. Deadlock detection and recovery involves allowing deadlocks to occur, detecting them, and corrective actions.

A Process Control Block (PCB) is a data structure in the operating system kernel, containing the necessary information about a process. It includes process identification numbers, process state (e.g., running, waiting), CPU registers, memory management info, accounting information, and I/O status. The PCB acts as the repository of all data required by the OS to manage processes, facilitating context switching, scheduling, and basic process management functions by maintaining the state and context for each process in the system.

The Banker's Algorithm operates on the principle of resource allocation based on a particular sequence, ensuring that even in maximum demand scenarios, system resources remain allocated in a safe sequence without causing deadlocks. Each process declares maximum resources it may need. When a process requests resources, the system temporarily grants the resources and tests if the system stays in a safe state by simulating this allocation. If it does, the allocation is confirmed; otherwise, the process must wait. This method allows the system to adapt dynamically to varying resource demands while maintaining overall system stability and preventing deadlocks.

Mutual exclusion ensures that no two processes access critical sections of code simultaneously, preventing conflicts from occurring when shared resources are accessed concurrently. It is crucial to maintain data integrity and prevent inconsistent data states. Two methods to achieve mutual exclusion include: 1) Peterson’s solution, a software-based protocol that ensures mutual exclusion for two processes using a lock variable and two additional flags; 2) Semaphores, which involve special variables that are manipulated atomically with operations like wait() and signal() to synchronize process execution and access to critical sections, preventing concurrent access effectively.

You might also like