Docsity

PrepIQ 17COMPA6 Software Engineering C Ultimate Exam, Exams of Technology

Toggle sidebar
bg1
PrepIQ 17COMPA6 Software Engineering C Ultimate
Exam
**Question 1. Which of the following best describes the primary goal of an
operating system?**
A) To provide hardware abstraction only
B) To maximize CPU utilization at the expense of user convenience
C) To manage resources efficiently while providing a convenient interface for users
D) To eliminate the need for application programs
Answer: C
Explanation: An OS must balance efficient resource management with user-friendly
services, not just focus on one aspect.
**Question 2. In the evolution of operating systems, which model introduced the
concept of time-sharing?**
A) Batch processing
B) Multiprogramming
C) Real-time systems
D) Distributed systems
Answer: B
Explanation: Multiprogramming evolved into time-sharing, allowing multiple users to
interact with the CPU concurrently.
**Question 3. Which component of an OS is responsible for providing the basic
services to user programs via system calls?**
A) Shell
B) Kernel
C) Device driver
D) Library
Answer: B
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37

Partial preview of the text

Download PrepIQ 17COMPA6 Software Engineering C Ultimate Exam and more Exams Technology in PDF only on Docsity!

Exam

Question 1. Which of the following best describes the primary goal of an operating system? A) To provide hardware abstraction only B) To maximize CPU utilization at the expense of user convenience C) To manage resources efficiently while providing a convenient interface for users D) To eliminate the need for application programs Answer: C Explanation: An OS must balance efficient resource management with user-friendly services, not just focus on one aspect. Question 2. In the evolution of operating systems, which model introduced the concept of time-sharing? A) Batch processing B) Multiprogramming C) Real-time systems D) Distributed systems Answer: B Explanation: Multiprogramming evolved into time-sharing, allowing multiple users to interact with the CPU concurrently. Question 3. Which component of an OS is responsible for providing the basic services to user programs via system calls? A) Shell B) Kernel C) Device driver D) Library Answer: B

Exam

Explanation: The kernel implements system calls and mediates access to hardware resources. Question 4. Dual-mode operation in an OS refers to: A) User mode and supervisor mode B) Kernel mode and hypervisor mode C) User mode and kernel mode D) Real-time mode and batch mode Answer: C Explanation: Dual-mode separates privileged kernel operations from unprivileged user operations. Question 5. Which of the following is NOT a typical service provided directly by the OS to user programs? A) File management B) Process scheduling C) Network packet routing D) Memory allocation Answer: C Explanation: Network routing is usually handled by network protocols and devices, not directly by the OS core services. Question 6. In a monolithic kernel architecture, which statement is true? A) All services run in user space. B) The kernel is divided into isolated micro-services. C) All OS services execute in kernel space. D) The kernel only provides minimal functionality.

Exam

B) fork() C) spawn() D) clone() Answer: B Explanation: fork() duplicates the calling process, creating a child with its own PCB. Question 10. In the context of process states, which transition occurs when a process finishes its CPU burst and moves to the ready queue? A) Running → Waiting B) Ready → Running C) Running → Ready D) Waiting → Ready Answer: C Explanation: After using its time slice, a running process returns to the ready queue for future scheduling. Question 11. The primary advantage of kernel-level threads over user-level threads is: A) Faster context switches B) Ability to exploit multiple CPUs C) Simpler implementation D) No need for kernel involvement Answer: B Explanation: Kernel threads can be scheduled on separate CPUs, enabling true parallelism.

Exam

Question 12. Which scheduling criterion measures the average time taken from process submission to its completion? A) CPU utilization B) Throughput C) Turnaround time D) Response time Answer: C Explanation: Turnaround time = completion time – arrival time, reflecting total elapsed time. Question 13. In First-Come, First-Served (FCFS) scheduling, the average waiting time can be minimized by: A) Sorting processes by arrival time B) Sorting processes by burst time C) Using a larger time quantum D) Prioritizing I/O-bound processes Answer: B Explanation: FCFS does not reorder jobs, but sorting by burst time (i.e., using SJF) reduces waiting time; however, within FCFS the order is fixed, so the only way to improve waiting time is to have shorter jobs arrive earlier. Question 14. Which algorithm can suffer from starvation without additional mechanisms? A) Round Robin B) Shortest Job First C) Priority scheduling D) FCFS

Exam

D) Page replacement Answer: B Explanation: The critical section must be accessed by only one process at a time to avoid race conditions. Question 18. Which hardware instruction can be used to implement a simple spin lock? A) Test-and-Set B) Compare-and-Swap C) Load-Link/Store-Conditional D) All of the above Answer: D Explanation: All listed atomic instructions provide the basis for spin-lock implementations. Question 19. A binary semaphore can have which of the following values? A) Any integer ≥ 0 B) 0 or 1 only C) Negative numbers allowed D) Unlimited range Answer: B Explanation: Binary semaphores are restricted to 0 (locked) and 1 (unlocked). Question 20. In the Producer-Consumer problem with a bounded buffer, which synchronization primitive can prevent both overflow and underflow? A) Mutex only

Exam

B) Two counting semaphores (empty, full) plus a mutex C) A single binary semaphore D) Condition variables only Answer: B Explanation: The “empty” semaphore tracks free slots, “full” tracks filled slots, and the mutex protects buffer access. Question 21. The Readers-Writers problem with writer preference can lead to: A) Starvation of readers B) Starvation of writers C) No starvation for either class D) Deadlock Answer: A Explanation: Giving writers priority may cause continuous writer arrivals, preventing readers from ever acquiring the lock. Question 22. Which of the following statements about monitors is true? A) Monitors are implemented only in hardware. B) Monitors combine mutual exclusion and condition variables. C) Monitors cannot be used for producer-consumer synchronization. D) Monitors are the same as semaphores. Answer: B Explanation: Monitors encapsulate shared data, provide mutual exclusion, and support condition variables for waiting.

Exam

Explanation: A cycle with single-instance resources guarantees deadlock; with multiple instances, it may be only a possibility. Question 26. Logical address space is defined by: A) The hardware’s physical memory size B) The CPU’s address bus width and program’s view C) The operating system’s kernel memory layout D) The disk’s storage capacity Answer: B Explanation: Logical addresses are generated by the CPU and are translated to physical addresses by the OS. Question 27. Which memory allocation strategy suffers from external fragmentation? A) Fixed partitioning B) Paging C) Variable partitioning (contiguous) D) Segmentation with paging Answer: C Explanation: Variable-size contiguous allocation leaves gaps between allocated blocks, causing external fragmentation. Question 28. Internal fragmentation occurs when: A) A process requests more memory than available B) Allocated memory blocks are larger than the process’s actual need C) Pages are swapped out to disk D) The TLB miss rate is high

Exam

Answer: B Explanation: Fixed-size allocation (e.g., paging) can leave unused space within a block, leading to internal fragmentation. Question 29. The Translation Lookaside Buffer (TLB) is used to: A) Store page tables on disk B) Cache recent page-frame translations to speed up address translation C. Provide virtual memory protection D) Manage swapping of pages Answer: B Explanation: TLB is a fast associative cache that holds recent virtual-to-physical address mappings. Question 30. In a paging system with a page size of 4 KB, the offset within a page requires how many bits? A) 10 bits B) 12 bits C) 14 bits D) 16 bits Answer: B Explanation: 4 KB = 2^12 bytes, so the offset uses 12 bits. Question 31. Segmentation differs from paging primarily because: A) Segments are fixed-size while pages are variable-size B) Segments provide a logical view of memory with variable lengths C) Segments are always stored on disk

Exam

B) Implementable with hardware support C) Theoretical, requiring future knowledge of references D) Equivalent to LRU Answer: C Explanation: Optimal replaces the page that will not be used for the longest future interval; it is not implementable without clairvoyance. Question 35. Which approximation technique for LRU uses a reference bit that is periodically shifted? A) Clock (Second-chance) algorithm B) FIFO C) NRU (Not Recently Used) D) Random Answer: A Explanation: The Clock algorithm approximates LRU by giving pages a second chance based on a reference bit. Question 36. In a file system, which attribute indicates the date and time a file was last modified? A) File size B) Creation time C) Access time D) Modification time Answer: D Explanation: Modification time records when the file’s contents were last changed.

Exam

Question 37. Which file allocation method provides direct access to any block without traversing a linked list? A) Contiguous allocation B) Linked allocation C) Indexed allocation D) Multi-level indexing Answer: C Explanation: Indexed allocation stores a table of block pointers, allowing O(1) direct block access. Question 38. The main disadvantage of contiguous allocation is: A) High external fragmentation B) Inefficient sequential access C) Need for a file allocation table D) Complex free-space management Answer: A Explanation: Contiguous allocation can leave unusable gaps, causing external fragmentation. Question 39. In a directory structure that allows multiple hard links to the same file, which model is used? A) Single-level directory B) Two-level directory C) Tree-structured directory D) Acyclic-graph directory Answer: D

Exam

Answer: A Explanation: C-SCAN returns the head to the beginning without servicing requests on the return trip, providing more uniform wait times. Question 43. In an access control matrix, the entry for (subject, object) typically contains: A) The object’s size B) The subject’s priority C) The set of allowed operations (e.g., read, write) D) The memory address of the object Answer: C Explanation: The matrix cell lists the permissions that a subject has on a particular object. Question 44. Which of the following is a disadvantage of using Access Control Lists (ACLs) over capability lists? A) ACLs cannot represent read/write permissions. B) ACLs require scanning the list for each access, which can be slower. C) ACLs are not compatible with UNIX systems. D) ACLs provide no revocation mechanism. Answer: B Explanation: To verify a permission, the system may need to search the ACL, potentially incurring overhead. Question 45. In a layered OS architecture, which layer typically interacts directly with hardware? A) Application layer

Exam

B) System call interface layer C) Kernel core layer D) Device driver layer Answer: D Explanation: Device drivers abstract hardware details and sit at the lowest layer beneath the kernel core. Question 46. Which of the following system calls is used to replace the current process image with a new program? A) fork() B) execve() C) wait() D) exit() Answer: B Explanation: execve() loads a new executable into the current process, discarding the old program. Question 47. A context switch incurs overhead because: A) The CPU must be powered down temporarily. B) The operating system must save and restore register states and memory mappings. C) Disk I/O is required for each switch. D) The process must be swapped out to disk. Answer: B Explanation: Saving the PCB and loading another’s state consumes CPU cycles, causing overhead.

Exam

Explanation: Many-to-Many maps multiple user-level threads onto a pool of kernel threads, offering flexibility. Question 51. In a system that uses copy-on-write (COW) for forked processes, the pages are actually copied when: A) The child process first accesses a page. B) The parent process terminates. C) The child writes to a shared page. D) The OS performs a checkpoint. Answer: C Explanation: COW defers copying until a write occurs, at which point the page is duplicated. **Question 52. Which of the following best describes a “thundering herd” problem? ** A) Multiple processes simultaneously waking up to handle the same event, causing contention. B) A deadlock involving many processes. C) Excessive page faults due to low memory. D) A scheduling algorithm that favors I/O-bound processes. Answer: A Explanation: When many processes are blocked on the same event, they may all be awakened, leading to resource contention. Question 53. In a system that employs a “buddy allocator” for memory management, the size of each allocated block is: A) Any arbitrary size B) A power of two C) Determined by the process’s request size only

Exam

D) Fixed at 4 KB Answer: B Explanation: The buddy system splits memory into power-of-two sized blocks to simplify merging and splitting. Question 54. Which of the following is a characteristic of a “soft real-time” system? A) Missing a deadline is catastrophic. B) Deadlines are strict and must always be met. C) Occasionally missing a deadline degrades performance but is tolerable. D) No timing constraints exist. Answer: C Explanation: Soft real-time systems can tolerate occasional deadline misses with reduced quality of service. Question 55. The “working set” model in virtual memory management is used to: A) Determine which pages to swap out based on recent usage B. Compute the optimal page-replacement order C. Allocate fixed-size partitions D. Increase the size of the TLB Answer: A Explanation: The working set is the set of pages a process has referenced recently; pages outside it are candidates for replacement. Question 56. Which of the following is true about the “page fault service time” compared to a memory access?