This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “Editing Text in Vi Editor – 2”.
1. We can use ‘yy’ command for copy and paste operation.
a) True
b) False
View Answer
Explanation: We can copy lines using ‘yy’ command and paste it at another location using ‘p’ or ‘P’ command.
2. Which command is used for joining lines?
a) J
b) j
c) yy
d) jn
View Answer
Explanation: To join current line with the line(s) following it, we can use join (J) command. It just pulls up the following line by terminating the new line character between the current line and following line.
3. Which command will be used to join 4 lines with the current line?
a) 5J
b) 4J
c) 6J
d) 4j
View Answer
Explanation: Join command joins the current line with the following number of lines. For example,
5J // joins current line with following four lines
4. Which of the following undo a most recent single editing change?
a) u
b) U
c) uu
d) yy
View Answer
Explanation: To reverse the last change you made to the buffer press the ‘u’ key. This will restore the state of the buffer by undoing the most recent action taken.
5. ___ command allows us to undo a number of changes that have been made to a single line before moving away from that line.
a) u
b) U
c) dd
d) yy
View Answer
Explanation: When a number of changes have to be made to a single line, vi allows us to discard all changes before you move away from the line. If the cursor has been moved to another line before invoking ‘U’, this command will not work.
6. Which command is used to redo the changes made by the undo command?
a) ctrl-l
b) ctrl-r
c) ctrl-g
d) ctrl-f
View Answer
Explanation: We can use the control key (ctrl-r) to redo the changes which are made by the undo command.
7. ’10u’ command will reverse our 10 last editing actions.
a) True
b) False
View Answer
Explanation: We can undo multiple changes using ‘u’ command by prefixing repeat factor with command. For example,
10u // reverses our last 10 editing actions
8. Which symbol is used for repeating the last command?
a) $
b) *
c).
d) _
View Answer
Explanation: Using (.) operator, we can simply repeat the last command that was used. The principle behind repeat command is, use the actual command once and then repeat it at other places with dot (.) command.
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Unix Books
- Check Computer Science Books
- Check MCA Books
- Apply for Computer Science Internship
- Practice MCA MCQs