Unix Multiple Choice Questions on “Navigation in Vi Editor”.
1. For navigation purposes, the mode should be _____ mode.
a) command
b) input
c) insert
d) ex
Answer: a
Clarification: 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
Answer: d
Clarification: 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
Answer: b
Clarification: For moving the cursor towards left, we can use ‘h’ key.
4. Which one of the following keys are used to moving cursor rightwards along a line?
a) k
b) h
c) l
d) j
Answer: c
Clarification: 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
Answer: a
Clarification: 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
Answer: d
Clarification: 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
Answer: a
Clarification: 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).
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
Answer: a
Clarification: 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
Answer: b
Clarification: 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.
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
Answer: c
Clarification: 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.
