File Systems · Operating System
12 questions · asked in 10 of 27 years (2000–2026)
MCQ 8 · NAT 41-mark 8 · 2-mark 4
2000Questions per year2026
Questions 11–12 of 12
Which of the following commands or sequences of commands will rename a file x to file y in a Unix system ?
I. mv y, x
II. mv x, y
III. cp y, x (rm x)
IV. cp x, y (rm x)
I. mv y, x
II. mv x, y
III. cp y, x (rm x)
IV. cp x, y (rm x)
Answer: (B)
The mv command moves or renames a file. mv source dest renames the file source to dest. cp copies a file. rm deletes a file. (The commas in the statements only separate the arguments.)
- I. mv y, x: renames y to x. This is the wrong direction.
- II. mv x, y: renames x to y. This is correct.
- III. cp y, x (rm x): copies y to x, and then removes x. File y is still there and x is gone. This is wrong.
- IV. cp x, y (rm x): copies x to y, and then removes x. File y now has the old contents of x and x is gone. This is a rename.
So II and IV rename x to y.
Answer: (B)
- I. mv y, x: renames y to x. This is the wrong direction.
- II. mv x, y: renames x to y. This is correct.
- III. cp y, x (rm x): copies y to x, and then removes x. File y is still there and x is gone. This is wrong.
- IV. cp x, y (rm x): copies x to y, and then removes x. File y now has the old contents of x and x is gone. This is a rename.
So II and IV rename x to y.
Answer: (B)
Which of the following requires a device driver ?
Answer: (D)
A device driver is the OS software that talks to an I/O device and its controller. It turns OS requests (read block, write block) into commands for that particular device.
- Register: inside the CPU, used directly by instructions. No driver.
- Cache: managed by hardware and invisible to software. No driver.
- Main memory: the CPU reads and writes it with ordinary load and store instructions through the memory controller. No driver.
- Disk: an I/O device with its own controller. The OS must use a disk driver to send commands and move data, and each type of disk needs its own driver.
Answer: (D)
- Register: inside the CPU, used directly by instructions. No driver.
- Cache: managed by hardware and invisible to software. No driver.
- Main memory: the CPU reads and writes it with ordinary load and store instructions through the memory controller. No driver.
- Disk: an I/O device with its own controller. The OS must use a disk driver to send commands and move data, and each type of disk needs its own driver.
Answer: (D)
Keep practising