Unix Questions and Answers – Navigation in Vi Editor – 1

This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Navigation in Vi Editor – 1”.

1. For navigation purposes, the mode should be _____ mode.
a) command
b) input
c) insert
d) ex
View Answer

Answer: a
Explanation: To execute navigation commands, the user should be in command mode of vi editor.

2. Which of the following keys are used to moving the cursor up and down?
a) k
b) h
c) l
d) k and j
View Answer

Answer: d
Explanation: For moving the cursor up and down, we can use ‘k’ and ‘j’ keys respectively.
k – moves the cursor up
j – moves the cursor down

3. Which of the following keys is used to moving cursor leftwards along a line?
a) k
b) h
c) l
d) j
View Answer

Answer: b
Explanation: For moving the cursor towards left, we can use ‘h’ key.
advertisement
advertisement

4. Which one of the following keys are used to moving cursor rightwards along a line?
a) k
b) h
c) l
d) j
View Answer

Answer: c
Explanation: For moving the cursor towards the right, we can use ‘l’ key.

5. We can prefix the repeat factor with navigation keys (h, j, k and l).
a) True
b) False
View Answer

Answer: a
Explanation: The repeat factor can be used as a command prefix with all these four commands. For example, to move 20 characters to the right, we can use ’20l’.

6. Which one of the following command is invalid?
a) 20h
b) 5l
c) 4k
d) 3d
View Answer

Answer: d
Explanation: All the above commands except 3d are navigation commands with prefixed repeat factor.

7. We can perform word navigation in vi editor.
a) True
b) False
View Answer

Answer: a
Explanation: Moving character by character is not always enough so we can perform navigation word by word by using word navigation commands (b, e and w).
advertisement

8. Using ‘b’ command we can _____________
a) move back to the beginning of the word
b) move forward to the end of the word
c) move forward to the beginning of the word
d) move back to the end of the word
View Answer

Answer: a
Explanation: We can use ‘b’ command to move back to the beginning of the word. To do so, simply press ‘b’ once for performing navigation a single time.

9. Using ‘e’ command we can _____________
a) move back to the beginning of the word
b) move forward to the end of the word
c) move forward to the beginning of the word
d) move back to the end of the word
View Answer

Answer: b
Explanation: We can use ‘e’ command to move forward to the end of the word. To do so, simply press ‘e’ once for performing navigation a single time.
advertisement

10. Using ‘w’ command we can _____________
a) move back to the beginning of the word
b) move forward to the end of the word
c) move forward to the beginning of the word
d) move back to the end of the word
View Answer

Answer: c
Explanation: We can use ‘w’ command to move forward to the beginning of the word. To do so, simply press ‘w’ once for performing navigation a single time.

Sanfoundry Global Education & Learning Series – Unix.

To practice all areas of Unix, 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.