R4RIN
Articles
Java 8
MCQS
Unix/Lunux MCQ Quiz Hub
Linux Mcqs Questions Set 5
Choose a topic to test your knowledge and improve your Unix/Lunux skills
1. How do you remove duplicate lines from the file foo using uniq?
sort foo | uniq –u
sort -u foo | uniq -d
sort foo | uniq –c
sort foo | uniq –I
2. What is the command that can print lines of first file matching with second file?
printline
cmp
com
comm
3. Which character to use to escape meaning of special characters in search operations?
[].
^
.'
4. When the return value of any function is not specified within the function, what function returns?
nothing
exit status of the last command executed
0
none of the mentioned
5. Parameters can be passed to a function
by using the parameter variables $1, $2, $3…….
by using the environment variables
by using the parameter & environment variables
none of the mentioned
6. Which of the following command provides the list of the functions defined in the login session?
declare -f
declare -F
both declare -f and -F
none of the mentioned
7. The keyword local is used
to define a variable within a function for its local scope
to redefine any global variable
this is not a valid keyword
none of the mentioned
8. Functions improves the shells programmability significantly, because
when we invoke a function, it is already in the shells memory, therefore a function runs faster than seperate scripts
function will not provides a piece of code for repetative tasks
all of the mentioned
none of the mentioned
9. In the shell, by default, all variables are considered and stored as
string
integer
character
float
10. Which command reads user input from the terminal and assign this value to a variable name?
read
get
declare
set
11. Which one of the following statement is true about variables in shell?
variables do not require declaration before assigning value to them
variables are case sensitive
to extract the contents of a variable, we have to provide the variable a preceding $
all of the mentioned
12. Which one of the following is not a valid shell variable?
_san
san_2
_san_2
2_san
13. To redefine a variable, it can be removed from the list of variables by using the command
unset
delete
remove
clear
14. Which built-in command performs integer arithmetic in bash shell?
let
get
set
none of the mentioned
15. Which expression use the value of the enclosed arithmetic expression?
$(())
$()
${}
$[].
16. If a and b are 2 variables then the meaning of a<<=b is
b = a &lt;&lt; b
a = a &lt;&lt; b
b = b &lt;&lt; a
a = a &lt;&lt; b
17. Which one of the following is bitwise exclusive or operator?
^=
|=
!=
none of the mentioned
18. Which one of the following is not a valid operator in bash shell?
||
~
=&lt;&lt;
-=
19. This set of Linux / Unix questions and answers focuses on Command History and Job Control in Bash Shell programming fc stands for
find command
fix command
both find &amp; fix command
none of the mentioned
20. Which command is used to reexecute the previous command?
!!
!cat
!3
!$
21. Which one of the following is not correct about job control in bash shell?
it is the ability to stop and resume any process running in shell at a later point
user employs this facility via an interactive interface supplied by the kernels terminal driver and bash
it is the ability to create any process
none of the mentioned
22. Which command allows to view the current jobs being handled by the shell?
jobs
view
show
none of the mentioned
23. What is job number?
same as PID
a unique number, assigned to each job in shell
same as PID and a unique number, assigned to each job in shell
none of the mentioned
24. Ctrl-Z key combination
generates a SIGINT signal
stops the process running in the shell
kills the process running in the shell
generates a SIGINT signal &amp; kills the process running in the shell
25. Which command brings a background job into the foreground?
fg
bg
jobs %1
none of the mentioned
26. kill %s command will
terminate the job whose command line starts with s
terminate the last job
terminate the first job
none of the mentioned
27. stty tostop command will
stop all jobs running in the shell
stop background jobs if they try to send output to the terminal
this is not a valid command
none of the mentioned
28. Which command terminates a running process by name of the process?
kill
pkill
killall
none of the mentioned
29. Which command sets up shorthand for command or command line?
set
alias
new
echo
30. What is the function of bind command in bash shell?
defining new macros
defining new key bindings for existing commands
dumping the installed key bindings
all of the mentioned
31. The command ‘compgen -c’ shows
all variable names
all system wide aliases
full list of all commands
none of the mentioned
32. Which statement resumes the next iteration of a for, while, select, or untill loop?
continue
break
complete
command
33. Which command prints the directory stack?
cd
dirs
popd
pushd
34. The command ‘disown -r’
removes all jobs
removes all running jobs
marks jobs to not receive SIGHUP when bash exits
marks all jobs
35. The command ‘enable -n ‘
enables the specified built-in command
disables the specified built-in command
print the status of the command
none of the mentioned
36. Which command can create environment variable?
export
set
read
none of the mentioned
37. Which command concatenate the specified argument into a single command, then execute the command?
fc
eval
exec
getopts
38. The command hash
manages a internal hash table
find and remember the full path name of the specified command
displays used command names and the number of hits
all of the mentioned
39. The ‘logout’ built in command is used to
shutdown the computer
logoff of the computer
logout the current user
to exit the current shell
40. The command umask -S
prints the current mask using symbolic notation
prints the current mask using octal numbers
sets the mask to 000
sets the mask to 777
41. The mapfile command
reads lines of standard input and assigns each to the element of an indexed array
reads lines of standard output file
reads lines of standard error file
none of the mentioned
42. Which option of the kill command sends the given signal name to the specified process?
-l
-n
-s
-a
43. Which command removes a directory from directory stack?
dirs
popd
pushd
rm
44. Which command puts a script to sleep untill a signal is recieved?
sleep
suspend
disown
break
45. The command ulimit
set a limit on specified resource for system users
set/show process resource limit
set a limit on specified resource for system users &amp; set/show process resource limit
none of the mentioned
46. Which command identifies the resource of a command?
type
typeset
select
source
47. Which command wait for the specified process to complete and return the exit status?
sleep
wait
delay
stop
48. Which command prints the accumulated user and system times for processes run from the shell?
time
times
both time and times
none of the mentioned
49. Which command runs the shell built-in command command with the given argument?
builtin
caller
there is no command present for this purpose
none of the mentioned
50. Which option of the command cd use the actual filesystem path for cd.. and the value of pwd?
-l
-L
-p
-P
Submit