
40 most important UNIX mcq question and answers are listed below. Practicing those can help you to crack unix mcq online test, unix mcq tcs xplore & other exams.
1. Which of the following is not a UNIX shell
bash
wash
ksh
csh
wash
Q. 2. Which of the following is not a bash shell feature?
command line editing
command history navigation
Command separation
None of these
Command separation
Q. 3. Which shell command enables editing commands in vi mode?
set -o vi
set +o vi
enable -vi
enable +vi
set -o vi
Q. 4. Which shell programming construct would be best for writing a menu driven shell script?
case
if
test
for
case
Q. 5. Which special parameter used to store all the arguments passed to a shell script as a single string in a variable?
“$0”
“$@“
“$#”
“$*”
“$*”
Q. 6. Which bash command is used to create shortcut names for long commands?
alias
short
bit.ly
ln
alias
Q. 7. Which of the following is a valid user-defined shell variable?
%age
_var
#tag
.hidden
_var
Q. 8. Which of the following is not a feature of any UNIX shell?
Programming constructs
command history navigation
command line editing
compilation
compilation
Q. 9. Which pair of characters would one use to store the output of a command into a shell variable?
Pair of single quotes
Pair of back ticks
Pair of double quotes
Pair of square brackets
Pair of back ticks
Q. 10. Which shell keyword used for skiping subsequent commands in a loop and move to the next iteration?
continue
break
goto
done
continue
Q. 11. Which metacharacter should be used to create a default label in case construct?
*
d*
$
$*
*
Q. 12. What is the first line in a well written Bash Shell Script?
#!/usr/bin/bash
# Filename :
#bash
#Shell script
#!/usr/bin/bash i.e. The bash interpreter line
Q. 13. Which of the following is not a Shell keyword
fi
esac
od
elif
od
Q. 14. Which environment variable contains the name of the shell that I am using in UNIX?
$shell
$SHELL
$Shell
$SHLL
$SHELL
Q. 15. Which command is used to remove the values stored in a shell variable?
rm
unset
rmdir
mv
unset
Q. 16. What are the first 2 characters of the first line of every shell script?
#!
!#
!!
##
#!
Q. 17. Which positional parameter contains the name of the shell script?
$0
$NAME
$SHELL
$#
$0
Q. 18. What symbol should I use to check if two strings are equal?
-eq
==
=
!=
==
Q. 19. Which of the following is not a valid keyword to be used for an if block in shell scripting?
else
done
then
fi
done
Q. 20. Which of the following is an invalid keyword for a “while” loop construct in shell programming?
continue
in
break
do
in
Q. 1. Which command would you use to find a file that contains your name?
vi
find
cat
grep
grep
Q. 2. Which redirection operator syntax should I use to safely redirect both stderr and stdout to the same file?
1>2
2>1
2>&1
1&&2
2>&1
Q. 3. What happens if I first redirect stdout to a file and then redirect stderr to the same file?
File only contains output of stdout
File is lost
File is overwritten by output of stdout
File is overwritten by output of stderr
File is overwritten by output of stderr
Q. 4. Which option of grep should I use to print only the names of files that contain a pattern I am interested in?
-o
-n
-v
-l
-l
Q. 5. Which regular expression matches all lines that end with s
s$
^s
s.
s*
s$
Q. 6. Which regular expression represents an empty line?
“ “
“^$”
“\n”
[:blank:]
“^$”
Q. 7. Which UNIX operator can I use to over write a file?
Input Redirection Operator
Append Operator
Redirection Operator
Minus Operator
Redirection Operator
Q. 8. What does the character class [:alpha:] represent?
All characters
All numbers
All alphabets and numbers
All ASCII alphabets
All ASCII alphabets
Q. 9. Which feature of UNIX helps in storing the output of a command for future reference?
Pipes
Multi tasking
Redirection
Filters
Redirection
Q. 10. Which UNIX command should I use to search for all java files in my Projects directory?
find -name “*.java” Projects
find -name “*.java”
find Projects -name “*.java”
find Projects “*.java”
find Projects -name “*.java”
Q. 11. What does the Regular Expression “[^a]b.” not match?
dba
bbc
cba
abc
abc
Q. 1. Which of the following is not a standard UNIX editor?
edx
vim
emacs
ed
edx
Q. 2. How many operations can you undo in vi editor?
zero
one
two
almost unlimited
almost unlimited
Q. 3. What command should I use to display line numbers for a file in vi editor?
:set display
:set linenu
:set nu
:set 1234
:set nu
Q. 4. Which key in vi editor will take me to Normal mode?
Esc
i
a
o
Esc
unix mcq questions and answers, unix mcq questions tcs, unix mcq questions, mcq on unix operating system, unix mcq tcs xplore, unix mcq questions tcs xplore, unix mcq questions, unix mcq, unix mcq questions tcs opa, unix mcq pdf, unix operating system mcq, unix operating system mcq questions and answers, unix interview questions, vi editor mcq, unix mcq questions tcs,