Linux Questions & Answers – vi Editor

This set of Linux / Unix questions and answers focuses on VI Editor.

1. 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
View Answer

Answer: b
Explanation: None.

2. Which command is used to close the vi editor?
a) q
b) wq
c) both q and wq
d) none of the mentioned
View Answer

Answer: c
Explanation: The command ‘q’ just closes the file and ‘wq’ saves and closes the file.

3. 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
View Answer

Answer: a
Explanation: None.

4. Which vi editor command copies the current line of the file?
a) yy
b) yw
c) yc
d) none of the mentioned
View Answer

Answer: a
Explanation: The command ‘p’ puts the copied text after the cursor.
advertisement
advertisement

5. Which command is used to delete the character before the cursor location in vi editor?
a) X
b) x
c) D
d) d
View Answer

Answer: a
Explanation: The command ‘x’ is used to delete the character under the cursor locarion.

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
View Answer

Answer: b
Explanation: None.

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
View Answer

Answer: a
Explanation: The command ‘/’ searches downward in the file and command ‘?’ searches upward in the file.

8. In vi editor, which command reads the content of another file?
a) read
b) r
c) ex
d) none of the mentioned
View Answer

Answer: c
Explanation: None.
advertisement

9. Which command shows all the abbreviations in vi editor?
a) ab
b) abb
c) show
d) none of the mentioned
View Answer

Answer: a
Explanation: None.

10. Which command sets the number for all lines?
a) :set li
b) :set ln
c) :set nu
d) :set nl
View Answer

Answer: c
Explanation: None.
advertisement

Sanfoundry Global Education & Learning Series – Linux Administration & Programming.

Here’s the list of Best Books in Linux Commands & Shell Programming.
Here’s the list of Best Books in Linux Kernel, Device-Drivers & System Programming.

To practice all questions on Linux Administration & Programming, here is complete set of 1000+ Multiple Choice Questions and Answers on Linux.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.