This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Customizing Vi Editor”.
1. For searching a character, ___ and ___ are used.
a) f, t
b) n, w
c) e, d
d) k, n
Explanation: For searching a character, we can take the cursor near or to a specific character in the current line. This is done with f and t commands.
2. For moving the cursor forward to the first occurrence of a character, __ is used.
Explanation: For moving the cursor forward to the first occurrence of a character, f command is used followed by the character. For example,
fch // moves the cursor forward to the first occurrence of ch
3. t command positions the cursor a single character before the occurrence.
Explanation: t command works in a similar manner as f except the fact that it positions the cursor a single character before the occurrence.
4. __ and __ commands works in a reverse manner as f and t.
a) F, T
b) tf, ft
c) z, x
d) ff, tt
Explanation: F and T perform the respective functions as f and t but in reverse direction.
5. For repeating the character search , and ; are used.
Explanation: We can repeat the character search using the ; and , respectively. ; repeats the search in the same direction along which the previous search was made with f or t. Similarly (,) repeats the search in the opposite direction.
6. For customizing vi, which of the following command is used?
d) set, map, abbr
Explanation: vi can be customized in the way we want. For this purpose, map, set and abbr commands are used.
7. vi environment is determined by variable settings. These variables are controlled by ____ command.
Explanation: vi environment is determined by variable settings. These variables are controlled by :set command.
8. For automatic indentation, ____ is used with : set command.
Explanation: To provide automatic indentation to or code, we can use the following statement:
9. Which of the following is used with :set to customize vi to ignore case in pattern searches?
Explanation: To customize the vi to ignore case in pattern searches we can use the following statement:
:set ignorecase // case-insensitive search
10. To change the default tab stop spaces in vi, ___ can be used with :set.
Explanation: To change the default tab setting (8 spaces) to 4 spaces, :set tabstop=4 can be used.
11. Which command is used for mapping keys of a keyboard?
Explanation: The map command lets us assign the undefined keys or reassign the defined ones so that when such a key is pressed, it expands to a command sequence.
12. /* and f* are same.
Explanation: /* will search the entire file for an asterisk, while f* looks for it in the current line only.
13. For compiling a C program without leaving the editor, which command will be used?
a) cc %
b) :! Cc
c) :!cc %
Explanation: vi provides us with a feature of compiling a C program without leaving the editor by using the :!cc % command.
14. Which of the following statement is not true?
a) f and t commands are used for searching a character
b) y and yy are same
c) vi has 26 named buffers
d) :e# is used for toggling between files
Explanation: The y operator yanks text but it cannot perform any function unless it is combined with any command or itself.
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.