unix banner

Unix Multiple Choice Questions (MCQs) and Answers

Master Unix with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Unix concepts. Begin your placement preparation journey now!

Q91

Q91 In vi, which key allows you to switch from insert mode to command mode?

A

Esc

B

Ctrl

C

Shift

D

Alt

Q92

Q92 Which command saves changes and exits the vi editor?

A

:w

B

:q

C

:wq

D

:exit

Q93

Q93 What does the nano editor offer that vi does not by default?

A

Syntax highlighting

B

Easy undo

C

Line numbers

D

Graphical interface

Q94

Q94 In vi, which command deletes the current line?

A

dd

B

x

C

dl

D

:delete

Q95

Q95 How would you search for the word "example" in vi?

A

find example

B

/example

C

search example

D

example/

Q96

Q96 In nano, which shortcut is used to save the file?

A

Ctrl+X

B

Ctrl+S

C

Ctrl+O

D

Ctrl+Q

Q97

Q97 Which command is used to enter insert mode in vi?

A

Esc

B

Ctrl+I

C

i

D

Insert

Q98

Q98 A user can't exit nano after editing. What should they press to quit?

A

Esc

B

:q

C

Ctrl+X

D

Alt+Q

Q99

Q99 A user accidentally deletes a line in vi. Which command undoes this action?

A

Ctrl+U

B

Ctrl+Z

C

u

D

:u

Q100

Q100 After saving changes, a user can't see the updated content in nano. What might be the issue?

A

File was not saved

B

File permissions issue

C

Wrong file opened

D

Buffer not written

Q101

Q101 Which command in Unix is used to add a new user?

A

useradd

B

adduser

C

newuser

D

createuser

Q102

Q102 What is the purpose of the /etc/passwd file in Unix?

A

Stores user passwords

B

Contains user account details

C

Manages group policies

D

Lists directories

Q103

Q103 Which command is used to change a user’s password in Unix?

A

password

B

passwd

C

chpass

D

changepwd

Q104

Q104 What is the primary role of groups in Unix?

A

To manage disk usage

B

To organize users

C

To create user profiles

D

To run multiple programs

Q105

Q105 Which command allows you to modify an existing user’s attributes in Unix?

A

usermod

B

useradd

C

passwd

D

changeuser

Q106

Q106 How do you list all the groups a user belongs to in Unix?

A

groups username

B

listgroups username

C

usergroups username

D

group -l username

Q107

Q107 Which command adds a user to a group called developers?

A

adduser username developers

B

usermod -aG developers username

C

useradd developers username

D

groupadd username developers

Q108

Q108 How would you delete a user and their home directory in Unix?

A

deluser -h username

B

userdel -r username

C

rmuser username

D

removeuser username

Q109

Q109 A user cannot access a file despite having read permissions. What could be the issue?

A

User is in the wrong group

B

File permissions are wrong

C

File is deleted

D

File is corrupted

Q110

Q110 A user cannot change their own password due to "Permission denied." What could be the cause?

A

Incorrect password

B

No permission to change password

C

User account is disabled

D

Password file is locked

Q111

Q111 What does the $PATH environment variable do in Unix?

A

Sets user directory

B

Specifies terminal type

C

Lists directories for executable files

D

Changes file permissions

Q112

Q112 Which command displays all environment variables in Unix?

A

env

B

printenv

C

echo

D

export

Q113

Q113 What is the purpose of the $HOME variable in Unix?

A

Stores root directory

B

Specifies user’s home directory

C

Defines terminal size

D

Sets command history

Q114

Q114 What does the $USER variable represent in Unix?

A

User’s password

B

User’s home directory

C

Current username

D

Admin privileges

Q115

Q115 How do you make an environment variable available to child processes in Unix?

A

Use set command

B

Use export command

C

Use printenv command

D

Use chmod command

Q116

Q116 Which command displays the value of the variable $SHELL?

A

print $SHELL

B

echo $SHELL

C

env $SHELL

D

show $SHELL

Q117

Q117 How do you temporarily set the variable MY_VAR to "Hello" in the current session?

A

set MY_VAR="Hello"

B

export MY_VAR=Hello

C

MY_VAR=Hello

D

env MY_VAR=Hello

Q118

Q118 A script can't find a command in $PATH. What is a likely cause?

A

$PATH variable is missing

B

File permissions are restricted

C

Script syntax error

D

$USER variable is incorrect

Q119

Q119 A variable does not persist after logout. What is a likely solution to make it permanent?

A

Add it to .bash_profile

B

Use export command

C

Add it to $HOME

D

Add it to $USER

Q120

Q120 What does the df command display in Unix?

A

Disk usage

B

File system structure

C

Directory permissions

D

User groups

ad verticalad vertical
ad