Practice Test DAT2330 - Ian Allen - Winter 20-1- PRACTICE Evaluation: 120 Questions Name: _________________________ Important Instructions 1. Read all the instructions and both sides of all pages. 2. Manage your time when answering questions on this test. Answer the questions you know, first. _________________________________________________________________ Multiple Choice - 120 Questions This is a practice test containing many practice questions. The real test will contain many questions similar to these. Knowing the concepts behind the questions is necessary; memorizing these answers won't help. The real test will have approximately one question per minute. The real test may have some questions unlike anything given here. (Office use only: 22 44 112 14 34 24 32 64 54 46 102 89 70 52 62 40 71 60 66 111 39 21 105 93 95 57 12 4 8 10 109 16 5 6 110 56 15 53 63 61 11 31 23 29 18 86 119 118 117 97 99 84 108 58 90 41 69 88 106 104 37 72 83 35 49 26 91 120 82 36 45 47 115 55 1 67 42 100 48 73 74 98 113 25 65 68 38 59 50 2 107 19 116 17 77 80 30 94 33 3 103 9 51 81 92 43 78 76 7 13 20 96 114 75 79 28 101 85 87 27) 1. What appears on your screen after this bash shell command line? echo hi >a ; ls a > wc a. 1 1 3 b. 3 c. 1 1 2 d. no output e. 2 2. Which command line lists all possible utilities available for editing files? a. whereis edit b. which edit c. finger edit d. man -k edit e. man edit 3. Which of the following statements is true about this shell command line: >/a/b/c cat /a/b/d a. The command cat sees only one argument. b. The command cat sees two arguments. c. The command is always invalid. d. The command /a/b/c sees only one argument e. The command /a/b/c sees two arguments. 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-2- PRACTICE 4. If you type the command cat which of the following key sequences will send an EOF and take you immediately back to the command prompt? a. [CTRL-D] b. [CTRL-C] c. [CTRL-R] d. [CTRL-L] e. [CTRL-U] 5. Which command below removes only this five-character file name containing a special character (and no others): date? a. rm ./date\? b. rm ./date? c. rm date\* d. rm date\\? e. rm date/? 6. What appears on your screen after this bash shell command line? echo hi >out ; wc -c out a. 4 out b. 3 out c. no output d. 2 out e. 5 out 7. Which of the following is true, given this long directory listing from ls: drwxr-x--x 512 ian user 712 May 30 12:35 dir a. The number 512 is the inode number of this directory. b. The number 712 is the inode number of this directory. c. The number 712 is the count of links (names) this directory has. d. The number 512 is the count of links (names) this directory has. e. The number 512 is the size of this directory. 8. What is the output of this sequence of three shell commands: echo hi >wc ; ls wc >wc ; wc wc a. 2 2 4 wc b. 0 0 0 wc c. no output d. 1 1 3 wc e. 1 1 2 wc 9. What is the output of this bash shell command line in an empty directory? echo '$SHELL' a. $SHELL b. no output c. '$SHELL' d. /bin/bash e. '/bin/bash' 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-3- PRACTICE 10. Which of these statements is true? a. Unix commands must be entered in lower-case letters. b. Unix commands can be entered in upper-case or lower-case letters; they are equivalent. c. To indicate End-of-File (no more input), type [CONTROL]-[E]. d. To erase an entire line of typing, type [CONTROL]-[E]. e. You can only login to Unix once per userid; you cannot be logged in to the same machine twice. 11. How many command arguments does the shell pass to this echo command: echo 'It's a bird! No! It's a plane!' a. Four arguments. b. Two arguments. c. One argument. d. Five arguments. e. Three arguments. 12. Which command sequence below outputs only lines 11-15 of the 99-line file named cat? a. head -15 cat | tail -5 cat b. head -10 cat | tail -15 cat c. head -15 cat | tail -5 d. tail -15 cat | head -10 e. tail -10 cat | head -15 cat 13. If directory foo contains only these four three-character file names: .x1, .x2, .z3, .z., then what is the output of the following bash shell command line: echo foo/??? a. foo/??? b. foo/.x1 foo/.x2 foo/.z3 c. no output d. foo/.z. e. foo/.x1 foo/.x2 foo/.z3 foo/.z. 14. What is the output of this shell command line in an empty directory? echo * a. * b. . .. c. .. d. . e. no output 15. If file nine contains nine lines, each of which is the one- digit line number of the line in the file (1 through 9), what is the output of this command: sort nine nine | tail -4 | head -1 a. 8 b. 6 c. 4 4 d. 6 6 e. 1 1 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-4- PRACTICE 16. Which command below removes only this four-character file name containing a special character (and no others): xyz? a. rm xyz\\? b. rm -r xyz? c. rm xyz//? d. rm xyz/? e. rm xyz\? 17. Which of the following shell command lines displays only the names in the current directory that are exactly three alphabetic letters long? a. echo [?][?][?] b. echo [0-3][0-3][0-3] c. echo ??? d. echo *** e. echo [a-zA-Z][a-zA-Z][a-zA-Z] 18. Given an existing file of yours named wc, what is the output of this sequence of three shell commands: echo hi >wc ; sort wc >wc ; cat wc a. 0 0 0 wc b. no output c. 1 1 3 wc d. 1 1 2 wc e. 2 2 4 wc 19. If I am in my home directory named /home/myhome and sub is an empty sub-directory, what is true after this command line: touch ./fil ; mv sub/../fil ../myhome/cat a. there is a second copy of the file fil in the file named cat b. the directory sub now contains only a file named cat c. the directory sub/.. now has a file named cat in it d. the command fails because the path sub/../fil does not exist e. the command fails because the path ../myhome/cat does not exist 20. Which Unix command sequence deletes a directory and everything inside it? a. rm -r dir b. rm -all dir c. deltree -all dir d. rmdir -r dir e. rmdir -all dir 21. Which command below removes only this four-character file name containing a special character (and no others): *dog a. rm /*dog b. rm .\/*dog c. rm ./\*dog d. rm ?dog e. rm \\*dog 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-5- PRACTICE 22. What appears on your screen after this bash shell command line? echo hi | wc -c a. no output b. 3 c. 0 d. 1 e. 2 23. In an empty directory, how many arguments are passed to the cat command in this bash command line? date >a1 ; touch a2 ba ca ; cat a* a. 4 b. 2 c. none d. 3 e. 1 24. Which of these command sequences will make file out contain all of the content of file in1 followed by all of the content of file in2? a. mv in1 in2 >out b. cp in1 in2 >out c. cat in1 in2 >out d. echo in1 in2 >out e. cp in1 >out in2 >out 25. If file twenty contains twenty lines, and file thirty contains thirty lines, then how many lines are output by this command: tail thirty | cat twenty a. 50 b. 21 c. 20 d. 30 e. no lines (no output) 26. How many arguments and options are there to the command: ls -li foobar a. Two arguments, one of which is a single option and the other is a pathname. b. Two command line arguments, one of which contains two bundled options. c. Two options, no arguments. d. One argument, no options. e. Two arguments, no options. 27. If you type the command sort which of the following key sequences will send an EOF and take you immediately back to the command prompt? a. [CTRL-L] b. [CTRL-U] c. [CTRL-D] d. [CTRL-R] e. [CTRL-C] 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-6- PRACTICE 28. If /bin/bash is a file name, which of the following pathnames always leads to the same file? a. /bin/bash/. b. ./bin/bash c. /bin/bin/../bash d. /bin/../bin/bash e. /bin/../bash 29. Which of the command lines below can generate a non-empty file? a. sort /a/b >/a/b b. wc -l /a/b >/a/b c. head -5 /a/b >/a/b d. cat /a/b /a/b /a/b >/a/b e. tail /a/b >/a/b 30. Which command line below does not show any lines from inside the file dog? a. head dog b. more dog c. ls dog d. less dog e. tail dog 31. If your terminal type is xterm, what is the output of this bash shell command line? echo '$TERM' a. 'xterm' b. '$TERM' c. $TERM d. xterm e. no output 32. If you type the command sort verybigfile >out which of the following key sequences will interrupt it and take you immediately back to the command prompt? a. [CTRL-D] b. [CTRL-C] c. [CTRL-R] d. [CTRL-L] e. [CTRL-U] 33. What is the correct syntax to redirect both standard output and standard error into the same output file? a. command 2>&1 >out b. command >out 2>&1 c. command >out 2>1 d. command 2>1 >out e. command 2>out >out 34. What is the correct syntax to redirect both standard output and standard error into the same output file? a. command >out 2>1 b. command >out 2>out c. command 2>&1 >out d. command 2>1 >out e. command >out 2>&1 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-7- PRACTICE 35. In an empty directory, what appears on your screen after this bash command line? ls out 2>/dev/null a. /dev/null not found b. out c. no output d. out 2 not found e. out not found 36. How many arguments and options are there to the command: wc -wc /sort a. Two arguments, no options. b. Two command line arguments, one of which contains two bundled options. c. Two arguments, one of which is a single option and the other is a pathname. d. A three-letter file name and a /sort switch option argument. e. Two options, no arguments. 37. If you type the command sleep 60 which of the following key sequences will interrupt it and take you immediately back to the command prompt? a. [CTRL-L] b. [CTRL-U] c. [CTRL-R] d. [CTRL-C] e. [CTRL-D] 38. What is the output of this shell command line in an empty directory? ls * a. . .. b. no output c. . d. * e. an error message from ls saying * does not exist 39. What is the output of this sequence of three shell commands: echo hi >hi ; head hi >hi ; wc hi a. no output b. 1 1 3 hi c. 1 1 2 hi d. 0 0 0 hi e. 2 2 4 hi 40. If file /a/b contains ninety-nine lines, each of which is the two-digit line number of the line in the file (01 through 99), what is the output of this command: sort /a/b /a/b | tail -4 | head -1 a. 01 01 b. 98 c. 96 96 d. 96 e. 04 04 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-8- PRACTICE 41. Which command line below does not show any lines from inside the file dog? a. head -3 dog b. tail -8 dog c. less dog d. sort -r dog e. ls dog 42. Which of the following is true, given this long directory listing from ls: drwxr-x--x 123 ian user 456 May 30 12:35 dir a. The number 456 is the count of links (names) this directory has. b. The number 123 is the octal permissions of this directory. c. The number 123 is the inode number of this directory. d. The number 123 is the size of this directory. e. The number 456 is the size of this directory. 43. What appears on your screen after this bash shell command line? echo hi >out | wc -c a. 3 b. 2 c. 1 d. no output e. 0 44. In an empty directory, what appears on your screen after this bash command line? ls nosuchfile 2>out a. nosuchfile 2 not found b. 2 not found c. nosuchfile d. no output e. nosuchfile not found 45. What appears on your screen after this bash shell command line? echo hi >a ; ls a | wc -c a. no output b. 4 c. 2 d. 3 e. 1 46. What command shows all the lines in file /etc/group that contain the string idallen? a. grep idallen /etc/group b. grep idallen >/etc/group c. cat /etc/group | wc idallen d. cat /etc/group > grep idallen e. grep /etc/group idallen 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-9- PRACTICE 47. If I am in my home directory named /home/alleni and empty is an empty sub-directory, what is true after this command line: date >./cat ; mv empty/../cat ../alleni/dog a. the command fails because the path ../alleni/dog does not exist b. the command fails because the path empty/../cat does not exist c. there is a second copy of the file cat in the file named dog d. the directory empty now contains only a file named dog e. the directory empty/.. now has a file named dog in it 48. What can you do to get back (redo) the last command you typed to the bash (Linux) shell? a. Use the "PageUp" key. b. Type [CONTROL]-[ALT]-[DEL] c. Type [ALT]-[F2] d. Type [CONTROL]-[BACKSPACE] e. Use the "UpArrow" key. 49. Which command below is the best way to find a line containing a question mark (?) in the file /etc/passwd? a. grep ./? /etc/passwd b. grep /etc/passwd ./? c. grep '?' /etc/passwd d. grep ? /etc/passwd e. grep ? >/etc/passwd 50. What is in file out after running this bash shell command line? echo a >out b c a. a b. a b c c. echo a d. no output e. b c 51. How many arguments does the shell pass to this echo command: echo "cow "y " bat 'man x' " pig'a "hop' a b a. Five arguments. b. Six arguments. c. Four arguments. d. Seven arguments. e. Eleven arguments. 52. If my current directory is /home, which of these pathnames is equivalent to the pathname /home/a/b/c? a. /a/b/c b. ./home/a/b/c c. ../a/b/c d. ./a/b/c e. ../home/b/c 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-10- PRACTICE 53. Which one of the following commands will leave file1 non- empty? a. cat file1 > file1 b. sort file1 > file1 c. wc file1 > file1 d. tail file1 > file1 e. head file1 > file1 54. Given an existing file of yours named /a/x, what is the output of this sequence of three shell commands: echo hi >/a/x ; sort /a/x >/a/x ; wc /a/x a. no output b. 0 0 0 /a/x c. 1 1 3 /a/x d. 1 1 2 /a/x e. 2 2 4 /a/x 55. How many arguments does the shell pass to this echo command: echo " one '2 three' 4 "five 6 ' 7 "8 ' >out a. Two arguments. b. Three arguments. c. Five arguments. d. Six arguments. e. Four arguments. 56. Which command below removes only this four-character file name containing a special character (and no others): ?abc a. rm /?abc b. rm -r ?abc c. rm "?abc" d. rm ""?abc"" e. rm ''?abc'' 57. If directory /a/b contains these four three-character file names: .aa, .ab, .a?, .a*, then what is the output of the following bash shell command line: echo /a/b/??? a. no output b. /a/b/.a? c. /a/b/.aa /a/b/.ab /a/b/.a? /a/b/.a* d. /a/b/.aa /a/b/.ab e. /a/b/??? 58. Which command sequence below outputs only lines 10-15 of the Unix password file? a. tail -15 /etc/passwd | head -10 b. head -15 /etc/passwd | tail -6 c. tail -10 /etc/passwd | head -15 /etc/passwd d. head -10 /etc/passwd | tail -15 /etc/passwd e. head -15 /etc/passwd | tail -5 /etc/passwd 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-11- PRACTICE 59. If file foo contains nine lines, each of which is the number of the line in the file, what is the output of this command: cat foo foo | sort | tail -4 | head -1 a. 4 b. 6 c. 8 d. 1 e. no output 60. What text is output by this bash shell command sequence: echo dog >out ; echo cat | sort out a. dog b. cat followed by dog c. dog followed by cat d. out e. cat 61. Which command below removes only this four-character file name containing a special character (and no others): abc* a. rm abc/* b. rm abc* c. rm abc\* d. rm abc\\* e. rm abc//* 62. Which of the following shell command lines displays all the names in the current directory that are exactly three digits long (and no others)? a. echo [1-3][1-3][1-3] b. echo [3][3][3] c. echo [0-9][0-9][0-9] d. echo [?][?][?] e. echo ??? 63. If file a contains twenty lines, and file b contains thirty lines, then how many lines are in file out after this sequence of bash shell commands: cat a b >c ; head c >c ; sort a b c >out a. 50 b. 60 c. no lines (empty file) d. 30 e. 100 64. Which command below removes only this five-character file name containing a special character (and no others): *test a. rm ''*test'' b. rm ./\\*test c. rm "*test" d. rm ./*test e. rm \\*test 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-12- PRACTICE 65. Which command sequence outputs inode/filename pairs for names in the current directory, sorted by inode number? a. ls -i * > sort b. ls -ia | sort -n c. ls ./* | sort -node d. ls -node * > sort -n e. sort ls -ia 66. What appears on your screen after this bash shell command line? echo xx >z ; ls z > wc a. 2 b. no output c. 1 1 3 d. 1 1 2 e. 3 67. What is in the file x after this command sequence: echo foo >a ; rm b ; echo bar >>b ; cp a b >x a. no such file (nonexistent) b. foo c. foo followed by bar d. nothing - empty file - no data e. bar 68. When doing an ls -a, the output pathname that is a double dot (..) signifies what? a. A hidden file. b. The parent directory. c. A file or directory with double links. d. The root directory. e. The current directory. 69. If file /a contains thirty lines, and file /b contains fifty lines, then how many lines are in file /c after this sequence of shell commands: cat /a /b >/c ; sort /c >/c ; sort /c /a /b >/c a. 50 b. 80 c. 160 d. no lines (empty file) e. 30 70. Which command below removes only this four-character file name containing a special character (and no others): *xyz a. rm *xyz b. rm "*xyz" c. rm ''*xyz d. rm ''*xyz'' e. rm *"xyz" 71. Which command line lists all possible utilities available for sorting files? a. man | grep sort b. man -k sort c. grep /etc/passwd sort d. man sort e. grep sort /etc/passwd 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-13- PRACTICE 72. Which of these statements is true? a. To erase an entire line of typing, type [ALT]-[DELETE]. b. The file command creates a new, empty file in the current directory c. To telnet to ACADAIX from outside the College, use the name acadaix.algonquin. d. To interrupt a Unix process from the keyboard, type [CONTROL]-[D]. e. To indicate End-of-File (no more input) to a program, type [CONTROL]-[D]. 73. What command can you use to remove a directory that isn't empty? a. rm -r dir b. del -r dir c. deldir -r dir d. mv -r dir e. rmdir -r dir 74. How many arguments and options are there to the command: ls -al /etc a. A three-letter file name and an /etc switch option. b. Two command line arguments, one of which contains two bundled options. c. Two arguments, one of which is a single option and the other is a pathname. d. Two arguments, no options. e. Two options, no arguments. 75. How can you ask the bash (Linux) shell to complete commands or file names for you? a. Type [CONTROL]-[ALT]-[DEL] and the shell will present a menu of commands. b. You can type the first part of the command or file name and press the TAB key. c. You can type the first part of the command or file name and press the ALT key. d. Type [CONTROL]-[D] and the shell will present a menu of commands. e. Type [ALT]-[F2] the shell will present a menu of commands. 76. What is the output of this successful command sequence? cd /home/foo ; touch dir ; mkdir bar ; pwd a. /home/foo b. /home/foo/bar c. /home/foo/dir/bar d. /bar e. /home/foo/dir 77. How many lines are in file out after this bash shell command line? echo hi >dog >cat >out a. no such file (file does not exist) b. no output (empty file) c. 3 d. 1 e. 2 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-14- PRACTICE 78. In the output of the command ls -ai, the one-character name . signifies what? a. The current directory. b. A current file. c. A name with an unprintable character. d. A name that is hidden. e. The parent directory. 79. Which command sequence outputs inode/filename pairs for names in the working directory, sorted by inode number? a. ls -node | sort -n b. ls -ia | sort -n c. ls | sort -i d. echo * | sort -n e. echo -i * > sort 80. In an empty directory, how many words are in file out after this bash shell command line? touch a ; ls >out a. 1 b. 4 c. no output (empty file) d. 2 e. 3 81. In an empty directory, how many words are in file cow after this bash shell command line? touch dog dog cat ; ls >cow a. 4 b. 2 c. 1 d. no output (empty file) e. 3 82. What is in file cow after running this bash shell command line? echo one two >cow three a. one two cow three b. one two c. one two three d. no output (empty file) e. echo one two 83. Which command line displays the contents of the Unix passwd file one page at a time? a. cat /etc/passwd >more b. more | /etc/passwd c. /etc/passwd >more d. /etc/passwd | more e. more /etc/passwd 84. What appears on your screen after this bash shell command line? mkdir foo ; rmdir foo | wc -c a. 1 b. 3 c. no output d. 4 e. 0 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-15- PRACTICE 85. If I am in my home directory named /home/me and x is an empty sub-directory, what is true after this command line: touch ./x/fil ; mv x/./fil x/../../me/./y a. the command fails because the path x/./fil does not exist b. the command fails because the path x/../../me does not exist c. the directory x now contains only a file named y d. the directory x is still empty e. there is a second copy of the file fil in the file named y 86. What is the output of this successful command sequence? cd /home/dir ; mkdir one ; mkdir two ; pwd a. /home/dir/one/two b. /two c. /home/dir/two d. /home/dir e. /home/dir/one 87. Which command below removes only this four-character file name containing a special character (and no others): cat? a. rm ''cat?'' b. rm ""cat?"" c. rm cat/? d. rm "cat?" e. rm \cat? 88. Given an existing file of yours named /a/b/x, what is the output of this sequence of three shell commands: echo hi >/a/b/x ; wc /a/b/x >/a/b/x ; cat /a/b/x a. no output b. 1 1 2 /a/b/x c. 1 1 3 /a/b/x d. 1 1 1 /a/b/x e. 0 0 0 /a/b/x 89. If directory /a contains these seven two-character file names: aa, ab, ac, ad, a?, a*, a., then which shell command below will remove only the single name a* from the directory (and no others)? a. rm /a/a\* b. rm /a/* c. rm /a* d. rm /a/a* e. rm /a/a? 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-16- PRACTICE 90. How can you ask the bash (Linux) shell to complete commands or file names for you? a. You can type the first part of the command or file name and press the ALT key. b. Type [CONTROL]-[D] and the shell will present a menu of commands. c. You can type the first part of the command or file name and press the TAB key. d. Type [CONTROL]-[C] and the shell will present a menu of commands. e. Push key F1 and the system will present a menu of commands. 91. What is true about this bash shell command line? date >ls ; ls -ls ls >wc a. The wc command counts the output of the ls command. b. The ls command is executed more than once. c. The ls command receives the output of date on standard input. d. The file wc has one line in it. e. The shell finds and executes three different commands. 92. What appears on your screen after this bash shell command line? echo hi >a ; echo a | wc -c a. 2 b. 4 c. 3 d. 1 e. no output 93. Which command stops people from using write to put lines of text on your screen? a. write n b. mesg n c. chmod n d. stop n e. talk n 94. What appears on your screen after this bash shell command line? echo hi >a ; cat a | wc -c a. no output b. 2 c. 1 d. 3 e. 4 95. How many lines are in the file out after this command sequence: echo hi >x ; echo ho >>x ; cat x x x >out a. nothing - empty file - no data b. 3 c. 6 d. 2 e. 1 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-17- PRACTICE 96. How many arguments does the shell pass to this echo command: echo ' one two ' three ' four ' 5'6' a. Five arguments. b. Six arguments. c. Nine arguments. d. One argument. e. Four arguments. 97. Which of the following is true, given this long directory listing from ls: drwxr-x--x 256 ian user 512 May 30 12:35 dir a. The number 256 is the inode number of this directory. b. The number 256 is the size of this directory. c. The number 512 is the count of links (names) this directory has. d. The number 256 is the octal permissions of this directory. e. The number 512 is the size of this directory. 98. If file /a contains thirty lines, and file /b contains fifty lines, then how many lines are output by this command: cat /a | sort /b a. 50 b. 80 c. 20 d. no lines (empty file) e. 30 99. In an empty directory, what is in file out after this bash command line? ls nosuchfile | wc -l >out a. 10 b. no output (empty file) c. 1 d. 11 e. 0 100. If /bin/bash is a file name, which of the following pathnames always leads to the same file? a. /bin/bash/.. b. /bin/bash/. c. /../../bin/bash d. ./bin/bash e. /bin/../bash 101. What is the output of this command sequence: echo foo >file ; echo bar | sort file a. bar followed by foo b. bar c. an error message d. foo followed by bar e. foo 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-18- PRACTICE 102. Which of the command lines below can generate a non-empty file? a. tail -3 file >file b. head -5 file >file c. sort -r file >file d. wc -wc file >file e. cat file file file >file 103. If directory /a contains these seven two-character file names: aa, ab, ac, ad, a?, a*, a., then which shell command below will remove only the single name a? from the directory? a. rm /a/a? b. rm /a/a\? c. rm /a? d. rm /a/a* e. rm /a/a[*] 104. How many arguments does the shell pass to this echo command: echo " 1 2 "three ' 4 ' five"6" a. Four arguments. b. Nine arguments. c. One argument. d. Five arguments. e. Three arguments. 105. Which of these command sequences will make file3 contain all of the content of file1 followed by all of the content of file2? a. cp file1 >file3 file2 >file3 b. cp file1 file2 >file3 c. mv file1 file2 >file3 d. echo file1 file2 >file3 e. cat file1 file2 >file3 106. How many lines are in file out after this bash shell command line? echo hi >dog >out >cat a. no output (empty file) b. 3 c. no such file (file does not exist) d. 1 e. 2 107. If foo is a sub-directory that contains only the file single, what happens after this command: mv ./foo/single foo/../double a. the directory foo is now empty b. the directory foo now contains only a file named double c. the command fails because the name foo/../double does not exist d. there is a second copy of the file single in the file named double e. the command fails because the name double does not exist 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-19- PRACTICE 108. What is in the file out after this command sequence: echo hi >x ; echo ho >>x ; cp x y >out a. ho b. no such file (nonexistent) c. hi d. nothing - empty file - no data e. hi followed by ho 109. Which of the command lines below can generate a non-empty file? a. tail -5 /a/b >/a/b b. grep /a/b /a/b >/a/b c. cat /a/b >/a/b d. sort -r /a/b >/a/b e. ls -i /a/b >/a/b 110. If you type the command head which of the following key sequences will send an EOF and take you immediately back to the command prompt? a. [CTRL-D] b. [CTRL-L] c. [CTRL-U] d. [CTRL-R] e. [CTRL-C] 111. What appears on your screen after this bash shell command line? echo hi >a ; cp a b | wc -c a. 0 b. 1 c. 2 d. no output e. 3 112. How many arguments does the shell pass to this echo command: echo 'And it's not hard, it's just logical.' a. Seven arguments. b. Three arguments. c. Six arguments. d. Four arguments. e. Five arguments. 113. What would you see if you typed this command: cat /users a. The contents of the file users located in your home directory b. The contents of the file users located in the root directory c. The contents of your directory named users d. The contents of the file users located in the parent directory e. The contents of your subdirectory named users 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-20- PRACTICE 114. In an empty directory, how many lines are in file out after this bash shell command line? ls . .. nosuchfile 2>out a. 3 b. no output (empty file) c. 4 d. 2 e. 1 115. If cow is a sub-directory that contains only the file dog, what happens after this command: mv cow/dog cow/././cat a. the command fails because the name cow/././cat does not exist b. the command fails because the name cat does not exist c. the directory cow now contains only a file named cat d. there is a second copy of the file dog in the file named cat e. the directory cow is now empty 116. In an empty directory, what appears on your screen after this bash command line? touch a ; ls | wc -l a. 2 b. no output c. 0 d. 1 e. 3 117. In the output of the command ls -a, a dot that begins a name signifies what? a. The current directory. b. A current file. c. A name with an unprintable character. d. A name that is hidden. e. The parent directory. 118. If my current directory is /etc, which of these pathnames is equivalent to the file name /etc/passwd? a. /passwd b. ../etc/passwd/. c. ../passwd d. ./passwd e. ./etc/passwd 119. What command shows all the lines in file foo that contain the string bar? a. cat foo > grep bar b. grep bar foo c. grep bar >foo d. grep foo bar e. grep cat foo bar 120. In an empty directory, what appears on your screen after this bash command line? touch a ; ls >wc -l a. 0 b. 1 c. no output d. 3 e. 2 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-21- PRACTICE Answer Key - DAT2330 - Ian Allen - Winter 2004 - DAT2330 Practice Test - 0% Office use only: 22 44 112 14 34 24 32 64 54 46 102 89 70 52 62 40 71 60 66 111 39 21 105 93 95 57 12 4 8 10 109 16 5 6 110 56 15 53 63 61 11 31 23 29 18 86 119 118 117 97 99 84 108 58 90 41 69 88 106 104 37 72 83 35 49 26 91 120 82 36 45 47 115 55 1 67 42 100 48 73 74 98 113 25 65 68 38 59 50 2 107 19 116 17 77 80 30 94 33 3 103 9 51 81 92 43 78 76 7 13 20 96 114 75 79 28 101 85 87 27 1. d 49. c 2. d 50. b 3. a 51. a 4. a 52. d 5. a 53. c 6. b 54. b 7. d 55. b 8. d 56. c 9. a 57. e 10. a 58. b 11. d 59. c 12. c 60. a 13. a 61. c 14. a 62. c 15. a 63. a 16. e 64. c 17. e 65. b 18. b 66. b 19. c 67. d 20. a 68. b 21. c 69. b 22. b 70. b 23. b 71. b 24. c 72. e 25. c 73. a 26. b 74. b 27. c 75. b 28. d 76. a 29. b 77. d 30. c 78. a 31. c 79. b 32. b 80. d 33. b 81. e 34. e 82. c 35. c 83. e 36. b 84. e 37. d 85. d 38. e 86. d 39. d 87. d 40. b 88. e 41. e 89. a 42. e 90. c 43. e 91. d 44. d 92. a 45. c 93. b 46. a 94. d 47. e 95. c 48. e 96. e 120 Questions DAT2330 Practice Test - 0% PRACTICE DAT2330 - Ian Allen - Winter 20-22- PRACTICE 97. e 98. a 99. e 100. c 101. e 102. d 103. b 104. e 105. e 106. a 107. a 108. d 109. e 110. a 111. a 112. d 113. b 114. e 115. c 116. d 117. d 118. d 119. b 120. c Count of a: 23 19% Count of b: 27 23% Count of c: 23 19% Count of d: 24 20% Count of e: 23 19% With 5 choices: 120 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 Macro .cmd splits: 33 Macro .ans splits: 0 120 Questions DAT2330 Practice Test - 0% PRACTICE