Download as pdf or txt
Download as pdf or txt
You are on page 1of 48

1

UNIX

BASICS

1. What is UNIX?
a) an operating system
b) a text editor
c) programming language
d) software program
2. In which language UNIX is written?
a) JAVA
b) Python
c) C++
d) C
3. Which of the following is not a feature of UNIX?
a) multitasking
b) multiuser
c) portability
d) easy to use
4. Which of the following is not a part of all the versions of UNIX?
a) Kernel and Shell
b) Commands and utilities
c) Graphical user interface
d) System Calls
5. Which of the following is not true about UNIX?
a) Many people can use a UNIX based computer at the same time; hence UNIX is called as a multiuser
system
b) A user can run multiple programs at the same time; hence UNIX is called a multitasking environment
c) UNIX was not written in ‘C’ language
d) Linux is also known as a version of UNIX
6. POSIX is a set of standards specified for establishing compatibility between operating systems.
a) True
b) False
7. Shell is a command interpreter used for interacting with a UNIX system.
a) True
b) False
8. Which part of the UNIX operating system interacts with the hardware?
a) Kernel
b) Shell
c) vi editor
d) application program
9. Two UNIX systems may or may not use the same set of system calls.
a) True
b) False
10. What is a superuser?
a) system manager
b) normal user
c) administrator
d) a user with special rights
11. What is the windowing system of UNIX known as?
a) X Window system
2

b) LINUX
c) Red Hat
d) DOS
Ls

1. Which command is used for listing files in a directory?


a) ps
b) list
c) ls
d) wc
2. Which option is used with ls command for long listing of files with seven attributes?
a) -a
b) -l
c) -x
d) –i
3. Which option is used with ls to display attributes of the directory ?
a) -a
b) -ld
c) -d
d) -o
4. -a option is used with ls command for what purpose?
a) for showing hidden files
b) for showing executables
c) for showing directories
d) for multi columnar output
5. Which option is used with ls command to produce multi columnar output?
a) -x
b) -F
c) -a
d) -v
6. What is the collating sequence of ls command for listing files?
a) Numerals > Uppercase > Lowercase
b) Numerals > Lowercase > Uppercase
c) Lowercase > Uppercase > Numerals
d) Uppercase > Numerals > Lowercase
7. How can we identify executables and directories from the output of ls command?
a) using -F option
b) using -x option
c) using -a option
d) using -i option
8. $ ls -R outputs all files and subdirectories in a recursive manner.
a) True
b) False
9. -r option is same as -R option in ls command.
a) True
b) False
10. What does the -S option do in ls command?
a) sorts according to modification time
b) sorts according to last access time
3

c) sorts according to file size


d) sorts according to inode number
11. ls -s prints the allocated file size in blocks.
a) True
b) False
12. -u option sorts the files according to ____
a) last modification time
b) last access time
c) ASCII collating sequence
d) file size
13. -t option sorts the files according to ____
a) last modification time
b) last access time
c) ASCII collating sequence
d) file size
14. The output of ls dir* is ___
a) all files in the current directory
b) all files in the directory having a filename starting with dir
c) no filename is displayed
d) erroneous

1. Which command is used for printing the current working directory?


a) HOME
b) cd
c) pwd
d) dir2. Which command is used for changing the current directory?
a) cd
b) cp
c) pwd
d) rm
3. cd command cannot be used without any argument.
a) True
b) False

4. pwd and echo $HOME will display the same output.


a) True
b) False

1. Which command shows some attributes of a process?


a) pid
b) $$
c) ps
d) HOME
2. Which of the following attribute is not shown by ps command?
a) PID
b) PPID
c) tty
d) size
3. Which option is used by ps command to get a detailed listing of process attributes?
a) -u
4

b) -f
c) -l
d) -x
4. Which option is used by the system administrator for displaying processes of a user?
a) -f
b) -u
c) -a
d) -e
5. The -a option when used with ps command lists processes of all users but doesn’t display the system
processes.
a) True
b) False
6. Which option is used with ps command to list system processes?
a) -A
b) -a
c) -e
d) –A and -e
7. What will the output of the following command?

$ ps -t dev/console
a) processes running on terminal named console
b) undefined output
c) erroneous
d) processes running on the current terminal
8. There are ___ distinct phases of a process.
a) 2
b) 5
c) 4
d) 3

10. Which of the following system call is used for creating a new process?
a) read
b) fork
c) wait
d) new
11. When fork() is invoked, the child process created gets a new PID.
a) True
b) False
12. What is the value returned by fork system call, when the creation of child process is unsuccessful?
a) positive integer
b) negative integer
c) zero
d) fractional value
13. Which system call is used to run a new program?
a) fork
b) wait
c) exec
d) exit
5

14. Which system call is used by the parent process to wait for the child process to complete?
a) wait
b) exec
c) fork
d) exit

Cat

1. Which command is used for displaying contents of a file?


a) cp
b) rm
c) cat
d) mkdir
2. Apart from displaying file contents, cat command is also used for _____ files.
a) displaying
b) deleting
c) copying
d) creating
3. Multiple arguments as filenames can be specified in cat command.
a) True
b) False
4. Which symbol is used with cat command for creating files?
a) >
b) <
c) *
d) /
5. If we create a file using cat command with the same filename which already exists in the current
directory then,
a) existing file is deleted
b) new file will be created separately
c) existing file will be overwritten
d) an error will be produced
6. Which symbol is used to append an existing file?
a) >
b) <
c) >>
d) $
7. Which option is used with cat command for displaying non-printable characters?
a) -v
b) -n
c) -x
d) -a
8. Which option is used with the cat command for displaying file with line numbers?
a) -n
b) -v
c) -a
d) -x
9. Which of the following cannot be performed by cat command?
a) displaying files
b) creating files
6

c) appending files
d) deleting files
10. What does cat file01 file01 file01 display?
a) error
b) blank terminal
c) contents of file01 three times successively
d) contents of file01 single time
11. Which files will be displayed by the following command:

cat *file*
a) all files in the directory
b) all files with filename containing ‘file’
c) no files will be displayed
d) a single file
12. Which command is used to create empty files?
a) cp
b) cat
c) touch
d) create
13. Which option is used with touch command which forces the command not to create file, if it does not
exists.
a) -h
b) -c
c) -t
d) -f
14. Which one of the following commands is incorrect?
a) cat file01
b) cat > file01
c) cat >> file1
d) cat -a file01

Cp

1. What is the function of cp command in UNIX?


a) list all the available files in the current directory
b) delete a given file
c) cp is a command used for copying files and directories
d) change the directory
2. What happens if the destination file specified in cp command does not exist?
a) file will not be copied
b) an error will be produced
c) destination file will be automatically created
d) none of the mentioned
3. Which of the following is not an option of cp command?
a) -z
b) -i
c) -R
d) -u
7

4. What is the correct syntax for copying multiple files with a filename starting as ‘file’ into another file
named as ‘directory_one’?
a) cp -i file directory_one
b) cp -R file directory/directory_one
c) cp file* directory_one
d) none of the mentioned
5. How can we copy an entire directory under another directory?
a) using -R option
b) using -a option
c) using -u option
d) none of the mentioned
6. How can we copy a file into our current directory?
a) cp file1
b) cp file1
c) cp file*
d) none of the mentioned
7. What does the following command do?

cp -u * dir_file
a) copy all files to directory dir_file
b) update all files
c) delete all files
d) update all files in the current working directory and copy newer ones to directory dir_file
8. Sometimes it is not possible to copy a file.
a) True
b) False
9. What does -i option do?
a) interactive copying
b) recursively copying
c) updating
d) none of the mentioned
10. To copy multiple files, the last destination file should be a directory.
a) False
b) True
11. -n option is used with cp command for what purpose?
a) existing file should not be overwritten
b) to update file
c) interactive copying
d) recursive copying
12. Which option is used with cp command for linking files instead of copying?
a) -v
b) -l
c) -f
d) -x
13. $ cp -f copies forcefully.
a) True
b) False
14. -v option is used with cp command for displaying _____
a) errors
b) informative messages
8

c) diagnostic messages
d) file contents

Mv rm

1. Which command is used for removing/deleting files in UNIX?


a) rmdir
b) rm
c) del
d) mv
2. We can delete multiple files using a single rm command.
a) True
b) False
3. To delete all files in a directory we use ______________
a) rmdir *
b) mv *
c) rm *
d) del *
4. Some files cannot be deleted using rm command because of the permissions associated with it.
a) True
b) False
5. Which option is used with rm command for interactive deletion?
a) -i
b) -f
c) -r
d) -R
6. Which option performs recursive deletion?
a) -r
b) -R
c) *
d) -r and -R
7. Which one of the following command can delete a directory which is not empty?
a) rm -r
b) rmdir
c) rm *
d) del *
8. If we wish to delete a remove a file forcefully, we can use ____ option with rm command.
a) -i
b) -r
c) -R
d) -f
9. Which command is used for removing file named -file.txt?
a) rm -file.txt
b) rm file.txtrm
c) rm — -file.txt
d) rm -f file.txt
10. Which command is used for renaming files?
a) rename
b) mv
9

c) cp
d) move
11. If the destination file does not exists, then mv command creates it.
a) True
b) False
12. What if the destination file specified in mv command already exists?
a) it will be deleted
b) it will not be affected
c) it will be overwritten
d) an error will be produced
13. Apart from renaming files, mv command can also
a) move a file
b) move a group of files
c) rename a directory
d) move a group of files and rename a directory
14. The inode number associated with a file is changed after renaming it.
a) True
b) False
15. Which option is used for backing up destination file in mv command?
a) -b
b) -f
c) -v
d) -i
16. Which option is used with mv command so that the destination file does not get overwritten?
a) -n
b) -f
c) -b
d) -i
17. -f option when used with mv command overwrites existing files without prompting any messages.
a) True
b) False

Touch

(1)What is the purpose of the touch command?


(a)It creates a new empty file

(b)It displays the contents of a file

(c)It updates the timestamp of an already existing file


(d)It makes a new directory
(2)Which option will be used with touch command to change the access time?
A. -a

B. -b

C. -t

D. –h
10

9. Which command is used for displaying date and calendar in UNIX?


a) date and cal
b) DATE and CAL
c) date and calendar
d) dt and cl

16. Which option is used with touch command to change the time of last file modification? a) -a b) -m c) -r
d) –i

15. When touch command is used without any options or expression, both times are set to current time
and the file is created if it doesn’t exist. a) True b) False

Wc

1. Which command is used for counting words, lines and characters in a file?
a) diff
b) count
c) man
d) wc
2. wc command cannot take multiple filenames as arguments.
a) True
b) False
3. Which option is used for counting the number of lines in a file only.
a) -l
b) -W
c) -c
d) -w

4. Which option is used for counting the number of words in a file only?
a) -l
b) -W
c) -c
d) -w
5. Which option is used for counting the number of characters in a file only.
a) -l
b) -W
c) -c
d) -w
6. wc command can also work on a data stream.
a) True
b) False
7. What does the following command do?

$ wc sample.txt > newfile


a) reads word count from sample.txt
b) reads word count from newfile
11

c) reads word count from sample.txt and write it to newfile


d) error is produced
8. Which command is used for printing a file?
a) lp
b) pr
c) pg
d) more
9. Which option is used with lp command if there are more than one printers in the system?
a) -t
b) -d
c) -i
d) -p
10. Which option is used for printing multiple copies of a file using lp command?
a) -l
b) -i
c) -t
d) -n
11. -t option prints the title on the first page.
a) True
b) False
12. What does the following command do?

cancel prl-320
a) cancel printing from printer ‘prl’
b) cancel printing current job
c) cancel printing job number 320 on printer name ‘prl’
d) undefined behavior
13. Which command is used for knowing the file type?
a) file
b) type
c) filetype
d) type of file
14. file command identifies the file type by examining the magic number of the file.
a) True
b) False
15. UNIX offers a pager named ____ which has replaced the original pager of UNIX called ____
a) more, less
b) less, more
c) more, pg
d) pg, more
16. Which of the following is not an internal command for more?
a) q
b) f
c) b
d) z

Comm and diff


12

7. Which command compares two sorted files line by line?


a) cmp
b) diff
c) comm
d) sort
8. What will be the command if we want to suppress column 1 and column 2 in the output of comm
Command?
a) comm -12
b) comm -1-2
c) comm -3
d) comm -1,-2

9. For comm command to work properly, files specified should be sorted.


a) True
b) False
10. Which command is used to display the differences between files?
a) comm
b) diff
c) cmp
d) differ
11. When two files are identical, what is the output of diff command?
a) Files are identical
b) Returns prompt
c) No output
d) Throws an error
12. Which option is used to produce multi columnar output in diff command?
a) -y
b) -v
c) -s
d) -e
13. If we are interested in knowing that whether the two files are identical or not, we can use ___
command.
a) comm
b) diff
c) cmp
d) differ

Bc sort ln du

5. For what purpose bc command is used?


a) as a calculator
b) as an editor
c) as a process table viewer
d) for copying files

1. ____ command is used for sorting a file on specified fields.


a) cut
b) sort
c) pr
d) tail
13

2. By default, sort command reorders lines in ASCII collating sequence.


a) True
b) False
3. Sort command uses ____ as default field delimiter.
a) tab
b) single space
c) double tab
d) one or more continuous spaces
4. Which option is used with sort command to specify the field delimiter?
a) -a
b) -t
c) -k
d) -n
5. Which option is used for sorting a file according to primary key?
a) -t
b) -k
c) -n
d) -n
6. The sort order can be reversed using ___ option.
a) -t
b) -k
c) -r
d) -n
7. We can perform sorting on secondary key also using sort command.
a) True
b) False
8. We cannot perform sorting on columns using sort command.
a) True
b) False
9. Which option is used when we’ve to sort files containing only numbers?
a) -n
b) -a
c) -d
d) -u
10. _____ option is used with sort command for removing repeated lines.
a) -n
b) -u
c) -t
d) -a
11. Which option is used by the sort command to redirect the output to a specified file?
a) -n
b) -t
c) -o
d) -u
12. The name of the input and output files cannot be same while using sort command.
a) True
b) False
13. To check whether the file has actually been stored in the default order, we can use ____ option.
a) -n
b) -a
14

c) -d
d) -c
14. Which option is used with sort command to sort multiple files collectively?
a) -m
b) -n
c) -c
d) -o

1. which of the following occurs for ln command?


a) a file is created that is a copy of an existing file
b) a file is moved from one location to another
c) a file is renamed
d) that points to an existing file is created by a file

2. Every file is associated with a table which contains all possible information about a file, that table is
called as _________ a) info table b) file table c) inode d) ps table

3. Which of the following is not a content of inode? a) file type b) file permission c) file size and links d) file
name

8. Which command is used to link a file with multiple filenames? a) ln b) link c) hl d) sl

9. Which option is used with ln command to create a soft link? a) -a b) -l c) -s d) –e

10. A hard-linked file is assigned the same inode number as the original value. a) True b) False

11. If we want to link files across the file systems, we have to use only soft links. a) True b) False

14. Which command is used to change timestamps associated with a file? a) touch b) time c) umask d) ls

1. Which command is used to find out the consumption of a specific directory?


a) du
b) df
c) mem
d) dv
2. Which option is used with du command for finding only the summary of disk usage by a specific
directory?
a) -e
b) -f
c) -e
d) -s

3. du command can also be used for reporting the disk space consumed by each user.
a) True
b) False

Kill sleep

3. Which command is used for premature termination of a process?


a) signal
15

b) nice
c) kill
d) nohup
4. Which one of the following command is used for killing the last background job?
a) kill $
b) kill $$
c) kill $!
d) kill !
5. By default, kill uses the SIGTERM signal (15) to terminate the process.
a) True
b) False
6. Which signal is used with kill command to terminate the process when they ignore the SIGTERM signal
(15)?
a) SIGTERM (16)
b) SIGTERM(0)
c) SIGKILL(9)
d) -d
7. Which option is preferred while killing a process using SIGKILL signal (9)?
a) -p
b) -s
c) -h
d) -d
8. Which of the followings command(s) is used to kill the login shell?
a) kill 0
b) kill -9 $$
c) kill -s KILL 0
d) kill -9 $$ and kill -s KILL 0
9. Kill -l will list all the signal numbers on our machine.
a) True
b) False

(10)Which command puts a script to sleep untill a signal is recieved?


A sleep
B suspend
C disown
D break
Chmod chown chgrp

1. Which command is used to change the permissions of a file?


a) chmod
b) ch
c) chown
d) chgrp
2. chmod command can take multiple filenames as arguments.
a) True
b) False
3. chmod command can be used in ____ ways.
a) 3
b) 2
16

c) 5
d) 0
4. The expression used with chmod command to change permissions in a relative manner contains ____
components.
a) 5
b) 2
c) 4
d) 3
5. Which of the following characters specify the user and group category?
a) ‘u’ and ‘g’
b) ‘g’ and ‘o’
c) ‘us’ and ‘gr’
d) ‘u’ and ‘o’
6. Which of the following symbol is used with chmod to assign permission to a file?
a) –
b) /
c) +
d) *
7. To assign execute permission to the user (owner) for a file named file01.txt, which of the following
command will be used?
a) chmod u+r file01.txt
b) chmod u+w file01.txt
c) chmod u-x file01.txt
d) chmod u+x file01.txt
8. What does the following command do?

$ chmod ugo +w file01.txt


a) assign write permission to users, group and others
b) assign write permission to the user (owner) only
c) assign write permission to group and others
d) command not executable
9. Which character is used to replace ‘ugo’ string in chmod command?
a) a
b) v
c) x
d) o
10. To remove write permission from group and others, which one of the following commands will be
used?
a) chmod go+w file01
b) chmod go-w file01
c) chmod ug-w file01
d) chmod a-w file01

1. While changing permissions in an absolute manner, we explicitly set all the nine bits irrespective of the
previous permissions of the file.
a) True
b) False
2. What are the permission of file01 after executing this command?
17

chmod 777 file01


a) rwxrwxrwx
b) rw-rw-rw
c) r–r–r–
d) r–r—-
3. A file named file01 should be readable, writable and executable only by the user(owner). Which one of
the following set of command will be used?
a) chmod 700 file01
b) chmod 000 file01
c) chmod 477 file01
d) chmod 777 file01
4. A file has a permission set as 000 i.e. — — —. Can the file be deleted?
a) Yes
b) No
5. A file has a permission set as 777 ie rwxrwxrwx but the directory permissions are 400. If the user tries to
delete the file, will he be able to do it?
a) Yes
b) No
6. Which command is used to change the ownership of a file?
a) chmod
b) change
c) ch
d) chown
7. Which option is used for the recursive functioning of chmod command?
a) -R
b) -r
c) -l
d) -i
8. Which command is used to change the group owner of the file?
a) chown
b) ch
c) chgrp
d) chmod
9. A user can change the group ownership of a file to another group to which he does not belong.
a) True
b) False
10. Like chmod, chown and chgrp can also use ___ option.
a) -R
b) -r
c) -x
d) -i
11. UNIX allows the system administrator to use the only chown to change both owner and group.
a) True
b) False
12. Which symbol is used to change permissions for hidden files?
a) .
b) &
c) $
d) *
18

1. A file can be recognized as an ordinary file or directory by ____ symbol.


a) $
b) –
c) *
d) /
2. How many types of permissions a file has in UNIX?
a) 1
b) 2
c) 3
d) 4
3. Permissions of a file are represented by which of the following characters?
a) r,w,x
b) e,w,x
c) x,w,e
d) e,x,w
4. A file named abd.txt has the following set of permissions

-rwxrwxrwx
All the three operations i.e read, write and execute can be performed on the file by file owner, group
owner and others.
a) True
b) False
5. Which of the following symbol is used to indicate the absence of a permission of a file?
a) $
b) &
c) +
d) –
6. When we create a file, we are the owner of a file.
a) True
b) False
7. What is group ownership?
a) group of users who can access the file
b) group of users who can create the file
c) group of users who can edit the file
d) group of users who can delete the file
8. A file has permissions as rwx r– —. A user other than the owner cannot edit the file.
a) True
b) False
9. If a file is read protected, we can write to the file.
a) True
b) False
10. The write permission for a directory determines that ____________
a) we can write to a directory file
b) we can read the directory file
c) we can execute the directory file
d) we can add or remove files to it
11. If the file is write-protected and the directory has to write permission then we cannot delete the file.
a) True
b) False
19

12. What is execute permission?


a) permission to execute the file
b) permission to delete the file
c) permission to rename the file
d) permission to search or navigate through the directory
13. Which of the following is default permission set for ordinary files?
a) rw-rw-rw-
b) rwxrwxrwx
c) r–r–r–
d) rw-rw-rwx
14. Which of the following is default permission set for directories?
a) rw-rw-rw-
b) rwxrwxrwx
c) r–r–r–
d) rw-rw-rwx
15. A file owner does not have a permission to edit the file but the group to which the file owner belong do
have the permission to edit it. Can owner edit the file?
a) Yes
b) No
c) Cannot be defined
d) Error will be encountered

We can change the priority of a running process using?


nice
renice
the priority cannot be changed for a running process
only the superuser can change the priority
cut paste
2. To extract specific columns from a file, ____ command is used.
a) tail
b) head
c) pr
d) cut
3.The expression cut -c -3 emp.lst will cut columns number _____
a) 3
b) 1
c) 1-3
d) 0

4. ____ option is used with the cut command for cutting fields.
a) -c
b) -n
c) -f
d) -a
5. What is the default delimiter used by the cut command for cutting fields?
a) space
b) tab
c) double tab
d) underscore
20

6. Which option is used with the cut command for cutting field base on the value of our specified
delimiter?
a) -a
b) -f
c) -d
d) -e
7. We have to specify whether we want to cut fields or columns while using cut command.
a) True
b) False
8. The following command will produce an error.

$ cut -d “|” -f 1,4 emp.lst


a) True
b) False
9. Which one of the following commands is incorrect?
a) $ cut -d “|” -f 1,4 emp.lst
b) $ cut -c -3 emp.lst
c) $ tail -c 511 foo
d) $ tail -c foo
10. Which command is used for pasting files?
a) cut
b) paste
c) tail
d) head
11. Whatever we have cut using cut command can be pasted back using paste command but vertically.
a) True
b) False
12. paste command uses space as the default field delimiter.
a) True
b) False
13. _____ option is used with paste command if we want to specify our own delimiter.
a) -d
b) -c
c) -a
d) -e
14. Which option is used with paste command for joining lines?
a) -s
b) -c
c) -a
d) -e

Grep
1. Which one of the following command is used for searching for a pattern in one or more file(s)?
a) cd
b) cp
c) paste
d) grep
2. Which one of the following is the correct syntax for grep command?
a) grep options filename(s)
b) grep options pattern
21

c) grep pattern filename


d) grep options pattern filename(s)
3. Which one of the following command will be used for searching “director” in emp.lst?
a) grep “director”
b) grep -v “director” emp.lst
c) grep -director emp.lst
d) grep “director” emp.lst
4. When the pattern is not found in a file, grep command silently returns the prompt.
a) True
b) False
5. grep command can be used for searching a pattern in more than one file.
a) True
b) False
6. If there are special characters in a pattern, then we’ve to enclose them in ______
a) single quotes
b) double quotes
c) without any quotes
d) all quotes
7. Which option is used with grep command for ignoring the case in pattern searching?
a) -a
b) -v
c) -i
d) -e
8. Which option is used with grep command for deleting lines?
a) -v
b) -e
c) -a
d) -i
9. Which option is used for displaying the line numbers containing the pattern along with lines?
a) -v
b) -i
c) -e
d) -n
10. ______ option counts the number of lines containing the pattern?
a) -c
b) -i
c) -e
d) -n
11. Which option displays only the filename containing the pattern?
a) -i
b) -n
c) -e
d) -l
12. _____ option is used when we need to match multiple patterns in a single invocation of grep
command?
a) -a
b) -e
c) -n
d) -i
22

13. For taking patterns from a file, -f option is specified with grep command.
a) True
b) False
14. POSIX identifies regular expressions as belonging to ____ categories.
a) 3
b) 2
c) 4
d) 5
15. grep command supports both extended and regular expressions.
a) True
b) False

1. Which of the following is not a subset of BRE (basic regular expression) character subset?
a) *
b) .*
c) ^$
d) ch+
2. Character class is used for matching a group of characters enclosed within a pair of _____
a) ( )
b) “ “
c) [ ]
d) { }
3. The following command will match ‘Agarwal’, ‘agarwal’ and ‘agrawal’.

$ grep “*aA+g*ar+*ar+wal” emp.lst


a) True
b) False
4. Which of the following symbol is used for matching the immediately preceding character?
a) *
b) $
c) [ ]
d) %
5. Which symbol is used for matching a single character?
a) *
b) .
c) &
d) %
6. Which of the following symbols are used for matching a pattern at specified locations?
a) *
b) ^
c) $
d) ^ and $
7. The following command will match the lines beginning with ‘2’.

$ grep “^2” emp.lst


a) True
b) False
8. Which of the following symbols are a set of ERE (extended regular expressions)?
a) +
23

b) –
c) ?
d) + and –
9. Which option is used when we want to use an ERE with grep command?
a) -e
b) -i
c) -E
d) -i
10. Which of the following symbols are used for matching multiple patterns?
a) |
b) &
c) ( and )
d) | and ( and )

Find
1. Which command is used for locating files?
a) search
b) find
c) loc
d) type
2. The syntax of the find command is ____________
a) find path_list selection_criteria action
b) find action path_list selection_criteria
c) find selection_criteria action path
d) find path action
3. Which symbol is used with find command for specifying arguments?
a) +
b) –
c) + and –
d) |
4. What will be the output of the following command?

$ find / -name a.out -print


a) all files having filename as a.out
b) all files in the root directory
c) undefined output
d) erroneous
5. We can use relative pathname in the path list while using find command.
a) True
b) False
6. Which one of the following option is used for locating the files by inode number?
a) -name
b) -inum
c) -inode
d) -ind
7. Which option is used with find command for specifying the file type?
a) -perm
b) -inum
24

c) -name
d) -type
8. To specify permissions while using find command we have to use _____ option.
a) -perm
b) -inum
c) -name
d) -type
9. Which option is used to find command to search for files based on access time?
a) -atime
b) -mtime
c) -time
d) -type
10. Which of the following command will be used to locate those files that have not been modified for
more than a year?
a) find . -mtime 1
b) find . -mtime 1 year -print
c) find . -mtime +365 -print
d) find . -mtime -365 -print
11. Which of the following operator is used with find command for performing the negate function?
a) -a
b) -o
c) &&
d) !
12. Which operator is used to specify the AND condition in find command?
a) !
b) &&
c) -A
d) -a
13. -o operator represents the OR condition.
a) True
b) False
14. Which of the following option is used with find command for taking action on selected files?
a) -exec
b) -atime
c) -mtime
d) -a
15. -ok option is used with find command for seeking information before taking the action specified.
a) True
b) False

Whereis env

The whereis command helps you to locate...

manual pages
executable files
source code
all are correct
8. ____ command is used to display the environment variables only.
a) set
25

b) env
c) sh
d) var
9. ____ command displays all the variables available in the current shell.
a) env
b) set
c) var
d) sh
10. Environment variable names can be defined only in uppercase.
a) True
b) False
11. Environment variables control the behavior of the system.
a) True
b) False

15. Which one of the following is not an environment variable?


a) HOME
b) PATH
c) USER
d) env

Echo path classpath

1. echo command is used for _________


a) displaying errors
b) displaying operating system details
c) displaying diagnostic messages
d) displaying date and time

Which of the following command is used to set path?

A. Path.sys

B. Config.sys

C. IO.sys

D. Autoexec.bat

The PATH command is usually found as part of your _____ file.

A. CONFIG.SYS

B. CONFIG.BAT

C. AUTOEXEC.SYS

D. AUTOEXEC.BAT
26

VI EDITOR

1. Which editor is used by the UNIX system to edit files?


a) vi
b) notepad
c) word
d) notepad++
2. What does the following command do?

$ vi file001
a) open file named file001
b) edit file named file001
c) delete a file named file001
d) open file if it exists else creates a new file
3. Which option is used by vi editor to open a file in read mode only?
a) -r
b) -R
c) -d
d) -f
4. How many types of modes are used by vi editor?
a) 2
b) 4
c) 3
d) 1
5. What is the default mode of vi editor?
a) Command mode
b) Input mode
c) Ex mode
d) Insert mode
6. To insert text into a file, _____ mode is used.
a) Command mode
b) Input mode
c) Ex mode
d) def mode
7. ex mode is used for what purpose?
a) file handling
b) substitution
c) file handling and substitution
d) Inputting text in files
8. Which one of the following key is used to switch from command mode to input mode?
a) i
b) :
c) esc
d) ;
9. ____ key is used for switching to command mode from input mode.
a) i
b) A
c) :
d) esc
27

10. Which of the following key is used to enter in ex-mode?


a) ESC
b) i
c) :
d) ;
1. ex-mode is used to save our work.
a) True
b) False
2. Commands inputted in command mode don’t appear on the terminal.
a) True
b) False
3. To clear the screen in vi editor, _____ is used.
a) ctrl-h
b) ctrl-l
c) ctrl-p
d) ctrl-v
4. vi commands are not case sensitive.
a) True
b) False
5. While entering text in input mode the data is saved in _____
a) buffer
b) disk
c) RAM
d) cache
6. To quit vi editor without saving the buffer we can use
a) :q
b) :c
c) :w
d) :q!
7. The first UNIX editor was ____
a) emacs
b) ex
c) ed
d) vi
8. One of the most important features of vi editor is _______
a) available mostly across all UNIX platforms
b) easy to learn
c) latest editor
d) powerful than other editors
9. The “ed” text editor is no longer in use.
a) True
b) False

1. Input mode is used for ____________


a) editing text in files
b) invoking commands on files
c) saving files
d) performing substitution
2. Which command is used to insert text before the current cursor location?
a) a
28

b) A
c) I
d) i
3. Which command will be used to insert text at the beginning of the line?
a) i
b) I
c) a
d) A
4. To append text after the current cursor location, we can use ____ command
a) A
b) a
c) i
d) I
5. Which command appends text at the end of the current line?
a) A
b) a
c) i
d) I
6. To replace a single character, we use ____ command
a) r
b) R
c) s
d) i
7. vi automatically switches from command mode to input mode when we press ‘r’.
a) True
b) False
8. To replace all text on the right of the cursor position, we use ____ command.
a) r
b) R
c) s
d) I
9. Which one of the following command is used to replace a single character with many?
a) s
b) r
c) R
d) S
10. To replace 5 characters with new characters, which one of the following will be used?
a) s
b) 5S
c) 5s
d) S
11. To replace the entire line irrespective of cursor position, we can use ____ command
a) s
b) 10s
c) S
d) 10s
12. After using ‘s’ or ‘S’, we are automatically left in insert mode.
a) True
b) False
29

13. Which command creates a space for entering a new line of text below the current cursor location?
a) o
b) O
c) a
d) S
14. To create a space for entering a new line of text above the current cursor location, ‘O’ command is
used.
a) True
b) False
15. Which of the following command is not used for entering or replacing text?
a) ‘a’ and ‘A’
b) ‘s’ and ‘S’
c) ‘r’ and ‘R’
d) :q

1. To save the editing performed on a file, we have to switch to ______ mode


a) command
b) input
c) ex
d) insert
2. Pressing ‘:’ in command mode invokes which mode of vi editor?
a) ex-mode
b) insert mode
c) command mode
d) input mode
3. To save a file and return to shell prompt, which one of the following command will be used in ex-mode?
a) :w
b) ‘:x’
c) :a
d) :f
4. To save a file and remain in vi editor, which one of the following command will be used?
a) :w
b) ‘:x’
c) :q
d) :a
5. After pressing ‘:w’, we can normally resume our editing work.
a) True
b) False
6. We can specify the filename with ‘:w’ command.
a) True
b) False
7. Which command is used for saving and quitting the editor simultaneously?
a) :q
b) :w
c) ‘:x’
d) :f
8. Which of the following command is a substitute for ‘:x’ command?
a) ‘:x’
b) :wq
30

c) :q
d) :w
9. Which one of the following is the best way of saving and quitting the editor?
a) ZZ
b) :wq
c) :w
d) ‘:x’
10. Which command is used to abort the editing and quit the editing mode?
a) :w
b) :wq
c) :q
d) ‘:x’

1. Quit (:q) command doesn’t work if the buffer is unsaved.


a) True
b) False
2. Which of the following command will be used if we want to abort editing and quit the editor even if the
buffer has been changed and not saved?
a) :q
b) :b
c) :q!
d) :w
3. In ex-mode, current line is represented by ___
a) :
b) $
c) >
d) .
4. In ex-mode, last line is represented by ___
a) :
b) $
c) >
d) .
5. ‘:w’ command can be used to write selected lines.
a) True
b) False
6. Which of the following command will be used to write the 4th line to file named file002?
a) : 1,40w file002
b) : 1,$w file002
c) : 4w file002
d) : 1,4w file002
7. Which of the following is not a valid command?
a) : .,$w file002
b) :w 1,$ file002
c) : .w file002
d) : $w file002
8. How can we escape to the UNIX shell without quitting vi editor?
a) using ‘:sh’ command
b) using ctrl-Z
c) using ctrl-D
d) using ‘:sh’ command and using ctrl-Z
31

9. To return back to the editor from shell prompt we use _____ command.
a) fg
b) exit
c) back
d) fg and exit
10. vi editor stores most of its information in a hidden swap file.
a) True
b) False
11. To recover from a crash, we can use ____ command.
a) :recover
b) -r
c) : x
d) :recover and -r
12. The following command will save the contents of the buffer and overwrites the contents of existing file.

:w! file003
a) True
b) False

1. For navigation purposes, the mode should be _____ mode.


a) command
b) input
c) insert
d) ex
2. Which of the following keys are used to moving the cursor up and down?
a) k
b) h
c) l
d) k and j
3. Which of the following keys is used to moving cursor leftwards along a line?
a) k
b) h
c) l
d) j
4. Which one of the following keys are used to moving cursor rightwards along a line?
a) k
b) h
c) l
d) j
5. We can prefix the repeat factor with navigation keys (h, j, k and l).
a) True
b) False
6. Which one of the following command is invalid?
a) 20h
b) 5l
c) 4k
d) 3d
7. We can perform word navigation in vi editor.
a) True
b) False
32

8. Using ‘b’ command we can _____________


a) move back to the beginning of the word
b) move forward to the end of the word
c) move forward to the beginning of the word
d) move back to the end of the word
9. Using ‘e’ command we can _____________
a) move back to the beginning of the word
b) move forward to the end of the word
c) move forward to the beginning of the word
d) move back to the end of the word
10. Using ‘w’ command we can _____________
a) move back to the beginning of the word
b) move forward to the end of the word
c) move forward to the beginning of the word
d) move back to the end of the word

1. We can prefix repeat factor with word navigation commands.


a) True
b) False
2. Which command is used for moving the cursor to the line extreme?
a) |, 0
b) &
c) %
d) L
3. ____ command moves the cursor to the end of next line.
a) 0
b) |
c) %
d) $
4. Which of the following commands will move the cursor to the end of line number 30 if the current
position of the cursor is line number 01?
a) 30$
b) 30|
c) 30b
d) 30%
5. Which of the following control keys will be used for scrolling one page forward?
a) ctrl-f
b) ctrl-b
c) ctrl-z
d) ctrl-v
6. We can scroll halve page using control keys.
a) True
b) False
7. To navigate 20 pages forward, we can use ______ command.
a) 20 ctrl-b
b) 20 ctrl-d
c) 20 ctrl-u
d) 20 ctrl-f
8. Which command is used to know the current line number?
a) ctrl-f
33

b) ctrl-b
c) ctrl-z
d) ctrl-g
9. Which key is used for absolute movement?
a) f
b) G
c) M
d) ctrl-g

10. Which of the following commands of ex-mode is equivalent to ‘G’ command in command mode?
a) : .
b) : $
c) : %
d) :w

1. Copying is referred to as yanking in vi editor.


a) True
b) False
2. Which key is used for deleting text?
a) d
b) y
c) k
d) f
3. Which command is used for deleting a single character?
a) d
b) dd
c) x
d) w
4. Which command is used for deleting the character on the left of the cursor?
a) x
b) X
c) dd
d) d
5. Which of the following command is used to delete a single line?
a) dd
b) x
c) X
d) d
6. Which of the following commands will be used to delete 6 lines from the current cursor location?
a) 6d
b) 6X
c) 6dd
d) 6x
7. Which command is used for putting deleted lines or part of lines at a different location?
a) p and P
b) x
c) dd
d) y
34

8. Both ‘p’ and ‘P’ command puts text right/left or above/below on the basis of line deleted.
a) True
b) False
9. To copy (yank) lines in vi editor, we use ______ command.
a) dd
b) x
c) p
d) yy
10. To copy 10 lines from the current cursor location, we can use _____
a) 10y
b) 10yy
c) yy10
d) 10x

1. We can use ‘yy’ command for copy and paste operation.


a) True
b) False
2. Which command is used for joining lines?
a) J
b) j
c) yy
d) jn
3. Which command will be used to join 4 lines with the current line?
a) 5J
b) 4J
c) 6J
d) 4j
4. Which of the following undo a most recent single editing change?
a) u
b) U
c) uu
d) yy
5. ___ command allows us to undo a number of changes that have been made to a single line before
moving away from that line.
a) u
b) U
c) dd
d) yy
6. Which command is used to redo the changes made by the undo command?
a) ctrl-l
b) ctrl-r
c) ctrl-g
d) ctrl-f
7. ’10u’ command will reverse our 10 last editing actions.
a) True
b) False
8. Which symbol is used for repeating the last command?
a) $
b) *
35

c).
d) _

1. Which of the following symbols are used for searching a pattern in vi?
a) /
b) ?
c) %
d) / and ?
2. ____ searches for a first instance of a pattern in forwarding direction.
a) /
b) %
c) &
d) ?
3. ____ searches for a first instance of a pattern in the backward direction.
a) /
b) %
c) &
d) ?
4. Which command is used for repeating the search in the same direction?
a) n
b) N
c) nn
d) NN
5. Which command is used to reverse the direction of repeating the search?
a) n
b) N
c) nn
d) NN
6. Substitution command is an ex-mode command.
a) True
b) False
7. Which of the following symbol is used for substitution command?
a) n
b) N
c) s
d) S
8. Which of the following is a correct syntax for performing substitution on a file?
a) :address/source_pattern/target_pattern/flag
b) :address/target_pattern source_pattern/flag
c) :address/flag
d) :address
9. We cannot leave the flag field empty while performing the substitution.
a) True
b) False
10. The target pattern is optional.
a) True
b) False
11. Which of the following commands can be used to replace ‘professor’ with ‘director’ throughout the
whole file?
a) 1,$s/professor/director/g
36

b) %s/professor/director/g
c) 1,$s/professor/director
d) 1,$s/professor/director/g and %s/professor/director/g
12. Which of the following flag will be used for interactive substitution?
a) g
b) G
c) gc
d) cg
13. Which one of the following commands will be used to delete all the instances of string ‘manager’ in
file003?
a) 1,$s/manager/ /g
b) %s/manager/director/g
c) 1,$s/professor/director
d) %s/manager/ /
14. Which one of the following command is invalid?
a) /printf
b) ?scanf
c) :%/abd/mash/wc
d) :1,%/file01/file02/g
15. Search and replace operations can also use regular expressions for matching multiple patterns.
a) True
b) False

Shell

1. Shell provides us with an interface to the operating system.


a) True
b) False
2. On a UNIX system, there can be ____ shells running simultaneously.
a) 1
b) 2
c) many
d) 4
3. There can be multiple kernels on a single UNIX system.
a) True
b) False
4. The prompt issued by the shell is called ______
a) prompt
b) command translator
c) command prompt
d) command executor
5. In UNIX there are ___ major types of shells.
a) 2
b) 3
c) 4
d) many
6. What is the default symbol for command prompt in Bourne shell?
a) $
b) %
37

c) #
d) @
7. What is the default symbol for command prompt in C shell?
a) $
b) %
c) #
d) @
8. Which one of the following command will display the name of the shell we are working on?
a) echo shell
b) echo $
c) echo $SHELL
d) echo $$
9. Which shell is the most common and best to use?
a) Korn shell
b) POSIX shell
c) C shell
d) Bash shell
10. Which command does not terminates unless we log out of the system?
a) history
b) shell
c) echo
d) login
11. In Shell’s interpretive cycle, the shell first scans for ____ in the entered command.
a) characters
b) priority
c) meta-characters
d) wildcards
12. Which of the following expression is a correct wildcard pattern if we want an expression in which the
last character is not numeric?
a) *[!0]
b) *[0-9]
c) [0-9]
d) *[!0-9]
13. The shell waits for the command to complete and normally can’t do any work while the command is
executing.
a) True
b) False
14. Which of the following is/are true about Shell?
a) Shell is a multi-faceted program
b) Shell is a command interpreter
c) Shell provides us with an environment to work in
d) Shell is a multi-faceted, command interpreter and provides an environment to work in
15. To change the login shell in some system (like Linux) we can use ____ command.
a) chshell
b) chshl
c) chsh
d) ch
38

1. Wildcards are special characters which are used to replace or represent one or more characters.
a) True
b) False
2. Which of the following is not a wild-card?
a) *
b) ?
c) $
d) %
3. What does the following command do?
$ echo *

a) error
b) undefined behavior
c) displays “*”
d) lists all filenames in the current directory
4. Which command would be most suitable to remove the following files?

dirx diry dirz dirzw


a) rm dir?
b) rm dirx diry dirz dirzw
c) rm *
d) rm dir*
5. Which of the following files will not be deleted using “rm chap??” ?
a) chap01
b) chap02
c) chaptd
d) chactd
6. Which of the following command will list all the hidden filenames in our directory having at least three
characters after the dot (.)?
a) ls
b) ls -a
c) ls .???*
d) ls *
7. * and ? cannot match ____
a) /
b) $
c) .
d) / and .
9. Which of the following files will not be listed using the following command?

ls chap0[1-4]
a) chap02
b) chap05
c) chap01
d) chap04
10. Which of the following symbol is used for negating the character class?
a) .
b) *
c) !
d) %
39

11. Which of the following shell doesn’t support ! symbol for negating the character class?
a) bash
b) bash
c) POSIX
d) C
12. The command cd * will work.
a) True
b) False

1. Providing a backslash (\) before the wild card to remove its special meaning is called _____
a) escaping
b) quoting
c) listing
d) pattern matching
2. Enclosing the wild card or the entire pattern within quotes is called ___
a) escaping
b) quoting
c) listing
d) pattern matching
3. To remove the file named my document.txt, which one of the following commands will be used?
a) rm my\ document.txt
b) rm my document.txt
c) rm *
d) rm my_document.txt
4. We can escape the \ itself using escaping.
a) True
b) False
5. For escaping the newline character we can use ____
a) /
b) \
c) ?
d) \n
6. The output of the following command is ______________

$ echo ‘The special character $ echo hello and | ls chap*’


a) undefined output
b) erroneous
c) hello
d) The special character $ echo hello and | ls chap*
7. Double quotes are more permissive than single quotes and allow the evaluation of the $ and ` itself.
a) True
b) False
8. Which of the following command will remove the file named * ?
a) rm *
b) rm ‘*’
c) rm \*
d) rm ‘*’ and rm \*

Shell script
40

1. What is a shell script?


a) group of commands
b) a file containing special symbols
c) a file containing a series of commands
d) group of functions
2. Shell scripts need to be saved with an extension .sh .
a) True
b) False
3. Shell scripts are executed in a separate child shell process.
a) True
b) False
4. The first line in any shell script begins with a _____
a) &
b) !
c) $
d) #
5. To run the script, we should make it executable first by using _____
a) chmod +x
b) chmod +r
c) chmod +w
d) chmod +rwx
6. To spawn a child of our own choice for running the script, we can use ___ command.
a) ps
b) pr
c) sh
d) $$
7. Which command is used for making the scripts interactive?
a) ip
b) input
c) read
d) write
8. read command is shell’s internal tool.
a) True
b) False
9. A single read statement can be used with one or more variables.
a) True
b) False
10. What are positional parameters?
a) special variables for assigning arguments from the command line
b) pattern matching parameters
c) special variables for reading user input
d) special variables and patterns
11. The first argument is read by the shell into the parameter ___
a) 1$
b) $3
c) $$
d) $1
12. The complete set of positional parameters is stored in ______ as a single string.
a) $n
b) $#
41

c) $*
d) $$
13. Which of the following is used for storing the number of positional parameters?
a) $n
b) $#
c) $*
d) $2

1. Which of the following operators are used for logical execution?


a) ||
b) &&
c) %%
d) && and ||
2. When we use &&, the second command is executed only when first succeeds.
a) True
b) False
3. When we use ||, both the commands are executed.
a) True
b) False
4. The syntax for using && is ______________
a) cmd1 && cmd2
b) cmd1 cmd2 &&
c) cmd1 & cmd2&
d) cmd1
5. To perform decision depending on the fulfillment of certain criteria, ____ is used.
a) if
b) else
c) for
d) if and else
6. Every if is closed with a corresponding ____
a) else
b) fi
c) if
d) else if
7. To check more than two conditions, ___ is used with if-else statements.
a) while
b) for
c) elif
d) for
8. The name of the script is stored in which special parameter?
a) $1
b) $0
c) $#
d) $*
9. Which of the following is not a special parameter used by the shell?
a) $$
b) $*
c) $?
d) $-
42

10. To know the exit status of a command, we can use ____


a) $$
b) $*
c) $?
d) $-

1. test command can be used to check which of the following?


a) Compare two numbers
b) Compare two strings
c) Check attributes of a file
d) All of the mentioned
2. Which of the following operators is used with test for comparison of numeric values?
a) -eq
b) -ne
c) -gg
d) –eq and -ne
3. We can use comparison operators without a ‘-‘.
a) True
b) False
4. ___ implies greater than and ____ implies less than.
a) gt, le
b) gt, lt
c) ge,le
d) ge,lt
5. Which of the following operator is used as a shorthand for test?
a) % %
b) [ ]
c) & &
d) ( )
6. It is essential to use whitespaces when we use [].
a) True
b) False
7. test and [ ] can be used for string comparison.
a) True
b) False
8. Which one of the following option is used for AND operation in test command?
a) -o
b) -a
c) -e
d) -an
9. Which one of the following option is used for OR operation in test command?
a) -o
b) -a
c) -e
d) -an
10. Which one of the following option is used for checking that the string is not null?
a) -a
b) -o
c) -z
d) -n
43

1. Which one of the following option is used for checking that the string is NULL string?
a) -a
b) -o
c) -z
d) -n
2. We can use a test to test various file attributes.
a) True
b) False
3. Which option is used for checking if the file exists or not?
a) -e
b) -a
c) -n
d) -f
4. Which of the following option is used for checking if the file is readable or not?
a) -r
b) -f
c) -n
d) -z
5. Which of the following option is used for checking if the file is writable or not?
a) -e
b) -f
c) -n
d) -w
6. To check if the file exists and is executable we have to use ___ option with test.
a) -e
b) -f
c) -x
d) -w
7. -d option is used for checking if the file exists and is a directory.
a) True
b) False
8. ____ option is used for checking whether a particular file is older than a specified file.
a) -ef
b) -old
c) -nt
d) -ot
9. To check if two files are linked to each other, we can use -ef option.
a) True
b) False

1. ____ statement matches an expression for more than one alternative.


a) for
b) while
c) elif
d) case
2. Every pattern in case statement in terminated with a _____
a) ;
b) :
c) ;;
d) //
44

3. case statement should have a corresponding closing esac.


a) True
b) False
4. The ___ option in case statement matches any option not matched by the previous options.
a) ^
b) $
c) *
d) //
5. case can also be used for matching multiple patterns.
a) True
b) False
6. case can also use wildcards to pattern matching.
a) True
b) False
7. Which command is used for computation and string handling?
a) expr
b) case
c) if
d) read
8. expr can perform ____ arithmetic operations.
a) 2
b) 4
c) 5
d) 3
9. Which of the following is performed by expr string handling’s function?
a) determine the length of string
b) extract a substring
c) locate the position of a character in a string
d) determine the length of string, extract and locate the position of the string
10. The string to be worked upon is placed on the left of the colon when using expr string handling
function.
a) True
b) False
11. Which symbol is used for finding the length of the string?
a) .
b) *
c) .*
d) .*.
12. Which of the following pattern is used for extracting a substring using expr?
a) /( )
b) \(. .\)
c) . .\)
d) \\(
13. For locating the first position of a character in a string we can use expr command.
a) True
b) False
14. expr is a _____ command
a) internal
b) external
45

c) shell
d) derived

1. Which of the following commands let us perform a set of instructions repeatedly?


a) for
b) while
c) until
d) for, while, until
2. Which of the following keywords are used in while loop?
a) do
b) done
c) then
d) do and done
4. Which one of the following is used for looping with a list?
a) while
b) until
c) case
d) for
5. Which of the following loop statements uses do and done keyword?
a) for
b) while
c) case
d) for and while
6. Which command is used for changing filename extensions?
a) chown
b) rename
c) basename
d) rm
7. Which command is used by the shell for manipulating positional parameters?
a) set
b) cut
c) case
d) paste
8. ____ statement is used for shifting arguments left.
a) set
b) shift
c) cut
d) paste
9. Which one of the following is an internal command?
a) cut
b) expr
c) set
d) Is
10. Which symbol is used with the set command for command substitution?
a) –
b) —
c) ??
d) _
11. The ____ allows us to read data from the same file containing the script.
a) >>
46

b) <<
c) !!
d) —
12. Any command using standard input can take the input from here document.
a) True
b) False
13. Which of the following command doesn’t accept a filename as an argument?
a) cut
b) ls
c) paste
d) mailx
14. We can use the here document with interactive programs also.
a) True
b) False
15. ____ command is the appropriate way to interrupt a program.
a) kill
b) SIGKILL
c) INT
d) trap

1. Which of the following option is used with a set for debugging shell scripts?
a) -a
b) -x
c) -d
d) -e
2. Suppose x =10, then what will be the value of x$x$?
a) undefined
b) erroneous
c) 100
d) x10$
3. Given x=10 then,

x$x$ == $x$x.
The given statement is ____
a) True
b) False
4. A shell script stopped running when we change its name. Why?
a) location of the file changed
b) we can’t change the name of the script
c) $0 was used in the script
d) many possible reasons
5. Where is the exit status of a command stored?
a) $0
b) $>
c) $1
d) $?
6. Which of the following is false?
a) here document provides standard input to any script non interactively
b) read command is used for making scripts interactive
47

c) $* stores the number of arguments specified


d) && and || are logical operators
7. test statement cannot ______
a) compare two numbers
b) compare two strings
c) compare two files
d) check a file’s attributes
8. ____ option is used with a test for checking if the file exists and has the size greater than zero.
a) -f
b) -r
c) -e
d) -s
9. Every time shift command is used, the leftmost variable is lost.
a) True
b) False

1. The system administrator is also known as _____


a) master user
b) superuser
c) root user
d) master and super user
2. Which of the following functionalities is carried by the root user?
a) managing disk space
b) performing backup
c) changing attributes of a file
d) managing disk space, performing backup, changing attributes of a file
3. What is the login name of system administrator?
a) root
b) su
c) master
d) admin
4. What is the prompt for system administrator?
a) $
b) %
c) #
d) &
5. When we log in as root user we are placed in ____
a) /bin
b) /root
c) /system
d) /admin
6. The PATH for superuser doesn’t include current directory.
a) True
b) False
7. Which command is used for acquiring superuser status?
a) pu
b) su
c) admn
d) super
48

8. Which of the following is used for creating user’s environment?


a) su
b) su –
c) -su
d) su – –
9. User’s environment mode created using su – is terminated using ____
a) ctrl-v
b) ctrl-q
c) ctrl-d
d) ctrl-f
10. Which command is used by the system administrator to set the date of the system?
a) dt
b) su
c) date
d) chdt
11. ____ command allows superuser to communicate with users.
a) comm
b) cron
c) date
d) wall
12. ____ command is used for setting limits on file size.
a) limit
b) flimit
c) ulimit
d) flim
13. The access to the use of at and batch is restricted and controlled by ___ and ____
a) at.allow, batch.allow
b) at.allow, at.deny
c) at.allow , batch.deny
d) batch. deny, batch.allow
14. If both at.allow and at.deny are not present, only the system administrator can access at and batch
command.
a) True
b) False
15. ____ command is used by the superuser for changing root’s password.
a) pd
b) password
c) pswd
d) pwd

You might also like