Unix Questions and Answers – Vi Basics and Modes – 2

This set of Unix Interview Questions and Answers for Experienced people focuses on “Vi Basics and Modes – 2”.

1. ex-mode is used to save our work.
a) True
b) False
View Answer

Answer: a
Explanation: One of the major functions performed in ex-mode is, saving our work. For example, to save our file invoke the following command :

:w [Enter]
"file001", 10 lines, 456 characters

advertisement
advertisement

2. Commands inputted in command mode don’t appear on the terminal.
a) True
b) False
View Answer

Answer: a
Explanation: 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.

3. To clear the screen in vi editor, _____ is used.
a) ctrl-h
b) ctrl-l
c) ctrl-p
d) ctrl-v
View Answer

Answer: b
Explanation: 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.
Note: Join free Sanfoundry classes at Telegram or Youtube

4. vi commands are not case sensitive.
a) True
b) False
View Answer

Answer: b
Explanation: vi commands are case-sensitive. For example, ‘a’ and ‘A’ are different commands.

5. While entering text in input mode the data is saved in _____
a) buffer
b) disk
c) RAM
d) cache
View Answer

Answer: a
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.
advertisement

6. To quit vi editor without saving the buffer we can use
a) :q
b) :c
c) :w
d) :q!
View Answer

Answer: d
Explanation: 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.

7. The first UNIX editor was ____
a) emacs
b) ex
c) ed
d) vi
View Answer

Answer: c
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.
advertisement

8. 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 editors
View Answer

Answer: a
Explanation: vi is a versatile editor which is now standard on all UNIX systems.

9. The “ed” text editor is no longer in use.
a) True
b) False
View Answer

Answer: b
Explanation: ‘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.

Sanfoundry Global Education & Learning Series – Unix.

To practice all areas of Unix for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.

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.