Unix MCQs

Unix MCQs

These Unix multiple-choice questions and their answers will help you strengthen your grip on the subject of Unix. You can prepare for an upcoming exam or job interview with these Unix MCQs.
So scroll down and start answering.

1: Files in Unix may be a representation of the system's:

A.   Disk drives

B.   All are correct

C.   Terminals

D.   I/O devices

2: The notation '.' in an ls listing, is shorthand for:

A.   a hidden file

B.   the parent directory (one level up) in the directory hierarchy

C.   the current location in the directory hierarchy

D.   a regular file

3: When you type the name of a command, the shell finds it in:

A.   the aliases or shell functions

B.   all are correct

C.   the search path for an executable program or script with the given name

D.   list of built-in commands

4: The Unix end-of-file character is:

A.   Control-D

B.   Control-R

C.   Control-M

D.   Control-J

5: What do we get from running this command? echo "april|may|june|july" | awk -F'|' '{print $3}'

A.   june

B.   july

C.   may

D.   error

E.   april

6: In Unix, which of the following are not treated as files?

A.   Disk drives

B.   In Unix, everything is a file

C.   Directories

D.   Terminals

7: If a file has the permissions "-rwxr-x---", they can be specified as an octal mode of:

A.   3640

B.   570

C.   750

D.   463

8: To display hidden (dot) files, you use the command:

A.   ls -a

B.   ls -d

C.   ls -H

D.   ls -h

9: True or False: File names that begin with a period are called "hidden" files--that is, they are only revealed if you issue a special command.

A.   False

B.   A period is not a valid charcter in a file name

C.   A period is not a valid first charcter in a file name

D.   True

10: The format of a cp command is to specify:

A.   first the new filenamen and then the ame of the file you want to copy

B.   first the name of the file you want to copy and then the new filename

C.   -i before the name of the file you want to copy (input) and -o before the new filename (output)

D.   -s before the name of the file you want to copy (source) and -d before the new filename (destination)

11: In an inode, you usually will find:

A.   The location of the file's contents on the disk, if any

B.   all are correct

C.   A file reference count: the total number of names the file has

D.   The time the file's inode was last modified

12: What's the environment variable for your default shell?

A.   %SHELL%

B.   !SHELL

C.   $DEFAULT_SHELL

D.   $SHELL

E.   $MYSHELL

13: To execute commands and programs in the background you type in the command line, they must be followed by:

A.   &

B.   @

C.   |

D.   ;

14: A hidden file is any file whose:

A.   first character of the filename is a '.'

B.   there are no hidden files in Unix

C.   located in the directory /tmp

D.   extension is 'hidden'

15: To check the Current Date and Time you use:

A.   time

B.   tr

C.   date

D.   dd

16: The search path is stored in an environment variable named:

A.   PATH

B.   DIRS

C.   SEARCHPATH

D.   PATHS

17: When root creates a new account, by default the account password is:

A.   Same as the hostname

B.   Same as the account name

C.   There are no "default" passwords on Unix

D.   Same as the Unix version and Revision numbers

18: To make a file ac2 executable, you use the command:

A.   chmod +x ac2

B.   mkexec ac2

C.   exec ac2

D.   chgrp +x ac2

19: If you accidentally deleted a file FFF with the 'rm FFF' command, you can restore it using:

A.   rm -u FFF

B.   there's no way to reverse a delete operation on Unix

C.   the copy left in the /.recycle directory

D.   undelete FFF

20: To Rename a file, you use the command:

A.   id

B.   set

C.   ren

D.   mv

21: What happens if you try to create a directory with a name that has already been used?

A.   you get an error message

B.   the directory is emptied (all files in it are deleted)

C.   you'll be entered into a sub shell to fix the problem

D.   the old directory will be renamed with '.bak' extension

22: To securely copy files between computers, you use:

A.   rcp

B.   rcs

C.   scp

D.   scs

23: You can change your password with the command:

A.   chpasswd

B.   chpass

C.   passchange

D.   passwd

24: If you want to verify the pathname of the directory you are currently in, you use the command:

A.   path

B.   pwd

C.   cwd

D.   dir

25: To create a directory, you use:

A.   dir-mk

B.   mkdir

C.   All are correct

D.   None are correct

E.   md

26: The mv command:

A.   none are correct

B.   copies a file to a new location and leaves a copy in the original location

C.   moves a file to a new location

D.   copies a file to a new location and leaves a copy in the original location with the '.org' extension

27: To make a secure encrypted connection to the remote computer, you use:

A.   rlogin

B.   telnet

C.   ssh

D.   rsh

28: Unix filenames are case sensitive. This is:

A.   True in networked environments only

B.   Always false

C.   True in BSD Unix only

D.   Always true

29: You display the contents of a text file on the screen using the command:

A.   print

B.   cat

C.   type

D.   pr

30: If your (effective) process UID is 0, you can:

A.   change the nice value of processes

B.   all are correct

C.   send signals to processes

D.   change contents of memory locations

31: Unix has the following file/directory permissions:

A.   Read, write, execute

B.   Read, write, change

C.   Read, write, delete

D.   Read, write, modify

32: On Unix, you copy a file using the command:

A.   copy

B.   cp

C.   All of these

D.   cat

E.   file->copy

33: To temporarily change your UID, you use the command:

A.   masq

B.   su

C.   logout and login

D.   passwd

34: To specify an absolute path, the string for the path starts with:

A.   any valid character

B.   $HOME

C.   /

D.   ~

35: To give everybody in your group write permission to the file flog, you do:

A.   chmod w+g flog

B.   chmod g+w flog

C.   chmod g-w flog

D.   chmod u=w flog

36: To refer to your home directory, you use:

A.   All are correct

B.   $HOME

C.   !

D.   $LOGDIR

37: Which command is used to send and receive mail in Unix?

A.   mailman

B.   mailx

C.   outlook

D.   apple

38: To list directories rather than their contents, in ls you use the flag:

A.   -r

B.   -s

C.   -d

D.   -a

39: Unix uses the N character to separate the directories in the pathname. N is:

A.   \

B.   @

C.   ,

D.   /

40: Once you delete a file in Unix:

A.   it is gone forever

B.   it is moved to a special directory

C.   it is recoverable easily

D.   it is still in the file-system

41: To refer to the parent of the current working directory, you use:

A.   .

B.   ..

C.   true in SysV Unix only

D.   Ö

E.   ~

42: To list only the account name associated with the current login, you use the command:

A.   whoami

B.   id

C.   w

D.   who

43: The Unix escape character is:

A.   /

B.   \

C.   !

D.   |

44: To change the file flog so people who don't belong in your group can't read it, you use the command:

A.   chmod o=r flog

B.   chmod u=r flog

C.   chmod o+r flog

D.   chmod o-r flog

45: The Bourne shell has one file in your home directory that it reads when you log in; this file is:

A.   .bourne

B.   .shrc

C.   .sh.login

D.   .profile

46: If your account is named myuser, and you changed your password, one way to test that you type the new password correctly is:

A.   user myuser

B.   verify myuser

C.   None of these

D.   su myuser

47: Which of the following is NOT a scripting language in Unix?

A.   Tcl

B.   Perl

C.   Python

D.   script

48: A Unix user can belong to:

A.   more than one group if the user's UID is 0

B.   more than one group if the user is root, daemon, agent, uucp, lp, or news

C.   exactly one group

D.   more than one group

49: When files are recovered after any sort of problem or failure, if the kernel cannot ascertain the proper location in the file system, the recovered file is placed in the directory:

A.   recovered

B.   crash

C.   tmp

D.   lost+found

50: After a fork, the new process...

A.   has what is in the sixth field of the user record in the /etc/passwd file, as its current directory

B.   has the $PWD directory as its current directory

C.   has its user's home directory as its current directory

D.   inherits its current directory from its parent process