UNIX MCQs – UNIX Architecture (Part – 1)

1. What component of UNIX is responsible for managing system resources, providing essential abstractions, and facilitating communication between hardware and software?

a) Shell

b) Kernel

c) File System

d) Processes

Answer: b) Kernel

Explanation: The kernel is the core component of UNIX responsible for managing system resources and providing essential abstractions.


2. Which of the following is not a function performed by the UNIX kernel?

a) Process management

b) Memory management

c) File system management

d) Command-line interface

Answer: d) Command-line interface

Explanation: While the command-line interface (CLI) is an important aspect of UNIX, it is not a function performed directly by the kernel.


3. What is the primary role of the UNIX shell?

a) Managing hardware resources

b) Providing a graphical user interface (GUI)

c) Providing an interface for user interaction and command execution

d) Managing file system operations

Answer: c) Providing an interface for user interaction and command execution

Explanation: The shell provides a command-line interface for users to interact with the system and execute commands.


4. Which UNIX component is responsible for organizing and storing files and directories in a hierarchical structure?

a) Kernel

b) Shell

c) File system

d) Processes

Answer: c) File system

Explanation: The file system organizes and stores files and directories in a hierarchical structure for efficient storage and retrieval.


5. What is the function of an inode in the UNIX file system?

a) It represents a directory entry

b) It stores file data and metadata

c) It provides access control for files and directories

d) It represents a process in memory

Answer: b) It stores file data and metadata

Explanation: An inode in the UNIX file system stores information about a file, including its data blocks and metadata.


6. Which command is used to display the hierarchical structure of directories in UNIX?

a) ls

b) cd

c) mkdir

d) pwd

Answer: a) ls

Explanation: The ls command is used to list files and directories in UNIX, displaying the hierarchical structure of directories.


7. What is the purpose of the fork() system call in UNIX?

a) It creates a new process

b) It terminates the current process

c) It changes the current working directory

d) It reads data from a file

Answer: a) It creates a new process

Explanation: The fork() system call is used to create a new process, duplicating the existing process.


8. Which command is used to change the current working directory in UNIX?

a) ls

b) cd

c) pwd

d) mkdir

Answer: b) cd

Explanation: The cd command is used to change the current working directory in UNIX.


9. What is the role of the exec() system call in UNIX?

a) It creates a new process

b) It replaces the current process with a new program

c) It changes the ownership of a file

d) It reads data from a file

Answer: b) It replaces the current process with a new program

Explanation: The exec() system call is used to replace the current process with a new program, loading it into memory and executing it.


10. Which UNIX command is used to create a new directory?

a) ls

b) cd

c) mkdir

d) touch

Answer: c) mkdir

Explanation: The mkdir command is used to create a new directory in UNIX.


11. What is the purpose of the wait() system call in UNIX?

a) It waits for user input

b) It waits for a child process to terminate

c) It waits for a file to become available

d) It waits for a signal to be delivered

Answer: b) It waits for a child process to terminate

Explanation: The wait() system call is used by a parent process to wait for a child process to terminate.


12. Which command is used to remove files in UNIX?

a) rm

b) cp

c) mv

d) cat

Answer: a) rm

Explanation: The rm command is used to remove files in UNIX.


13. What is the function of the chdir() system call in UNIX?

a) It changes the ownership of a file

b) It changes the current working directory

c) It creates a new directory

d) It reads data from a file

Answer: b) It changes the current working directory

Explanation: The chdir() system call is used to change the current working directory in UNIX.


14. Which UNIX command is used to display the current working directory?

a) ls

b) cd

c) pwd

d) mkdir

Answer: c) pwd

Explanation: The pwd command is used to display the current working directory in UNIX.


15. What is the role of the pipe() system call in UNIX?

a) It creates a new process

b) It establishes communication between two processes

c) It changes the current working directory

d) It waits for a child process to terminate

Answer: b) It establishes communication between two processes

Explanation: The pipe() system call is used to establish communication between two processes, allowing them to share data.


16. Which command is used to copy files in UNIX?

a) rm

b) cp

c) mv

d) cat

Answer: b) cp

Explanation: The cp command is used to copy files in UNIX.


17. What is the purpose of the getpid() system call in UNIX?

a) It retrieves the process ID of the current process

b) It terminates the current process

c) It creates a new process

d) It waits for a child process to terminate

Answer: a) It retrieves the process ID of the current process

Explanation: The getpid() system call is used to retrieve the process ID of the current process in UNIX.


18. Which UNIX command is used to move files or directories?

a) rm

b) cp

c) mv

d) cat

Answer: c) mv

Explanation: The mv command is used to move files or directories in UNIX.


19. What is the function of the access() system call in UNIX?

a) It changes the permissions of a file

b) It retrieves the process ID of a file

c) It reads data from a file

d) It checks the accessibility of a file

Answer: d) It checks the accessibility of a file

Explanation: The access() system call is used to check the accessibility of a file in UNIX.


20. Which command is used to display the contents of a file in UNIX?

a) rm

b) cp

c) mv

d) cat

Answer: d) cat

Explanation: The cat command is used to display the contents of a file in UNIX.


21. What is the role of the opendir() system call in UNIX?

a) It opens a directory stream for reading

b) It closes a directory stream

c) It retrieves the process ID of a directory

d) It changes the current working directory to a directory

Answer: a) It opens a directory stream for reading

Explanation: The opendir() system call is used to open a directory stream for reading in UNIX.


22. Which UNIX command is used to list processes running on the system?

a) ps

b) top

c) kill

d) jobs

Answer: a) ps

Explanation: The ps command is used to list processes running on the system in UNIX.


23. What is the purpose of the chmod command in UNIX?

a) It changes the ownership of a file

b) It changes the permissions of a file

c) It creates a new file

d) It displays the contents of a file

Answer: b) It changes the permissions of a file

Explanation: The chmod command is used to change the permissions of a file in UNIX.


24. Which system call is used to terminate a process in UNIX?

a) exit()

b) fork()

c) exec()

d) getpid()

Answer: a) exit()

Explanation: The exit() system call is used to terminate a process in UNIX.


25. What is the purpose of the fork() system call in UNIX?

a) It creates a new process

b) It terminates the current process

c) It changes the current working directory

d) It reads data from a file

Answer: a) It creates a new process

Explanation: The fork() system call is used to create a new process in UNIX.


26. What is the primary function of the UNIX kernel?

a) Provide a graphical user interface

b) Manage system resources and provide essential abstractions

c) Interpret and execute user commands

d) Manage file storage and retrieval

Answer: b) Manage system resources and provide essential abstractions

Explanation: The kernel manages system resources such as CPU, memory, and devices, and provides essential abstractions for processes and hardware interactions.


27. Which component of UNIX handles communication between the user and the operating system?

a) Shell

b) Kernel

c) File system

d) Processes

Answer: a) Shell

Explanation: The shell acts as an interface between the user and the operating system, interpreting user commands and executing them.


28. In UNIX, what is the purpose of the file system?

a) Manage system resources

b) Provide essential abstractions

c) Organize and store files and directories

d) Interpret and execute user commands

Answer: c) Organize and store files and directories

Explanation: The file system organizes and stores files and directories in a hierarchical structure for efficient storage and retrieval.


29. What data structure in UNIX represents a file and contains metadata about the file?

a) Index

b) Inode

c) Table

d) Descriptor

Answer: b) Inode

Explanation: An inode in UNIX contains metadata about a file, such as its size, permissions, and location on disk.


30. Which command is used to display the contents of a directory in UNIX?

a) ls

b) cd

c) pwd

d) mkdir

Answer: a) ls

Explanation: The ls command is used to list the contents of a directory in UNIX.


31. What UNIX system call is used to create a new process?

a) fork()

b) exec()

c) wait()

d) getpid()

Answer: a) fork()

Explanation: The fork() system call creates a new process by duplicating the existing process.


32. Which command is used to change the current working directory in UNIX?

a) ls

b) cd

c) pwd

d) mkdir

Answer: b) cd

Explanation: The cd command is used to change the current working directory in UNIX.


33. What UNIX system call is used to replace the current process with a new program?

a) fork()

b) exec()

c) wait()

d) getpid()

Answer: b) exec()

Explanation: The exec() system call is used to replace the current process with a new program.


34. Which command is used to remove files in UNIX?

a) rm

b) cp

c) mv

d) cat

Answer: a) rm

Explanation: The rm command is used to remove files in UNIX.


35. What UNIX system call is used by a parent process to wait for a child process to terminate?

a) fork()

b) exec()

c) wait()

d) getpid()

Answer: c) wait()

Explanation: The wait() system call is used by a parent process to wait for a child process to terminate and retrieve its termination status.


36. Which command is used to copy files in UNIX?

a) rm

b) cp

c) mv

d) cat

Answer: b) cp

Explanation: The cp command is used to copy files in UNIX.


37. What UNIX system call is used to retrieve the process ID of the current process?

a) fork()

b) exec()

c) wait()

d) getpid()

Answer: d) getpid()

Explanation: The getpid() system call is used to retrieve the process ID of the current process in UNIX.


38. Which command is used to move files or directories in UNIX?

a) rm

b) cp

c) mv

d) cat

Answer: c) mv

Explanation: The mv command is used to move files or directories in UNIX.


39. What UNIX system call is used to change the permissions of a file?

a) chmod()

b) chown()

c) chdir()

d) stat()

Answer: a) chmod()

Explanation: The chmod() system call is used to change the permissions of a file in UNIX.


40. Which command is used to display the current working directory in UNIX?

a) ls

b) cd

c) pwd

d) mkdir

Answer: c) pwd

Explanation: The pwd command is used to display the current working directory in UNIX.


41. What UNIX system call is used to open a directory stream for reading?

a) opendir()

b) closedir()

c) readdir()

d) rewinddir()

Answer: a) opendir()

Explanation: The opendir() system call is used to open a directory stream for reading in UNIX.


42. Which command is used to list processes running on the system in UNIX?

a) ps

b) top

c) kill

d) jobs

Answer: a) ps

Explanation: The ps command is used to list processes running on the system in UNIX.


43. What UNIX system call is used to check the accessibility of a file?

a) access()

b) stat()

c) open()

d) read()

Answer: a) access()

Explanation: The access() system call is used to check the accessibility of a file in UNIX.


44. Which command is used to display the contents of a file in UNIX?

a) rm

b) cp

c) mv

d) cat

Answer: d) cat

Explanation: The cat command is used to display the contents of a file in UNIX.


45. What UNIX system call is used to terminate a process?

a) exit()

b) fork()

c) exec()

d) getpid()

Answer: a) exit()

Explanation: The exit() system call is used to terminate a process in UNIX.


46. Which command is used to create a new directory in UNIX?

a) ls

b) cd

c) mkdir

d) touch

Answer: c) mkdir

Explanation: The mkdir command is used to create a new directory in UNIX.


47. What UNIX system call is used to establish communication between two processes?

a) pipe()

b) socket()

c) connect()

d) listen()

Answer: a) pipe()

Explanation: The pipe() system call is used to establish communication between two processes in UNIX.


48. Which command is used to change the current working directory to the home directory in UNIX?

a) home

b) homedir

c) cd

d) ~

Answer: d) ~

Explanation: The ~ character is used as a shorthand for the user’s home directory in UNIX.


49. What UNIX system call is used to read data from a file?

a) read()

b) write()

c) open()

d) close()

Answer: a) read()

Explanation: The read() system call is used to read data from a file in UNIX.


50. Which command is used to display the manual pages for UNIX commands?

a) man

b) help

c) info

d) docs

Answer: a) man

Explanation: The man command is used to display the manual pages for UNIX commands, providing detailed information and usage instructions.

Related Articles

Linux MCQ

Welcome to Linux Multiple Choice Questions (MCQ) Section Embark on a journey through the world of...