CS205 Introduction to UNIX

Review for Second Quiz: Chapters 4, 5, and 6
 
  1. To start vi you can...
    1. click on the vi icon
    2. click on a file it wrote and it opens by itself
    3. type "vi" and the name of the file to work on
    4. type "run vi"

  2. vi is described by the book as
    1.  a line editor
    2.  a screen editor
    3.  a graphic editor
    4.  editor of a great metropolitan newspaper

  3. The two modes of vi are
    1.  input and output
    2.  input and correction
    3.  input and command
    4.  prickly and nasty

  4. Commands to vi
    1.  are usually single keypresses
    2.  always require you to press enter
    3.  are executed in batch mode
    4.  were thought up by wise Tibetan monks

  5. Explain what each of these keystrokes would probably do in vi:
    1.  Escape key _______________________________________________
    2.  the letter i _______________________________
    3.  the letters h,j,k and l ______________________________________

  6. You may exit vi in several ways. Assume you want to save and then leave vi. Which way?
    1.  :qw
    2.  :q
    3.  :q!
    4.  :wq


  7. vi is described by the book as
    1.  a line editor
    2.  a screen editor
    3.  a graphic editor
    4.  editor of a great metropolitan newspaper


  8. Explain what each of these keystrokes would probably do in vi:
    1.  Escape key _______________________________________________
    2.  the letter i _______________________________
    3.  the letters h,j,k and l ______________________________________


  9. You may exit vi in several ways. Assume you want to leave without saving. Which way?
    1.  :qw
    2.  :q
    3.  :q!
    4.  :wq


  10. vi has the ability to search for a text phrase in a document. In command mode,
    1.  you press :S to search
    2.  you press / to search forward
    3.  you press ? to search backward
    4.  you press your rosary and pray it works


  11. You should know what each of these commands does in command mode:
    1.  x
    2.  dd
    3.  r
    4.  R


  12. To enter vi in the Read Only mode, you might type
    1.  vi filename R
    2.  vi filename RO
    3.  vi -ro filename
    4.  vi -R filename


  13. Like most UNIX commands, vi can take a series of arguments, like
    	vi file1 file2 file3 file4

    What would this command do?
    1.  open four copies of vi
    2.  open four windows in vi, each with one file
    3.  open vi with file1, ignoring the other arguments
    4.  open vi with file1, holding the other files in buffers


  14. Pressing a command key twice, when the command can be modified by scope, means
    1.  carry out the command twice
    2.  carry out the command with the default scope
    3.  carry out the command, and ask for confirmation
    4.  undo the last such command


  15. When you use the DD command the text that is cut is
    1.  lost forever
    2.  gone but can be brought back with a special utility
    3.  placed in the next buffer available
    4.  placed in Buffer 1


  16. The yank command
    1.  copies from Buffer 1 and clears it
    2.  copies from Buffer A
    3.  copies to Buffer 1
    4.  copies from the hard drive


  17. The paste command
    1.  will paste above the current line, if a P is used
    2.  will paste above the current line if a p is used
    3.  will paste to the screen and clear the buffer
    4.  will stick to your fingers: lick them frequently


  18. In terms of vi commands, scope means
    1.  the programmer should stop eating garlic
    2.  we can modify how far and which direction
    3.  we can watch the command take place
    4.  we can hit a target much farther away


  19. Buffers are important to vi. There are
    1.  26 numbered buffers you can use
    2.  10 numbered buffers you can use
    3.  35 buffers you can use
    4.  very good reasons to leave the buffers alone


  20. vi can be customized by the user or the system administrator. The file to save settings in is
    1.  .vicnf
    2.  .uservi
    3.  .exrc
    4.  .viset


  21. There are three kinds of environment settings for vi. All but
    1.  Boolean options - either on or off
    2.  Numeric options - set to some number value
    3.  User options - set to do whatever the user wants
    4.  String options - set to remember a string of characters


  22. The wraparound option inserts line returns. This means
    1.  vi has the same kind of word wrap as most word processors
    2.  lines are actually one long line that looks like many
    3.  the user does not have to press ENTER at the end of a line
    4.  vi will reformat the page when text is inserted


  23. Vi is capable of passing a command to the shell by pressing a colon and
    1.  the Esc key in command mode
    2.  the Bang (!) key in command mode
    3.  the enter key twice in text entry mode
    4.  the r key in command mode


  24. UNIX considers almost everything in it to be a
    1.  file
    2.  tag
    3.  pointer
    4.  measure


  25. UNIX considers regular files to be
    1.  data files only
    2.  data files and program files only
    3.  most files, except directories and special files
    4.  all files except directories


  26. A home directory is the one
    1.  the user spends the most time in
    2.  the user goes to when logging in
    3.  the user creates in an assigned directory
    4.  the system administrator keeps everyone out of


  27. A current directory is
    1.  where a user goes on log in
    2.  where the user wants to go next
    3.  where the user is at any given time
    4.  where the user saves all files


  28. Absolute path names
    1.  contain a reference to the root directory
    2.  cannot contain a reference the the root
    3.  depend on where the user is right now
    4.  cost a buck more than regular, but are worth it


  29. Characters that are allowed in file names do not include
    1.  lowercase letters
    2.  uppercase letters
    3.  numbers and underscores
    4.  spaces, stars and slashes


  30. You should know what each of these commands will do:
    1.  pwd
    2.  cd
    3.  ls -R
    4.  rm -r
    5.  Ls -al
    6.  mkdir -p
    7.  cat


  31. Hidden files in UNIX
    1.  are hidden from everyone at all times
    2.  are hidden unless you know the password
    3.  are hidden because of a dot in their names
    4.  cost a buck more than regular, but are worth it

  32. True or False:
    1. The vi editor is considered as a line editor.
    2. The vi editor modes are adding mode and delete mode.
    3. Some of the basic editing jobs are: entering text, deleting text, and modifying text.
    4. The vi editor command mode is not case sensitive.
    5. The vi editor uses temporary buffers for the files you are editing.
    6. The commands Z and zz both save your file and exit the vi editor.
    7. You can start the vi without indicating the filename.
    8. Pressing the letter i in command mode places the vi in the insert mode (text mode).
    9. One way to exit vi is to turn the terminal off.
    10. The command I places the text you enter at the beginning of the current line.
    11. The vi editor default mode is the command mode.
    12. Pressing the Esc key places the vi in the command mode.
    13. Pressing the Esc key twice terminates the vi editor.
    14. Pressing the 0 (zero) key in command mode places the cursor in the middle of the page.
    15. Entering 2x in command mode deletes 2 lines, starting from letter x.
    16. Pressing letter R in command mode makes vi repeat the last command.
    17. Pressing letters U or u in text mode makes vi undo the last change/changes.
    18. You can start vi by giving it a list of filenames
    19. You can invoke vi with the ?R option to prevent accidental changes.
    20. vi lets you read (import) other files into your current editing file.
    21. vi lets you save your entire file but not any portion of it.
    22. You can copy one or more lines of text from one place in your file to another.
    23. vi lets you move lines from one place in your file to another.
    24. The vi editor uses 9 temporary buffers named 1 to 9.
    25. The contents of the numbered buffers are out of your reach.
    26. The alphabetic buffers and numbered buffers are the same buffers named differently.



  33. More True and False:
    1. The vi editor is the only editor that UNIX supports.
    2. The directory structure is arranged in levels and is known as a hierarchical structure.
    3. Your login name and your home directory name are usually the same.
    4. Every UNIX file structures has a root directory named / (slash).
    5. Files in your current directory are immediately accessible. Files on the other directories must be identified by their pathnames.
    6. Absolute and relative pathnames are the same and indicate the same pathname.
    7. If you have just logged in, your home, current or working directories are the same.
    8. In UNIX filenames XYZ and xyz are indicating the same filename.
    9. In UNIX filename extension is absolutely necessary.
    10. The pwd command prints your working directory on the printer.
    11. The cd command returns you to the root directory.
    12. The invisible files are the files that only the owner can see.
    13. You can use only one command option at a time on the command line.
    14. You can use the vi editor or the cat command to look at the content of a file.
    15. You can use the vi editor or the cat command to create a file.
    16. After the print command is issued, there is no way to cancel the print job.
    17. The rmdir command (with no options) can only remove empty directories.
    18. The / at the beginning of a pathname stands for the root directory.
    19. The name .HIDDEN is an example of a hidden file.
    20. . (dot) and .. (dot dot) represent the current and a level higher directories respectively
    21. To cancel a print job, you only have to turn the printer off.