Introduction to Linux and Unix - endterm Please choose the best answer. More than one answer might be true, but choose the one that is best. SYSTEM STARTUP 1. A hard disk master boot record is located: a) in the disk s first partition, only b) in each of the disk s partitions c) on the disk outside all its partitions d) outside the disk 2. The GRUB boot loader can be used to a) control which operating system to call at boot time b) pass parameters to the called operating system c) both a and b d) neither a nor b 3. The first process launched when linux boots is normally a) login b) sysinit c) init d) vmlinuz 4. runlevels reflect: a) degrees of authorization for access to system resources b) stages in the boot process from cold power off to fully functional prompt c) different, particular choices of services to run 5. A command that can be used to control which programs are automatically run as part of the boot process is a) grub b) grep c) rpm d) chkconfig 6. The role of the directory /etc/rc.d/init.d is to hold a) the binary executable program files for the base runlevel s services b) scripts that call the binary executables for the base runlevel s services c) the binary executable program files for all runlevels services d) scripts that call the binary executables for all runlevels services UTILITIES 7. The command to delete a file is: a) del b) rem c) mv d) rm
8. The command to copy a file is: a) copy b) cp c) mv d) dup 9. The command to rename a file is: a) ren b) mv c) nameto d) alias 10. The script command can a) keep a log of your shell interaction b) remove a file c) rename a file d) all of the above 11. The command to see a list of current users of the system is a) ls b) logged c) who d) pwd 12. The command to display the name of the current directory is a) ls b) logged c) who d) pwd 13. The command to display the content (eg, filenames) in the current directory is a) ls b) logged c) who d) pwd 14. The wc command gives a) a word count b) a line count c) a character count d) all of the above 15. The command to append a word count to the end of a file is a) wc filename cat b) wc filename > filename c) wc filename >> filename 16. The command to make a directory is a) MKDIR b) MD c) md
17. The command to copy the contents of a directory to the current directory is a) copy directoryname/* b) cp directory/* c) cp directory/*. 18. The command to copy a file to the parent directory is a) copy filename b) cp filename c) cp filename. 19. The command to display to screen all files whose names begin with "lab" would be a) cat lab* b) tac lab c) cat lab& TEXT EDITING 20. Of vi s 3 command modes, listed below, one of them is reached from both of the other two by the same keystroke. Which one? a) command mode b) edit mode c) last-line mode THE SHELL 21. Which one of the following is not a shell feature? a) backgrounding b) permissions c) variables d) scripting 22. The command who cat sort prints a sorted list of logged-in users on the monitor. Choose the best, technical answer from the following. a) the output from who is identically the input to the monitor b) the input to cat is identically the output from sort c) the output from who is identically the input to cat d) the inputs to sort and cat are both the direct output from who e) who has no input and sort has no output 23. Typing which of the following is identically equivalent to typing echo v* a) echo a e i o u b) echo v? c) echo va vi vo d) print v* e) none of the above 24. On a linux system, the shell is a) the first process to run b) the executor of all other processes c) both a and b d) neither a nor b
THE X WINDOW SYSTEM 25. The diagram in Figure 1 represents a) 2 X servers and 4 X clients b) 2 X servers and 2 X clients c) 3 X servers and 4 X clients d) 1 X server and 3 X clients e) none of the above Figure 1. 26. Running an X client without running an X server a) is step one of the normal GUI startup procedure b) doesn t work c) requires the client to operate at low resolution d) requires the client to switch to character mode 27. in X Windows, a window manager is a) a client b) a server c) a desktop d) a shell script
SHELL SCRIPTING 28. This shell script waits until a user logs in, then reports the login: until who grep "$1" > /dev/null do sleep 5 done echo "***** $1 has just logged in *****" the user whose login it reports is a) the first one to login after the script starts b) the first one to have logged in since a fresh post-backup utmp file was generated c) the first one in /etc/passwd d) the first one named on the command line 29. This shell loop executes how many times? for foo in all users do echo $foo done a) 4 b) 3 c) 2 d) 1 e) cannot be determined solely from information in the code
PROCESSES 30. Here is informational screen output on a machine: When this program runs a) child asks Am I child? then parent asks Am I parent? in that order b) child asks Am I child? and parent asks Am I parent? in unpredictable order c) parent asks Am I child? then child asks Am I parent? in that order d) parent asks Am I child? and child asks Am I parent? in unpredictable order 31. See the code below. It has 2 lines of code that print text lines to the screen. When run: a) upper line appears 1 time, lower line appears 1 time b) upper line appears 1 time, lower line appears 2 times c) upper line appears 2 times, lower line appears 1 time d) upper line appears 2 times, lower line appears 2 times #include <stdio.h> main() { printf("\nhow many times do you see this line?\n"); fork(); printf("how about this one?\n"); } 32. A distinction between the fork() and exec() system calls is that: a) fork only creates a process, exec both creates and runs it b) fork runs a process, exec does not c) exec creates a process, fork does not d) fork creates a process, exec does not
33. It is often desirable for a parent process that spawns a child to suspend further execution until the child terminates. Example: a shell should not yet re-prompt the user for a second command till a first one finishes. The system functions that cooperatively accomplish this behavior are: a) wait() in the parent and exit() in the child b) fork() in the parent and term() in the child c) exec() in the parent and exit() in the child d) exit() in the parent and wait() in the child 34. The /proc filesystem is a) a mechanism for secondary, indirect access to disk b) a RAM disk feature built into linux to speed up file-intensive operations c) a selective access mechanism to kernel memory that happens to use the same interface for user access as files d) a special region of memory whose content persists across reboots 35. Here is informational screen output on a machine: The numbers that appear in the above ls output represent a) processes b) memory c) users d) time
FILESYSTEM 36. 3 components exist on disk for a file in an ext2 (linux) filesystem: its data, its inode, and its name. Given file A and file B, one of A s components can reside within one of B s. a) A s data cat reside within B s data b) A s inode can reside within B s data c) A s inode can reside within B s inode d) A s name can reside within B s data e) A s name can reside within B s inode 37. File permission string "rwxr-xr--" has three r's for a) reading at different times of day b) reading by different users c) reading from different terminals d) reading by different shells
Here is informational screen output on a machine: 38. User Socrates can write to file grades a) T b) F 39. User Aristotle can write to file assignments a) T b) F 40. User plato can write to file salaries a) T b) F 41. User roy can read file assignments a) T b) F 42. Given the file /home/joe/myfile: --w----rwx 1 joe pppusers 10 May 6 14:55 myfile if user joe attempts cat myfile and echo hello >> myfile: a) cat will succeed and echo will fail b) cat will fail and echo will succeed c) both will fail d) both will succeed
43. Here is informational screen output on a machine: Above, tom attempted to shut the system down but it didn't shut down, because a) tom ran shutdown but it refused to shut down b) shutdown never actually ran, because nobody but root can run it c) shutdown never actually ran, because tom lacked adequate permissions d) tom ran shutdown but it failed with an unexpected error COMPILING - OPEN-SOURCE INSTALLATION MODEL 44. Two broad, contrasting approaches to installing software are: a) tar versus source b) diff versus patch c) package versus rpm d) tar versus rpm 45. A step in the standard recipe for installing from a tarball is to read the: a) Makefile file b) README file c) INSTALLME file d) CONFIG file 46. A virtue of rpm installing is: a) fast downloading b) local machine customization c) multiple compression options d) easy uninstalling 47. A detriment of rpm installing (without yum), compared to installing with yum, is a) slower operation b) repositories are all local c) no dependency resolution d) difficult uninstalling
48. The man system of local documentation is divided into sections for a) commands and functions b) character and graphical commands c) high and low level users d) commands, system calls, file formats, and a few other categories 49. Regular user passwords are stored in file a) /etc/password b) /etc/shadow c) /etc/passwd d) /etc/group 50. The file that controls whether linux boots into character or graphical mode is a) /boot/grub/grub.conf b) /etc/passwd c) /boot/x.conf d) /etc/inittab