Choice Questions:

Chapter 4

(3) 1. How do you yank 5 lines in vi? (V)
       (1)5xx   (2)5yw   (3)5yy   (4)5xx

(4) 2. Which command replaces a single character with another in vi? (III)
       (1) a (2) J (3) i (4) r 

(2) 3. What keyboard shortcut can you use in vi, as well as many other
       programs, to redraw the screen? (II)
       (1) Ctrl-d (2) Ctrl-l (3) Ctrl-e (4) Ctrl-s

(1) 4. How do you move your cursor to line 40 in vi. (II)
       (1) 40G  (2)40L   (3)G40   (4) 40R

Chapter 6

(1) 5. Which command will tell you what directory you are currently in? (VIII)
       (1) pwd (2) cd (3) mkdir (4)whatdir

(3) 6. How long can a UNIX filename be on modern systerm? (VIII)
       (1) 4 (2) 16 (3) 255 (4) 128

(4) 7. What command is used to create a directory? (VII)
       (1) rmdir (2) cd (3) dir (4) mkdir

(1) 8. What command is used to remove a directory? (V)
       (1) rmdir (2) cd (3) dir (4) mkdir

(2) 9. What command is used to copy files and directories? (IV)
       (1) copy (2) cp (3) rn (4) cpy

(1) 10. What character cannot be used when making a file name?  (IV)
       (1) / (2) | (3) _ (4) = 

(3) 11. What is the command to interactively delete files? (IV)
       (1) rm (2) rm -d (3) rm -i (4) rm -a

(3) 12. Which command is used to rename a file? (IV)
       (1) ren  (2) rn  (3) mv  (4) mvdir


Chapter 7

(1) 13. What command is used for changing file permissions? (VI)
        (1) chmod  (2) cdmod  (3) rdmod  (4) dmod

(1) 14. How do you show all files (hidden and dot files) in a directory? (V)
       (1) ls -a (2) ls -x (3) ls (4) ls -t

(2) 15. What command is used to show a long listing of file attributes?  (IV)
        (1) ls -a (2) ls -l (3) ls -x (4) ls -t

(3) 16. The permission -rwxr--r-- represents in octal expression is (IV)
        (1)777   (2)666   (3)744   (4)711

(3) 17. Which command is used to assign read-write permission to the 
        owner? (IV)
        (1) chmod a+r file (2) chmod o+r file (3) chmod u=rw file 
        (4) chmod og-r file

(4) 18. Which of the following commands is used to transfer the ownership of 
        a file? (III)
        (1) trown (2) chmod (3) umask (4) chown

(2) 19. How would you display all files including hidden ones in columns and 
        identify directories and executables? (III)
        (1) ls -u (2) ls -Fax (3) ls -r (4) ls -R

(1) 20. How can you add the write permission to the group and the read 
        permission to the others? (II)
       (1) chmod g+w, o+r file (2) chmod a+r, g+x file 
       (3) chmod g+x, o+r file (4) chmod u+x, g+r file

Question & Answer:

Chapter 4

   1. How do you search forward for the string UNIX in vi?    (IV)
      How do you repeat this search in the same direction? 
      How do you repeat this search in the opposite direction?

 Ans: /UNIX searches forward for the string UNIX. 
      n repeats the search in the same direction. 
      N repeats the search in the opposite direction.
 
   2. How do you recover a file from a crash in vi? (III)

 Ans: vi -r filename

   3. What is the Command Mode in vi? (III)

 Ans: The Command Mode is where keys are used as commands to act on text. 

   4. How do you globally replace Internet with Web occurring in all lines 
      using vi? (II)

 Ans: Use :1,$s/Internet/Web/g


Chapter 6

   5. How UNIX divides files into three catrgories? (VIII)
 Ans: Ordinary file - Also known as regular file. It contains only data as 
      a stream of characters.
      Directory file - A folder containing the names of other files and 
      directories.
      Device file - It represents all hardware devices.

   6. What is the difference between relative and absolute pathnames? (VII)

 Ans: A relative pathname uses the current direcotry as point of reference 
      and specifies the path relative to it.
      An absolute pathname uses the root as the reference for the file. All
      paths originate from the root.

   7. List three commands that are used to compress files. (V)

 Ans: gzip, zip, compress

   8. What does rm -r * do? (IV)

 Ans: It is used to delete all files in the current directory and all
      subdirectories and their files.

   9. How do the df and du commands differ? (IV)

Ans: The df command tells you about the partitions, total space and
     space available in each partition, mount points.
     The du command shows disk usage i.e. you can check the disk space 
     used by a specific drirectory or directories.

  10. What directories do . (a single dot) and .. (two dots) represent
      respectively? (III)

 Ans: . (a single dot) represents the current directory.
      .. (two dots) represents the parent directory.

  11. What does the cd command do when used without arguments? What does  
      cd .. do? (III)

 Ans: When the cd command is used without arguments, it returns the
      user to the home directory.
      cd .. will change the user to the parent directory.

  12. What are two functions of the mv command? (II)

 Ans: Rename a file (or a directory).
      Move a group of files to a different directory.

Chapter 7

  13. A file with -rwxr-xr-x has what permissions assigned to it? (V)
 
 Ans: Owner: read, write, execute; Group: read, execute; 
      Others: read, execute.

  14. What are the three kinds of permission a file can have? (IV)

 Ans: A file can have three sets of permissions which are: read, write, and
      executable.

  15. What is the umask command and how can it be evaluated? (III)

 Ans: The umask commands refers to the user mask. The default permission
      setting is transformed by subtracting the user mask from it to remove
      one or more permissions.
      This mask evaluated by use the umask command.

  16. List two ways to assign file permissions which indicate only the
      owner can read and write the file. (III)

 Ans: chmod 600 filename
      chmod u=rw filename

  17. What is the typical structure of a find command? Give an example? (III)

 Ans: (1) find path_list selection_criteria action
      (2) find . -name "*.c" -print

  18. What are the three time stamps associated with a file? (II)
  
 Ans: Time of last file modification, last access, and last inode
      modification

  19. What are the three components contained in the chmod command? (II)

 Ans: Category of user (owner, group, others) 
      Operation to be performed (assign or remove a permission)
      Permission type (read, write or execute)

  20. What is a symbolic link? (II)

 Ans: A symbolic link is a directory entry that points to the file or
      directory that actually has the contents.