Top Rated Linux Editors Interview Questions
Q – 1 Which vi editor command copies the current line of the file?
a) yy
b) yw
c) yc
d) none of the mentioned
Ans- a) yy
Q – 2 Which command is used to close the vi editor?
a) q
b) wq
c) both (a) and (b)
d) none of the mentioned
Ans- c) both (a) and (b)
Q – 3 Which command is used to delete the character before the cursor location in vi editor?
a) X
b) x
c) D
d) d
Ans- a) X
Q – 4 Which one of the following statement is not true?
a) vim editor is the improved version of vi editor
b) vi editor commands are not case sensitive
c) vi editor has two modes of operation: command mode and insert mode
d) vi stands for visual editor
Ans- b) vi editor commands are not case sensitive
Q – 5 In vi editor, the key combination CTRL+f:
a) moves screen down one page
b) moves screen up one page
c) moves screen up one line
d) moves screen down one line
Ans- a) moves screen down one page
Q – 6 Which one of the following statement is true?
a) autoindentation is not possible in vi editor
b) autoindentation can be set using the command ‘:set ai’
c) autoindentation can be set using the command ‘:set noai’
d) autoindentation is set by default in vi editor
Ans- b) autoindentation can be set using the command ‘:set ai’
Q – 7 Which command searches the string in file opened in vi editor?
a) / or ?
b) f or F
c) t or T
d) none of the mentioned
Ans- a) / or ?
Q – 8 In vi editor, which command reads the content of another file?
a) read
b) r
c) ex
d) none of the mentioned
Ans- c) ex
Q – 9 Which command shows all the abbreviations in vi editor?
a) ab
b) abb
c) show
d) none of the mentioned
Ans- a) ab
Q – 10 Which command sets the number for all lines?
a) :set li
b) :set ln
c) :set nu
d) :set nl
Ans- c) :set nu
Q – 11 Which is the correct syntax for sed on command line?
a) sed [options] ‘[command]’ [filename]
b) sed ‘[command]’ [options] [filename]
c) sed [filename] [options] ‘[command]’
d) sed ‘[command]’ [filename] [options]
Ans- a) sed [options] ‘[command]’ [filename]
Q – 12 If any sed command does not specify any address then the command is applied to:
a) each input line
b) none of the input line
c) last input line
d) none of the mentioned
Ans- a) each input line
Q – 13 What is sed?
a) a non-interactive stream editor
b) an IDE
c) a hex editor
d) none of the mentioned
Ans- a) a non-interactive stream editor
Q – 14 Sed maintains the hold space (a buffer) to:
a) copy the each line of input
b) save the data for later retrieval
c) both (a) and (b)
d) none of the mentioned
Ans- b) save the data for later retrieval
Q – 15 If no file is specified in sed command then:
a) sed command will not work
b) sed reads from standard input
c) sed reads the data already present in buffer
d) it is necessary to provide the filename
Ans- b) sed reads from standard input
Q – 16 Which sed command deletes the specified address range:
a) [address range]/s
b) [address range]/p
c) [address range]/d
d) [address range]/y
Ans- c) [address range]/d
Q – 17 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’?
a) sed ‘s/cat/mouce/g’ old.txt > new.txt
b) sed ‘s/cat/mouse’ old.txt new.txt
c) sed ‘/s/cat/mouse/g’ old.txt new.txt
d) sed ‘/s/cat/mouse’ old.txt > new.txt
Ans- a) sed ‘s/cat/mouce/g’ old.txt > new.txt
Q – 18 Which command will delete all the blank lines in file old.txt?
a) sed ‘/d’ old.txt
b) sed ‘/^/d’ old.txt
c) sed ‘/^$/d’ old.txt
d) sed ‘/^*/d’ old.txt
Ans- c) sed ‘/^$/d’ old.txt
Q – 19 The command “sed -n ‘/google/p’ old.txt” will:
a) print the lines containing the word ‘google’ in file old.txt
b) delete the lines containing the word ‘google’ in file old.txt
c) will generate an error message
d) none of the mentioned
Ans- a) print the lines containing the word ‘google’ in file old.txt
Q – 20 Which option is used by sed to specify that the following string is an instruction or set of instructions?
a) -n
b) -e
c) -f
d) -i
Ans- a) -n