Computer Knowledge

Computer File Systems

1,516 Questions

Computer file systems dictate how data is stored, organized, and retrieved on storage devices. Important concepts include file allocation tables, access mechanisms, and various formats like sequential and video files. Candidates preparing for banking and government exams should practice these fundamentals thoroughly.

File access mechanismsVideo and password filesFile extensionsFile allocation tableSystem metadata

Computer File Systems Questions

Multiple choice technology operating systems
  1. ls -m

  2. ls -mlrt

  3. ls -mrt

  4. Both A(ls -m) and C(ls -mrt)

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

Both ls -m and ls -mrt produce comma-separated output. The -m flag specifically formats output as comma-separated with stream spacing. The -mrt combination includes -m (comma format) with -r (reverse sort) and -t (sort by time). Both produce CSV format, just with different sorting options. Option B's -mlrt combines -m with -l (long format), -r, -t which doesn't make sense as -l and -m are mutually exclusive.

Multiple choice technology operating systems
  1. The entry is a local socket

  2. The entry is a first-in,first-out (FIFO) special file

  3. The entry is an ordinary file

  4. Purged Permissions

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The permission string 'prwxrwxrwx' indicates a FIFO (first-in, first-out) special file, also known as a named pipe. The first character 'p' identifies the file type as a pipe. FIFOs are used for inter-process communication, where data written to the pipe is read in the same order. This is distinct from regular files (-), directories (d), or sockets (s).

Multiple choice technology operating systems
  1. 1 A device file to represent that the current file system is full

  2. 2 A device file to test scenarios of testing a /dev/full

  3. 3 Invalid device

  4. 4 None

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

/dev/full is a special device file that always returns ENOSPC (no space left on device) error when written to, simulating a full disk. It is used for testing how programs handle disk-full scenarios. While option B is circular in wording, it correctly identifies this as a testing device.

Multiple choice technology operating systems
  1. 1 lseek(), open(), write(), close()

  2. 2 open(), write(), lseek(), close()

  3. 3 open(), lseek(), open(), , write() close()

  4. 4 None

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The correct sequence for file operations is open() to get a file descriptor, write() to write data (optionally using lseek() to position before writing), and close() to release resources. Option A incorrectly tries to lseek before opening, and option C has syntax errors and calls open() twice.

Multiple choice technology operating systems
  1. 1 Its not possible

  2. 2 use isused() function

  3. 3 Try to open file with locking enabled

  4. 4 Try to write the file after opening

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

There is no direct function like isused() to check if another process has a file open. The standard approach is to use file locking (flock, fcntl) - if you can acquire an exclusive lock, no one else has it open. Option C suggests trying to open with locking enabled, which is the closest practical method.

Multiple choice technology operating systems
  1. 1 Use filelock()

  2. 2 use lockfile()

  3. 3 Use lockfd()

  4. 4 use fcntl()

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

fcntl() is the Unix system call used for file locking operations. It provides both advisory and mandatory locking mechanisms through the F_SETLK and F_SETLKW commands. filelock(), lockfile(), and lockfd() are not standard POSIX or Unix functions.

Multiple choice technology operating systems
  1. 1 Use ls -l

  2. 2 Use sizeof()

  3. 3 Use filesize()

  4. 4 Use fstat()

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

fstat() is the system call used to get file status information, including file size. It operates on file descriptors and populates a struct stat with size, permissions, and timestamps. ls -l is a shell command, sizeof() is a compile-time operator, and filesize() is not a standard function.

Multiple choice technology databases
  1. you save and close the file

  2. you save excel in XML format

  3. you create an excel template

  4. you save it in Excel 2007 version

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The .xlt extension is created when you save an Excel file as a template. Templates preserve formatting and structure for reuse. Saving in XML format uses different extensions. Excel 2007 uses .xlsx for regular files. Regular save/close uses .xls or .xlsx.

Multiple choice technology security
  1. Since the file name is hard coded, fopen() will fail if the file already exists

  2. 0600 is not a secure option. The parameter 0600 should be changed to 0666

  3. Attackers can exploit by creating a symboling link /tmp/cache_data that points to a system file

  4. Attackers can exploit the application's cache by writing directly to /tmp/cache_data

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The code has a TOCTOU (Time-of-Check-Time-of-Use) vulnerability specifically a symlink race condition. Attackers can create a symbolic link at /tmp/cache_data that points to sensitive system files (like /etc/passwd). When the daemon opens /tmp/cache_data with O_CREAT, it will follow the symlink and overwrite the target file with daemon privileges. Option C is correct. Option A is wrong because fopen with O_CREAT doesn't fail if file exists. Option B is wrong - 0600 (owner read/write only) is secure, 0666 would be world-readable which is LESS secure.

Multiple choice technology operating systems
  1. Boot | Super | Data| Inode

  2. Super | Boot | Data | Inode

  3. Boot | Super | Inode | Data

  4. Inode | Boot | Super | Data

  5. Non of the above

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Unix file systems begin with boot blocks containing bootstrap code, followed by the superblock with filesystem metadata, then inode blocks storing file inodes, and finally data blocks containing actual file contents.

Multiple choice technology operating systems
  1. True

  2. False

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

PINE (Pine Is Not Elm) is an email client program for Unix systems, originally developed at the University of Washington. It is used for reading and sending email, not for file transfers. FTP file transfers use the ftp command or tools like wget/curl.

Multiple choice technology security
  1. Security is handled at OS level by giving only read level privilege so no need to put an extra check here

  2. Only problem here is that fileName may not be syntactically incorrect so it should be validated before using it in the function

  3. This code can lead to information disclosure attack

  4. Java provides enough security by default for IO operations so this code is not vulnerable.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Passing an unvalidated user-controlled parameter directly to a FileInputStream allows directory traversal attacks (e.g., passing '../../etc/passwd'), leading to unauthorized information disclosure despite read-only OS privileges.