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
-
an ASCII file that contains an entry for each user
-
File which is created and maintained by a server of activity performed by it
-
short python program that prints the list of all files inside the current directory
-
File which is created and maintained by the operating system
B
Correct answer
Explanation
A log file is a file automatically created and maintained by a server or application that records events, transactions, and activities performed by it for auditing and troubleshooting.
-
a) Use filelock()
-
b) use lockfile()
-
c) Use lockfd()
-
d) use fcntl()
D
Correct answer
Explanation
fcntl() is the POSIX system call used for advisory and mandatory file locking in Unix/Linux systems. It operates on file descriptors and provides mechanisms like shared and exclusive locks through the F_SETLK and F_SETLKW commands. The other options (filelock(), lockfile(), lockfd()) are not standard POSIX system calls.
-
a) Creates File
-
b) Does nothing
-
c) Return error
-
d) Not allowed.
C
Correct answer
Explanation
When using the open() system call in read-only mode (O_RDONLY) on a file that does not exist, the system cannot create the file and will return an error (setting errno to ENOENT).
-
a) sed 's/[ ][^ ]*$//' test2
-
b) sed 's/[ ][ ]*$//' test2
-
c) sed 's/[ ][ ]*$/' test2
-
d) sed 's/[ ][ $]*$//' test2
A
Correct answer
Explanation
The sed command sed 's/[ ][^ ]*$//' matches a space followed by any non-space characters at the end of a line and removes them, effectively stripping trailing spaces from each line of the file.
-
a) duplicate()
-
b) dup()
-
c) cp()
-
d) mknod()
B
Correct answer
Explanation
dup() is the POSIX system call used to duplicate file descriptors. It creates a new file descriptor that refers to the same open file description as the original, sharing the file offset and status flags. dup2() is a related call that allows specifying the descriptor number. cp() is for file copying, mknod() creates device nodes.
-
SUBSET FROM(IN1) TO(OUT1) INPUT REMOVE LAST = 1
-
SUBSET FROM(IN1) TO(OUT1) INPUT REMOVE LAST(1)
-
SUBSET FROM(IN1) TO(OUT1) INPUT REMOVE TRAILER
-
All of the above
B,C
Correct answer
Explanation
Both B and C are correct methods to remove the last record from an input file. Option B uses REMOVE LAST(1) which explicitly removes the last 1 record. Option C uses REMOVE TRAILER which removes trailer records - if the last record is a trailer, this achieves the same result. Both syntaxes are valid in mainframe sort utilities like Easytrieve. Option A is incorrect because REMOVE LAST = 1 has incorrect syntax (should use parentheses, not equals).
-
OUTREC
-
INREC
-
OUTFIL
-
None of the above
C
Correct answer
Explanation
OUTFIL is the JCL statement used to create multiple output files from a single input file based on different conditions. It allows you to specify different INCLUDE/OMIT criteria and formatting for each output dataset. OUTREC and INREC are used for record formatting but not for creating multiple output files. OUTFIL can split data into different files using various selection criteria.
-
list the files
-
check the process status
-
substitute one word with another
-
copy the contents of one file to another
C
Correct answer
Explanation
sed (stream editor) is primarily used for text transformation and substitution. It can search for patterns and replace them with specified text using commands like s/old/new/ to substitute one word or phrase with another.
D
Correct answer
Explanation
Both touch and vi can create files. touch creates an empty file immediately, while vi opens the text editor and creates the file when you save. Since both A and B are valid methods, D (a&b) is correct.
-
checks for the existence of a file
-
checks for existence of a directory
-
checks for read permission on a file
-
checks for write permission on a file
A
Correct answer
Explanation
The -f test operator checks whether a file exists AND is a regular file (not a directory or device). In shell scripting, [ -f filename ] returns true only if the specified path is an existing regular file.
-
*.idx and *.bat
-
*.idx and *.dat
-
*.che and *.txt
-
*.dat and *.err
B
Correct answer
Explanation
Informatica cache files consist of index files with the .idx extension and data files with the .dat extension.
-
*.idx and *.bat
-
*.idx and *.dat
-
*.che and *.txt
-
*.dat and *.err
B
Correct answer
Explanation
Informatica cache files are created in the cache directory and consist of index files with the .idx extension and data files with the .dat extension.
-
.TSR and .QRS
-
.QRS and .MTR
-
.TSR and .MTR
-
.MTR and .QFL
C
Correct answer
Explanation
To solve this question, the user needs to have knowledge about automated testing tools and file extensions used in them.
The correct option is:
C. .TSR and .MTR
Explanation:
In automated testing tools like UFT (Unified Functional Testing), shared object repository and local object repository are used to store object information.
Shared Object Repository (SOR) file stores information about the objects that are common for multiple tests. The file extension of the Shared Object Repository file is .TSR (Test Shared Repository).
Local Object Repository (LOR) file stores information about the objects that are specific to a particular test. The file extension of the Local Object Repository file is .MTR (Mercury Test Results).
Therefore, the correct answer is option C, .TSR and .MTR.
-
gunzip/expand
-
gzip
-
zip
-
winzip
A
Correct answer
Explanation
gunzip is the standard command to uncompress .gz files, and expand uncompresses files created with the compress command. gzip is for compression (not decompression), zip creates .zip archives, and winzip is not a Unix tool.
-
tar -cvf file/tar -xvf file
-
tar -xvf file /tar -cvf file
-
tar -cvf file.tar <file>/tar -xvf file.tar <file>/
-
tar -xvf file.tar <file>/tar -cvf file.tar <file>/
C
Correct answer
Explanation
To create a tar archive, the syntax is tar -cvf archive.tar. To extract (untar) it, the syntax is tar -xvf archive.tar. Option 510833 correctly represents this pair of commands.