101-400 Exam QuestionsBrowse all questions from this exam

101-400 Exam - Question 67


Which of the following sequences in the vi editor saves the opened document and exits the editor? (Choose TWO correct answers.)

Show Answer
Correct Answer: AD

In the vi editor, two sequences save the opened document and exit the editor. 'esc ZZ' saves the changes and exits the editor by pressing 'Esc' to leave insert mode and then typing 'ZZ' (uppercase). The sequence 'esc :wq!' also saves changes and exits the editor by pressing 'Esc' to leave insert mode, then typing ':wq!' and pressing 'Enter'. The '!' is used to force the write and exit even if there are unsaved changes. Neither the sequences 'ctrl :w!', 'esc zz', nor 'ctrl XX' are standard vi commands for saving and exiting.

Discussion

1 comment
Sign in to comment
DuboisNicolasDuclairOptions: AD
Oct 21, 2023

The two sequences in the vi editor that save the opened document and exit the editor are: A. `esc ZZ` D. `esc :wq!` These sequences perform the following actions: - `esc ZZ`: Press `Esc` to exit insert mode, and then type `ZZ` (uppercase) to save the changes and exit. - `esc :wq!`: Press `Esc` to exit insert mode, then type `:wq!` and press `Enter` to save the changes and exit. The `!` is used to force the write and exit even if changes are not marked as modified. The other options are not the standard vi commands for saving and exiting: B. `ctrl :w!` and E. `ctrl XX` use non-standard key combinations that are not typically used in vi. C. `esc zz` simply centers the current line on the screen but doesn't save or exit the document.