Home
MCQS
Unix/Lunux MCQ Quiz Hub
Linux Mcqs Questions Set 6
Choose a topic to test your knowledge and improve your Unix/Lunux skills
1. Which command executes ‘command’ in place of the current process instead of creating a new process?
exec
command
trap
none of the mentioned
2. Which one of the following statement is not true?
vim editor is the improved version of vi editor
vi editor commands are not case sensitive
vi editor has two modes of operation: command mode and insert mode
vi stands for visual editor
3. Which command is used to close the vi editor?
q
wq
both q and wq
none of the mentioned
4. In vi editor, the key combination CTRL+f
moves screen down one page
moves screen up one page
moves screen up one line
moves screen down one line
5. Which vi editor command copies the current line of the file?
yy
yw
yc
none of the mentioned
6. Which command is used to delete the character before the cursor location in vi editor?
X
X
D
d
7. Which one of the following statement is true?
autoindentation is not possible in vi editor
autoindentation can be set using the command ‘:set ai’
autoindentation can be set using the command ‘:set noai’
autoindentation is set by default in vi editor
8. Which command searches the string in file opened in vi editor?
/ or ?
f or F
t or T
none of the mentioned
9. In vi editor, which command reads the content of another file?
read
r
ex
none of the mentioned
10. Which command shows all the abbreviations in vi editor?
ab
abb
show
none of the mentioned
11. Which command sets the number for all lines?
:set li
:set ln
:set nu
:set nl
12. What is sed?
a non-interactive stream editor
an IDE
a hex editor
none of the mentioned
13. Sed maintains the hold space (a buffer) to
copy the each line of input
save the data for later retrieval
copy the each line of input & save the data for later retrieval
none of the mentioned
14. Which is the correct syntax for sed on command line?
sed [options] ‘[command]’ [filename].
sed ‘[command]’ [options] [filename].
sed [filename] [options] ‘[command]’
sed ‘[command]’ [filename] [options].
15. If any sed command does not specify any address then the command is applied to
each input line
none of the input line
last input line
none of the mentioned
16. If no file is specified in sed command then
sed command will not work
sed reads from standard input
sed reads the data already present in buffer
it is necessary to provide the filename
17. Which sed command deletes the specified address range
[address range]/s
[address range]/p
[address range]/d
[address range]/y
18. Which command is used to replace word ‘cat’ (already present in the file) with ‘mouse’ at all places in a file ‘old.txt’ and save the result in a new file ‘new.txt’?
sed ‘s/cat/mouce/g’ old.txt > new.txt
sed ‘s/cat/mouse’ old.txt new.txt
sed ‘/s/cat/mouse/g’ old.txt new.txt
sed ‘/s/cat/mouse’ old.txt > new.txt
19. Which command will delete all the blank lines in file old.txt?
sed ‘/d’ old.txt
sed ‘/^/d’ old.txt
sed ‘/^$/d’ old.txt
sed ‘/^*/d’ old.txt
20. The command “sed -n ‘/sanfoundry/p’ old.txt” will
print the lines containing the word ‘sanfoundry’ in file old.txt
delete the lines containing the word ‘sanfoundry’ in file old.txt
will generate an error message
none of the mentioned
21. Which option is used by sed to specify that the following string is an instruction or set of instructions?
-n
-e
-f
-i
22. Which one of the following is not true?
nawk is the new version of awk
gawk is the GNU version of awk
linux users have the gawk
nawk does not provide the additional capabilities in comparison of awk
23. An awk program can be run by
including the program in the command that runs awk
putting it into a file and run with a command
running an executable awk script
all of the mentioned
24. Which one of the following is not true?
in typical awk program, all input is read either from standard input or specified files
awk language divides its input into records and fields
running an executable awk script
the number of fields need to be a constant
25. What is the meaning of $ sign in awk programming?
the word following is the name of variable
we are refering to a field or column in the current line
$ sign is used for comment
none of the mentioned
26. In awk program, the statement “print” with no items
is equivalent to “print $0”
prints the entire current record
is equivalent to “print $0” & prints the entire current record
none of the mentioned
27. The print and printf statements can be told to send their output to other place except standard output, is called
redirection
redistribution
reinsertion
none of the mentioned
28. The command “awk {print $1} san.txt” will
print the first line of file san.txt
print the first field of every line in san.txt
generate syntax error
none of the mentioned
29. What is the output of the command awk ‘BEGIN {printf “%c ”,65}’
A
65
syntax error
none of the mentioned
30. Which one of the following statement is not true about the format-control letters for printf statement in awk program?
c prints a number as an ASCII character
d prints a decimal integer
h prints an unsigned hexadecimal integer
o prints an unsigned octal integer
31. What is expression in awk programming?
expression evaluates a value to print, test or pass to a function
expression assigns a new value to a variable or field
expression evaluates a value to print, test or pass to a function & also assigns a new value to a variable or field
none of the mentioned
32. Which one of the following is not true?
there are 3 types of constant expressions: numeric, string and regular
arithmetic operators are used to evaluate expressions
assignment expression is an expression that stores a value into a variable
comparison expressions does not compare strings for relationship
33. All numeric values are represented within awk in
double precision floating point
integer
exponential notation
fixed point
34. Concatenation is performed by
writing expressions next to one another, with no operator
conditional operator
relational operator
matching operator
35. The comparison expression x ~ y will true if
x is not equal to y
the string x does not match the regular expression denoted by y
the string x matches the regular expression denoted by y
none of the mentioned
36. The break statement
jumps out of the innermost for loop
jumps out of the innermost while loop
jumps out of the innermost do-while loop
all of the mentioned
37. Which statement skips over the rest of the loop body, causing the next cycle around the loop to begin immediately?
continue
break
next
none of the mentioned
38. The next statement
immediately stops processing the current record
go to the next record
immediately stops processing the current record & go to the next record
none of the mentioned
39. If the argument is supplied to the exit statement,
its value is used as the exit status code for the awk process
syntax error will generate
exit returns status 0
exit returns status 1
40. Which statement instructs gawk to stop processing the current data file?
next
nextfile
exit
exitfile
41. The command awk {if (“9″>”10”) print sanfoundry else print linux}
will print sanfoundry
will print linux
will generate syntax error
none of the mentioned
42. Which one of the following statement is not true?
awk’s built-in functions can be categorised into three categories: numeric, string and I/O
built-in functions are always available to call
extra arguments to built-in function causes syntax error
we can also define the function in awk program
43. What is the difference between the built-in functions rand() and srand() in awk programming?
rand() generates the random number but srand() does not generate the random number
rand() generates the same random number always whenever the program runs but srand() generates the different
srand() requires the seed() function but rand() does not require to produce the same result
none of the mentioned
44. Which built-in function returns the arctangent of a/b in radians.
atan2(a/b)
atan(a/b)
atan_2(a/b)
none of the mentioned
45. Which built-in function divides string into pieces seperated by fieldsep and stores the pieces in array?
split()
divide()
index()
sub()
46. The built-in function tolower()
converts all lowercase characters into uppercase characters
returns the string with all lowercase characters
changes the nonalphabetic characters
none of the mentioned
47. In awk, the built-in variable FS is
input field seperator
output field seperator
record seperator
subscript seperator
48. What is FNR?
FNR is the current record number in the current file
FNR is the number of fields in the current input record
FNR is an array contains the value of environment
None of the mentioned
49. RSTART is set by invoking the
match function
index function
asort function
split function
50. Which one of the following is used by awk to control the conversion of numbers to string?
RS
OFMT
SUBSEP
RSTART
Submit