Aspirant Academy

MCQ

Paper - II (x) — Operating Systems MCQ - Practice Questions with Answers

Solve 132 Paper - II (x) — Operating Systems questions for RAS/RPSC preparation.

Practice questions

Q1A file system uses a single-level indexed allocation scheme. One index block is reserved for a file and contains 256 direct data-block addresses. If each data block is 4 KB, and the index block itself is not counted as file data, what is the maximum file size addressable through that one index block?

A 16 MB
B 1 MB
C 256 KB
D 4 MB
Explanation

Indexed allocation stores block addresses in an index block; the addressed blocks hold the file data. Here the index block has 256 direct entries and each entry points to one 4 KB data block. The maximum addressable file data is therefore 256 x 4 KB = 1024 KB, which is 1 MB. The index block is metadata and is explicitly excluded from the file-size calculation.

Q2Which shell variable commonly holds the exit status of the most recently executed command in Bourne-style shell scripting?

A $0
B $?
C $#
D $*
Explanation

Bourne-style shell scripts commonly test $? after a command to check whether it succeeded. By convention, zero indicates success and a non-zero value indicates some kind of failure or exceptional condition.

Q3Which Linux file traditionally stores user account entries such as login name, UID, GID, home directory and login shell?

A /etc/hosts
B /etc/fstab
C /etc/passwd
D /etc/shadow
Explanation

The passwd database is the standard account listing on Linux systems. With shadow passwords, the encrypted password data is kept separately in /etc/shadow, while /etc/passwd still records account identity and login environment fields.

Q4A system has one resource type with 12 instances. The allocation vector is (2, 4, 1, 3), the maximum-demand vector is (4, 6, 5, 5), and the currently available count is 2. Which statement is correct about the state under the banker's safety test?

A It is safe; one safe sequence is P1, P2, P4, P3.
B It is unsafe because P3 has need 4, which is greater than the initial available count.
C It is deadlocked because total allocated resources equal 10.
D It is safe only if P3 runs before P4.
Explanation

For a single resource type, Need = Max - Allocation = (2, 2, 4, 2). Starting with Available=2, P1 can complete and release 2, making 4 available; P2 can then complete and release 4, making 8 available; P4 and P3 can then complete. Since at least one such sequence exists, the state is safe, not deadlocked.

Q5Which rsync option is archive mode, commonly used for backups because it preserves directories and important file attributes?

A -c
B -a
C -n
D -z
Explanation

rsync -a selects archive mode, a common backup choice because it recurses through directories and preserves items such as links, permissions, owners, groups, and times. Dry-run, compression, and checksum modes address different needs.

You've seen 5 of 132 sample questions

Unlimited practice on Paper - II (x) — Operating Systems comes with the RAS Test Series + Practice pack or Gate Pass.

More questions

6In clock synchronization for distributed real-time systems, what is the main difference between internal synchronization and external synchronization?

AInternal synchronization removes all clock drift permanently, while external synchronization cannot correct drift.
BInternal synchronization applies only to hard real-time systems, while external synchronization applies only to soft real-time systems.
CInternal synchronization keeps clocks close to one another, while external synchronization keeps them close to an outside time reference.
DInternal synchronization is done by the CPU scheduler, while external synchronization is done by the memory manager.

7A system administrator wants to change the password of an existing Linux user from the command line. Which command is intended for this task?

Apasswd username
Bmount username
Cchmod username
Dps username

8A distributed RTOS has several nodes but no external UTC receiver. The master periodically polls the nodes, estimates their offsets, and asks them to adjust toward an average time. Which synchronization approach does this describe?

ALamport logical clock ordering
BPriority inheritance protocol
CNetwork Time Protocol with stratum-1 reference only
DBerkeley clock synchronization algorithm

9A 32-bit virtual address is split into a 20-bit virtual page number and a 12-bit offset. Physical memory has 256 MiB. If the system uses a conventional single-level page table entry that stores only the physical frame number plus valid and protection bits, how many bits are needed for the physical frame number?

A18 bits
B12 bits
C20 bits
D16 bits

10In a shell script, which test expression checks whether /var/log/syslog exists and is a regular file?

A[ -z /var/log/syslog ]
B[ -d /var/log/syslog ]
C[ -x /var/log/syslog ]
D[ -f /var/log/syslog ]

11Which condition is most important when using a periodic timer tick to release real-time tasks in an RTOS?

AThe timer interrupt should be handled with unbounded work so that all application logic completes inside the interrupt.
BThe tick interval should be selected without considering task periods or deadline granularity.
CThe scheduler should use wall-clock time only for logging, never for task release decisions.
DThe tick resolution and interrupt latency should be small enough relative to the shortest deadline being enforced.

12In a system with resource types A, B, and C, the available vector is (3, 3, 2). The allocation and maximum matrices are: P0 allocation (0,1,0), maximum (7,5,3); P1 allocation (2,0,0), maximum (3,2,2); P2 allocation (3,0,2), maximum (9,0,2); P3 allocation (2,1,1), maximum (2,2,2); P4 allocation (0,0,2), maximum (4,3,3). Which safe sequence is valid under the Banker's algorithm?

AP0, P1, P3, P4, P2
BP1, P3, P4, P0, P2
CP2, P1, P3, P0, P4
DP4, P3, P1, P2, P0

13Two threads share a bounded buffer protected by a mutex and a condition variable not_empty. Which consumer-side pattern is correct for waiting until at least one item is available?

ALock the mutex; if count is 0, call wait once; consume immediately after wait returns.
BLock the mutex; while count is 0, wait on not_empty with the mutex; after the loop, consume the item and unlock.
CCall wait first, then lock the mutex and check count.
DCheck count without the mutex; if count is 0, lock the mutex and call wait.

14In a preemptive real-time operating system, a periodic task set has relative deadlines equal to periods. Which statement best describes Rate Monotonic Scheduling?

AIt gives higher priority to tasks with longer execution time.
BIt assigns higher fixed priority to the task with the shorter period.
CIt schedules tasks strictly in the order in which they are released.
DIt assigns priority dynamically to the task whose absolute deadline is earliest.

15For a large file that is mostly read sequentially but occasionally requires direct access to block number k, which allocation method gives efficient direct access without requiring the file's data blocks to be contiguous?

AIndexed allocation with an index block or inode pointers
BPure linked allocation without an index
CContiguous allocation only
DSingle global free-space bitmap as the file's block map

More topics in Computer Systems (Senior CI)

Explore other subjects