This set of Unix Questions and Answers for Aptitude test focuses on “Navigation in Vi Editor – 2”.
1. We can prefix repeat factor with word navigation commands.
Explanation: We can prefix repeat factor with word navigation commands for ease of navigation. For example, 5w takes the cursor 5 words forward while 5b takes the cursor 5 words backwards.
2. Which command is used for moving the cursor to the line extreme?
a) |, 0
Explanation: For moving the cursor to the beginning or end of the line we can use line extreme navigation commands (0,| and $). ‘|’ or ‘0’ moves the cursor to the first character of a line.
3. ____ command moves the cursor to the end of next line.
Explanation: ‘$’ command is used to navigate the cursor to the end of next line. This symbol is also used in ex-mode to represent the last line.
4. Which of the following commands will move the cursor to the end of line number 30 if the current position of the cursor is line number 01?
Explanation: We can prefix the repeat factor while working with line extreme navigation commands.
5. Which of the following control keys will be used for scrolling one page forward?
Explanation: Faster navigation can be achieved in vi using control keys for scrolling text in the window page by page. Ctrl-b scrolls one page backwards.
6. We can scroll halve page using control keys.
Explanation: To scroll half a page we can use control keys like ctrl-d and ctrl-u.
Ctrl-d - scrolls half page forward Ctrl-u - scrolls Half page backwards
7. To navigate 20 pages forward, we can use ______ command.
a) 20 ctrl-b
b) 20 ctrl-d
c) 20 ctrl-u
d) 20 ctrl-f
Explanation: To navigate through 20 pages simultaneously we can prefix the repeat factor with control keys.
8. Which command is used to know the current line number?
Explanation: At any time, to know the current line number we can use ctrl-g.
9. Which key is used for absolute movement?
Explanation: For absolute movement, we can use the ‘G’ command along with the prefix factor to locate offending lines. For example,
42G // goes to line number 40 1G // goes to line number 1 G // goes to end of file
10. Which of the following commands of ex-mode is equivalent to ‘G’ command in command mode?
a) : .
b) : $
c) : %
Explanation: ex-mode offers equivalent commands for moving between lines. ‘G’ command moves the cursor to end of the file which can also be achieved using ‘: $’ command in ex-mode.
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix for Aptitude test, here is complete set of 1000+ Multiple Choice Questions and Answers.