Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

Which of the following keys are used to moving the cursor up and down?(a) k(b) h(c) l(d) k and jThe question was posed to me by my school principal while I was bunking the class.Asked question is from Navigation in Vi Editor in chapter The Vi Editor of Unix

Answer»

Right choice is (d) k and J

For EXPLANATION I would SAY: For MOVING the cursor up and down, we can USE ‘k’ and ‘j’ keys respectively.

k– moves the cursor up

j– moves the cursor dow

52.

For navigation purposes, the mode should be _____ mode.(a) command(b) input(c) insert(d) exThe question was posed to me in an international level competition.Question is taken from Navigation in Vi Editor in division The Vi Editor of Unix

Answer»

Right choice is (a) command

To ELABORATE: To EXECUTE NAVIGATION commands, the user should be in command MODE of vi EDITOR.

53.

To recover from a crash, we can use ____ command.(a) :recover(b) -r(c) : x(d) :recover and -rThe question was asked in examination.My question is taken from Vi-Ex Mode topic in section The Vi Editor of Unix

Answer»

The correct option is (d) :RECOVER and -r

To ELABORATE: To recover from a crash, we can USE either the ex-mode command :recover or VI -r filename to recover as much of filename as POSSIBLE.

54.

vi editor stores most of its information in a hidden swap file.(a) True(b) FalseThis question was posed to me in an interview for internship.This intriguing question comes from Vi-Ex Mode in section The Vi Editor of Unix

Answer»

The CORRECT ANSWER is (a) True

The best I can explain: ACCIDENTS can happen while working on a system like a system or power FAILURE. To recover from these kinds of issues vi stores most of its information in a hidden SWAP file. This file is removed on a successful exit from vi but it remains on the disk if there is an improper shutdown or power failure.

55.

To return back to the editor from shell prompt we use _____ command.(a) fg(b) exit(c) back(d) fg and exitThe question was asked during a job interview.My question is taken from Vi-Ex Mode in chapter The Vi Editor of Unix

Answer»

Right OPTION is (d) fg and exit

Explanation: To run to your EDITOR, we can USE either fg command or exit command. It depends on the way we escape to the UNIX shell. If we had escaped using ‘:sh’ then use exit command or ctrl-D to RETURN to the editor and if you had used ctrl-Z then use fg command to return to the editor.

56.

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-ZThe question was posed to me in class test.Origin of the question is Vi-Ex Mode topic in chapter The Vi Editor of Unix

Answer»

Right option is (d) using ‘:sh’ command and using ctrl-Z

Easiest EXPLANATION: We can escape to the shell without quitting the editor using ‘:sh’ command or ctrl-Z. Sometimes it is NECESSARY to RETURN to shell PROMPT to execute a UNIX command or compile our program. For this purpose, we use these commands.

57.

Which of the following is not a valid command?(a) : .,$w file002(b) :w 1,$ file002(c) : .w file002(d) : $w file002I had been asked this question in an online interview.This intriguing question comes from Vi-Ex Mode topic in section The Vi Editor of Unix

Answer»

Right choice is (B) :W 1,$ file002

The explanation: FIRST command will save from current line to the last line, the THIRD command will save current line while the fourth command will save the last line in the file named file002.

58.

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 file002This question was posed to me by my college director while I was bunking the class.My question comes from Vi-Ex Mode topic in portion The Vi Editor of Unix

Answer»

The correct answer is (C) : 4w file002

The best I can explain: To write selected line(s) to another file, we can USE ex-mode COMMAND ‘:w’ along with the line number and FILENAME.

59.

‘:w’ command can be used to write selected lines.(a) True(b) FalseThe question was posed to me during an internship interview.I want to ask this question from Vi-Ex Mode topic in chapter The Vi Editor of Unix

Answer» CORRECT choice is (a) True

The explanation is: Apart from saving our editing, we can use ‘:w’ command for WRITING SELECTED lines. For EXAMPLE,
60.

In ex-mode, last line is represented by ___(a) :(b) $(c) >(d) .I had been asked this question in final exam.Enquiry is from Vi-Ex Mode in section The Vi Editor of Unix

Answer» RIGHT choice is (b) $

For EXPLANATION I would say: To REPRESENT the last line in ex-mode, ‘$’ is used.
61.

In ex-mode, current line is represented by ___(a) :(b) $(c) >(d) .I had been asked this question in an online interview.This intriguing question originated from Vi-Ex Mode topic in chapter The Vi Editor of Unix

Answer»

Correct option is (d) .

To explain: In ex-mode, the current line is represented by a (.) while : is used to invoke the ex-mode commands. The > is a REDIRECTION SYMBOL used for redirecting OUTPUT to a specified file.

62.

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) :wThe question was asked in exam.This interesting question is from Vi-Ex Mode topic in portion The Vi Editor of Unix

Answer»

Right answer is (c) :q!

For explanation I would say: If the buffer has been changed and we STILL want to abandon the CHANGES, then ‘:q!’ is used. It simply ignores all the changes made and quits without DISPLAYING any WARNING QUESTIONS.

63.

Quit (:q) command doesn’t work if the buffer is unsaved.(a) True(b) FalseI had been asked this question in a national level competition.Asked question is from Vi-Ex Mode in portion The Vi Editor of Unix

Answer»

The correct option is (a) True

Best explanation: QUIT COMMAND has a safety MECHANISM that prevents US from aborting if the contents of the BUFFER are modified but not saved.

64.

Which command is used to abort the editing and quit the editing mode?(a) :w(b) :wq(c) :q(d) ‘:x’The question was asked by my college professor while I was bunking the class.I need to ask this question from Vi-Ex Mode in division The Vi Editor of Unix

Answer»

The correct option is (c) :Q

Explanation: It is possible to abort the editing process and quit the editing mode without SAVING the buffer. The quit (:q) command PERFORMS this JOB.

65.

Which one of the following is the best way of saving and quitting the editor?(a) ZZ(b) :wq(c) :w(d) ‘:x’I have been asked this question during an interview for a job.My question is from Vi-Ex Mode topic in portion The Vi Editor of Unix

Answer»

The correct answer is (a) ZZ

The EXPLANATION: The best and preferred way to save and quit the EDITOR is to use ZZ, a command MODE command which is way better then ‘:X’ or :wq.

66.

Which command is used for saving and quitting the editor simultaneously?(a) :q(b) :w(c) ‘:x’(d) :fThis question was addressed to me in semester exam.Question is from Vi-Ex Mode topic in portion The Vi Editor of Unix

Answer»

Right answer is (C) ‘:x’

For EXPLANATION I would SAY: ‘:x’ command SAVES our content and quits the EDITOR simultaneously. This command is invoked in ex-mode.

67.

Which of the following command is a substitute for ‘:x’ command?(a) ‘:x’(b) :wq(c) :q(d) :wI had been asked this question in an internship interview.My query is from Vi-Ex Mode topic in chapter The Vi Editor of Unix

Answer»

The CORRECT answer is (b) :wq

To EXPLAIN I WOULD SAY: We can also use the ‘:wq’ command to save and quit editor but it requires an additional keystroke and it is not recommended for use.

68.

We can specify the filename with ‘:w’ command.(a) True(b) FalseThis question was addressed to me during an interview.I'd like to ask this question from Vi-Ex Mode in section The Vi Editor of Unix

Answer» RIGHT choice is (a) True

Easy explanation: To save our editing to a DIFFERENT file, we can specify the name of the file in which we WANT to save the work. To do this, simply provide the filename as an argument with ‘:W’ command. For example, to save the contents to file named ‘file002’, use the following command:
69.

After pressing ‘:w’, we can normally resume our editing work.(a) True(b) FalseThe question was posed to me during an interview for a job.This interesting question is from Vi-Ex Mode topic in portion The Vi Editor of Unix

Answer»

The CORRECT choice is (a) True

The BEST I can explain: Pressing ‘:W’ doesn’t QUIT the editor but simply saves the editing we’ve done so FAR in the specified file.

70.

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) :aI have been asked this question in semester exam.I'd like to ask this question from Vi-Ex Mode in division The Vi Editor of Unix

Answer»

Correct answer is (a) :W

To elaborate: For saving a file and to remain in editor we can use ‘:w’ command in ex-mode. It is generally considered a GOOD practice to save the contents of buffer regularly while working with FILES using ‘:w’.

71.

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) :fThe question was asked in an internship interview.Query is from Vi-Ex Mode topic in portion The Vi Editor of Unix

Answer»

The CORRECT answer is (b) ‘:X

The EXPLANATION: Pressing ‘:x’ in ex-mode will save the file on the disk and returns the SHELL prompt.

72.

Pressing ‘:’ in command mode invokes which mode of vi editor?(a) ex-mode(b) insert mode(c) command mode(d) input modeThis question was addressed to me in a national level competition.Query is from Vi-Ex Mode topic in chapter The Vi Editor of Unix

Answer»

Correct option is (a) ex-MODE

Explanation: To invoke ex-mode we’ve to PRESS the ‘:’ key in COMMAND mode. After pressing : , we are in ex-mode. Now simply type any command of ex-mode to PERFORM a suitable function.

73.

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) :qThis question was addressed to me in an international level competition.My question is based upon Vi-Input Mode topic in division The Vi Editor of Unix

Answer»

The correct OPTION is (d) :q

The EXPLANATION: All the above commands are used for EITHER APPENDING or replacing except :q which is used in ex-mode to quit from vi editor.

74.

To save the editing performed on a file, we have to switch to ______ mode(a) command(b) input(c) ex(d) insertThe question was asked in my homework.Question is from Vi-Ex Mode topic in portion The Vi Editor of Unix

Answer»

Right choice is (c) ex

The EXPLANATION is: ex-mode allows US a feature in which we can SAVE the editing that we have performed on a FILE. ex-mode also provides us FEATURES like quitting vi editor, substitution etc.

75.

To create a space for entering a new line of text above the current cursor location, ‘O’ command is used.(a) True(b) FalseI got this question in my homework.This intriguing question comes from Vi-Input Mode topic in division The Vi Editor of Unix

Answer»

Correct answer is (a) True

Easy EXPLANATION: ‘O’ command allows us to insert an empty line above the CURRENT cursor location. Hence, to CREATE a space for entering a NEW line of text above the current cursor location, ‘O’ command is USED.

76.

Which command creates a space for entering a new line of text below the current cursor location?(a) o(b) O(c) a(d) SI had been asked this question in examination.Question is from Vi-Input Mode in section The Vi Editor of Unix

Answer»

Right option is (a) o

For explanation I would SAY: ‘o’ command allows US to CREATE a new line for entering the new text below the current cursor LOCATION.

77.

After using ‘s’ or ‘S’, we are automatically left in insert mode.(a) True(b) FalseI have been asked this question by my college professor while I was bunking the class.The question is from Vi-Input Mode topic in portion The Vi Editor of Unix

Answer»

Correct OPTION is (a) True

To explain I WOULD SAY: After REPLACING text with ‘s’ or ‘S’ we are automatically left in insert mode.

78.

To replace 5 characters with new characters, which one of the following will be used?(a) s(b) 5S(c) 5s(d) SI have been asked this question in a national level competition.Enquiry is from Vi-Input Mode in section The Vi Editor of Unix

Answer»

The correct answer is (c) 5S

The explanation is: To REPLACE multiple CHARACTERS, we can use the repeat factor. 5s replaces five characters with NEW text whatever will be entered.

79.

To replace the entire line irrespective of cursor position, we can use ____ command(a) s(b) 10s(c) S(d) 10sThe question was posed to me in an international level competition.The above asked question is from Vi-Input Mode in portion The Vi Editor of Unix

Answer» CORRECT choice is (C) S

Easy explanation: ‘S’ replaces the entire LINE with a STREAM of characters entered irrespective of the current cursor position. The current line is deleted while using ‘S’ command.
80.

Which one of the following command is used to replace a single character with many?(a) s(b) r(c) R(d) SThis question was addressed to me during an online interview.I'd like to ask this question from Vi-Input Mode topic in division The Vi Editor of Unix

Answer»

The CORRECT choice is (a) s

Best explanation: ‘s’ is used to replace a SINGLE character with MANY characters. It replaces a single character based on the current cursor position with a group of characters.

81.

To replace all text on the right of the cursor position, we use ____ command.(a) r(b) R(c) s(d) II had been asked this question in an interview for internship.This question is from Vi-Input Mode in chapter The Vi Editor of Unix

Answer»

Right OPTION is (b) R

The explanation is: The only difference between ‘r’ and ‘R’ is that ‘R’ can replace all text on the right of the cursor POSITION while ‘r’ only REPLACES a single character.

82.

vi automatically switches from command mode to input mode when we press ‘r’.(a) True(b) FalseI had been asked this question in an interview for job.Query is from Vi-Input Mode in section The Vi Editor of Unix

Answer»

Right answer is (a) True

For EXPLANATION: When ‘R’ is pressed, vi momentarily switches from command mode to INPUT mode and returns to command mode AUTOMATICALLY after the new character is entered.

83.

To replace a single character, we use ____ command(a) r(b) R(c) s(d) iI got this question by my college professor while I was bunking the class.The above asked question is from Vi-Input Mode in chapter The Vi Editor of Unix

Answer»

The CORRECT choice is (a) r

For explanation: To replace a SINGLE character based on cursor location, ‘r’ command is USED. To replace a single character, TYPE ‘r’ followed by the character that replaces it. It replaces a single character under the cursor.

84.

Which command will be used to insert text at the beginning of the line?(a) i(b) I(c) a(d) AI had been asked this question in an international level competition.This is a very interesting question from Vi-Input Mode in chapter The Vi Editor of Unix

Answer»

Right answer is (b) I

Explanation: ‘I’ command is USED to INSERT text at the beginning of current line IRRESPECTIVE of the CURSOR POSITION in the current line.

85.

Which command appends text at the end of the current line?(a) A(b) a(c) i(d) IThis question was posed to me in an online interview.This intriguing question comes from Vi-Input Mode topic in portion The Vi Editor of Unix

Answer»

The correct answer is (a) A

For EXPLANATION: To append text at end of CURRENT LINE use ‘A’ COMMAND. It appends the text at line EXTREME.

86.

To append text after the current cursor location, we can use ____ command(a) A(b) a(c) i(d) IThe question was posed to me in an interview for internship.I want to ask this question from Vi-Input Mode in chapter The Vi Editor of Unix

Answer»

Correct answer is (b) a

Easiest EXPLANATION: To append text after the current cursor LOCATION, USE the ‘a’ command. If there is already existing text after the cursor location then it will be simply shifted TOWARDS the right.

87.

Which command is used to insert text before the current cursor location?(a) a(b) A(c) I(d) iThe question was asked in semester exam.The origin of the question is Vi-Input Mode topic in portion The Vi Editor of Unix

Answer»

The correct answer is (d) i

The best I can EXPLAIN: If the ‘i’ command is INVOKED with the cursor positioned on the EXISTING text, text on the right of the cursor will be shifted further right without getting overwritten.

88.

Input mode is used for ____________(a) editing text in files(b) invoking commands on files(c) saving files(d) performing substitutionThis question was posed to me in an international level competition.The question is from Vi-Input Mode topic in chapter The Vi Editor of Unix

Answer»

The correct option is (a) EDITING text in files

Best explanation: To enter text in a file, we have to first SWITCH to INPUT MODE. To enter into input mode, press ‘i’ once. Any key PRESSED after that will appear on the screen as text input.

89.

The “ed” text editor is no longer in use.(a) True(b) FalseI had been asked this question at a job interview.The origin of the question is Vi Basics and Modes in portion The Vi Editor of Unix

Answer» CORRECT OPTION is (b) False

The best I can explain: ‘ed’ TEXT editor is still in use but not that much as compared to vi, because the main reason behind the REPLACEMENT of ‘ed’ was that it can only edit files in current DIRECTORY and cannot execute shell commands.
90.

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 editorsThis question was posed to me in a national level competition.Enquiry is from Vi Basics and Modes topic in section The Vi Editor of Unix

Answer» RIGHT OPTION is (a) available mostly across all UNIX platforms

To explain I would say: vi is a versatile editor which is now STANDARD on all UNIX systems.
91.

The first UNIX editor was ____(a) emacs(b) ex(c) ed(d) viThe question was asked during an interview for a job.I'm obligated to ask this question of Vi Basics and Modes topic in division The Vi Editor of Unix

Answer»

Right choice is (C) ed

Explanation: The FIRST editor that was used in UNIX SYSTEMS was ‘ed’.The main reason behind the replacement of ‘ed’ was that it can only edit FILES in the current DIRECTORY and cannot execute shell commands.

92.

To quit vi editor without saving the buffer we can use(a) :q(b) :c(c) :w(d) :q!This question was posed to me in a national level competition.This intriguing question comes from Vi Basics and Modes in chapter The Vi Editor of Unix

Answer»

Right choice is (d) :Q!

To elaborate: For quitting VI editor, there are NUMEROUS ways available in ex-mode as well as in command mode. One WAY of which is to type ‘:q!’ in ex-mode.

93.

While entering text in input mode the data is saved in _____(a) buffer(b) disk(c) RAM(d) cacheThis question was addressed to me in a job interview.My query is from Vi Basics and Modes topic in portion The Vi Editor of Unix

Answer»

Correct option is (a) buffer

Explanation: If the FILE has not been saved yet then whatever we are inputting in it is stored in a temporary storage called buffer. To save the DATA ENTERED in the buffer, we have to SWITCH to ex-mode.

94.

vi commands are not case sensitive.(a) True(b) FalseI have been asked this question in final exam.Question is from Vi Basics and Modes in section The Vi Editor of Unix

Answer»

The correct option is (b) False

For EXPLANATION: VI commands are case-sensitive. For EXAMPLE, ‘a’ and ‘A’ are DIFFERENT commands.

95.

To clear the screen in vi editor, _____ is used.(a) ctrl-h(b) ctrl-l(c) ctrl-p(d) ctrl-vThe question was asked in examination.My enquiry is from Vi Basics and Modes in section The Vi Editor of Unix

Answer»

Right ANSWER is (B) ctrl-l

The EXPLANATION is: If the SCREEN gets garbled due to some reasons, we can USE ctrl-l in command mode to wipe out. It will simply clear your terminal.

96.

Commands inputted in command mode don’t appear on the terminal.(a) True(b) FalseI got this question during an internship interview.Query is from Vi Basics and Modes in section The Vi Editor of Unix

Answer»

Right option is (a) True

To explain I would say: Command mode is the mode in which we can pass commands to act on text, using most of the keys of the keyboard. Pressing a KEY doesn’t show it on screen but may perform a function LIKE moving the cursor to the next LINE, deleting a line etc.

97.

ex-mode is used to save our work.(a) True(b) FalseI got this question in a job interview.I'd like to ask this question from Vi Basics and Modes in section The Vi Editor of Unix

Answer»

The correct option is (a) True

For explanation: ONE of the major functions performed in ex-mode is, saving our work. For EXAMPLE, to save our FILE invoke the following command :

98.

Which of the following key is used to enter in ex-mode?(a) ESC(b) i(c) :(d) ;I had been asked this question in exam.Question is taken from Vi Basics and Modes in chapter The Vi Editor of Unix

Answer» RIGHT answer is (c) :

Explanation: To ENTER into ex-mode PRESS the ‘:’ key. After that, we can press any ex-mode COMMAND followed by [Enter] to PERFORM suitable operations.
99.

____ key is used for switching to command mode from input mode.(a) i(b) A(c) :(d) escThe question was posed to me in exam.This interesting question is from Vi Basics and Modes topic in division The Vi Editor of Unix

Answer»

The CORRECT answer is (d) esc

Explanation: Command mode allows US to enter commands for performing operations on the TEXT entered. To switch from the input mode to command mode press the ‘esc’ key. This OPERATION will not be displayed on the screen but changes our mode to command mode.

100.

Which one of the following key is used to switch from command mode to input mode?(a) i(b) :(c) esc(d) ;This question was addressed to me in an online quiz.The doubt is from Vi Basics and Modes topic in portion The Vi Editor of Unix

Answer»

The correct option is (a) i

To explain I WOULD say: To SWITCH from COMMAND mode to input mode press the ‘i’ KEY.