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
View Answer
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.
a) d
b) t
c) f
d) n
View Answer
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.
a) True
b) False
View Answer
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
View Answer
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.
a) True
b) False
View Answer
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?
a) set
b) map
c) abbr
d) set, map, abbr
View Answer
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.
a) :set
b) :abbr
c) :map
d) autowrite
View Answer
Explanation: vi environment is determined by variable settings. These variables are controlled by :set command.
8. For automatic indentation, ____ is used with : set command.
a) autowrite
b) autoindent
c) automode
d) showmode
View Answer
Explanation: To provide automatic indentation to or code, we can use the following statement:
:set autoindent
9. Which of the following is used with :set to customize vi to ignore case in pattern searches?
a) nomatch
b) ignorecase
c) nocase
d) nomagic
View Answer
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.
a) nomagic
b) tabstop=n
c) tab
d) tabchange
View Answer
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?
a) set
b) map
c) abbr
d) autowrite
View Answer
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.
a) True
b) False
View Answer
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 %
d) :!c
View Answer
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
View Answer
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.
- Apply for Computer Science Internship
- Practice Computer Science MCQs
- Check Computer Science Books
- Check Unix Books
- Practice MCA MCQs