Unix guru test

I actually used this for hiring at one time.

Copyright (c) 1994 Christopher Alexander North-Keys, All Rights Reserved.
Permission granted for non-profit Internet distribution and perusal only!

Placement test – Unix operating system.
Incept: Mon Jan 31 09:19:26 CST 1994
Update: Tue Feb 22 23:56:16 CST 1994
Author: Christopher Alexander North-Keys

Questions:
Easy: 3
Normal: 13
Medium: 6
Hard: 3
———-
Total: 25

Minimum Score: 0
Maximum Score: 250
Par Test Time: 8 minutes, recommend 1

[1 easy] Unix is…
[a] A kind of computer.
[b] An operating system kernel.
[c] A type of graphic interface.
[d] An application program.
[e] A communication protocol.

[2 easy] In order to begin a session of using Unix, one will usually…
[a] Power the machine off, then on.
[b] Just enter the first command.
[c] Convince it that it already knows you, by giving a name and password.
[d] Click and hold the right mouse button, select “Unix”, and release.
[e] Toggle in the bootstrap code on the front panel toggle switches.

[3 easy] Under Unix, a user often collects information, placing it in…
[a] Documents and folders, calling one of the latter “USER”.
[b] Datasets and disk-volumes, calling one of the latter “DEFAULT”.
[c] Permanent file sets, accessed by a small integer number.
[d] Files and directories, calling one of the latter “HOME”.
[e] 3-1/2 inch (9 centimeter) diskettes.

[4 normal] Once using a Unix system, the most commonly executed program is usually…
[a] ls.
[b] su.
[c] awk.
[d] cat.
[e] netrek.

[5 normal] Under Unix, a user often edits information interactively, usually using…
[a] sed, awk, tr, and/or cut.
[b] sos, and/or edt.
[c] Wordperfect. Word, edlin, winedit, and/or the system editor.
[d] teco, tpu, and/or xedit.
[e] vi, emacs, frame, ed, and/or elvis.

[6 normal] A Unix user can invoke commands by name; the number of command names is…
[a] Fewer than 5
[b] 5 to 50
[c] 50 to 500
[d] 500 to 5000
[e] Over 5000

[7 normal] A Unix user can often work in a graphic environment, usually called…
[a] X
[b] SunView
[c] Windows
[d] Desktop
[e] Netrek

[8 normal] An individual Unix system is capable of the following level of operation…
Tasks Users CPU’s Networks
[a] One One One None
[b] Many One One One
[c] Many Many One One
[d] Many Many Many One
[e] Many Many Many Many

[9 normal] The number of users on the largest mostly-Unix network (the Internet)
in Winter of 1994 was around…

[a] 20,000 or less
[b] 200,000
[c] 2,000,000
[d] 20,000,000
[e] 200,000,000 or more

[10 normal] The following text is…
char*M,A,Z,E=40,J[40],T[40] ;
main(C)
{
for(*J=A=scanf(M=”%d”,&C); –E; J[E]=T[E]=E)
printf(“.”);
for(;(A-=Z=!Z) || (printf(“\n|”), A=39,C –);
Z || printf(M))
M[Z]=Z[A-(E=A[J-Z])&&!C&A==T[A]|6< <27 }
[a] Just text.
[b] The output of a Unix program called “maze”.
[c] An executable script.
[d] A program in a language called “C”, a descendent of “B”.
[e] A I-node.

[11 normal] To find out the real-life identity of a user, one should usually…
[a] Read the shadow password file.
[b] Reboot the user’s machine, reading the boot messages for sysadm info.
[c] Run the aliases command.
[d] Use the nameserver.
[e] Finger the user in question.

[12 normal] To get the most information out of the command “ls”, one would…
[a] Append the flag “-all”.
[b] Use the options “-Flagsi” (or maybe “-Falsi”).
[c] Edit the configuration file.
[d] Toggle “all” in the configuration dialog request box.
[e] “ls” is not a Unix command.

[13 normal] Under Unix, the name of a data file may consist of the following.

class defined to be this exact set of characters
—– ——————————————
L abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
D 0123456789
P !@#$%^&*()|-=+[] {};’:”`~\?.>,<
C Control characters and other unprintables.
H Highbit and extended-character-set characters.
[a] L
[b] L, and D
[c] L, D, and P
[d] L, D, P, and C
[e] L, D, P, C, and H

[14 normal] Situation: A SYSV user needs to print the word “hello”. He should use…
[a] lp hello
[b] echo hello | lp
[c] lp < hello
[d] hello > lp
[e] cat hello | lp

[15 normal] Situation: A user is counting with the following code. In what
interpreter would the code function as expected?

num=1
while [ $num -le 100 ] ;
do
echo $num
num=`expr $num + 1`
done

[a] rc
[b] sh
[c] perl
[d] csh
[e] awk

[16 normal] In Unix, the two most commonly used editors are vi and emacs.
Of these, vi is standard, and emacs is usually imported from
the Internet. In the following paired commands (each command
in a pair having equivalent function is its respective editor),
which pair gives commands for exiting the editor?

Vi Emacs
— —–
[a]^f C-v
[b]:w C-x C-f
[c]!! C-u M-!
[d]ZZ C-x C-c
[e]:r C-x C-i

[17 medium] Which of the following groups might be unreservedly desired by a
maniacal Unix guru for home? Assume that a single blatantly undesirable
item disqualifies an entire group.

group defined to contain these items
—– ——————————
N TCP/IP via SLIP on an ISDN or T1 for BSD or SVR4 with 2Gb+ disk.
G X, with PEX, XV, TVTWM or OLVWM, Frame, and RenderMan.
O TECO-emulation for EMACS via FTP on SVR2 or SVR3 for an AT&T
C ARCHIE, GOPHER, WWW (xmosaic), GCC, and the winners of the IOCCC.
S USENET mail & GNUS via CU or TIP at 1200 bps (baud) on XENIX.

[a] G, O, and C.
[b] G and C.
[c] N, G, and C.
[d] O and S.
[e] N, C, and S.

[18 medium] Situation: An underqualified systems administrator has just tried
to make a new user account for a Bob Simon using the following
commands from the “root” account. How is the command in error?
# cd /home; mkdir “Bob’s home directory”
# echo “Bob Simon:gandalf:0:0::/dev/tty:compress -f” > /etc/passwd

error description
—– ————
H The argument to mkdir is not a valid name for a new directory.
I The login name is invalid, and the password unmatchable.
P All pre-existing information in the password file has been lost.
U Bob’s UID would have made him “root”.
T The /dev/tty field is only valid on directly-connected terminals.
[a] H, and T.
[b] I, P, and U.
[c] P, U, and T.
[d] H, I, and P.
[e] H, P, and T.

[19 medium] The best description of the operation performed by the command
“rm foo” upon the existing filename “foo” is…
[a] Unlink – the file has one (of possibly several) links to it cut.
[b] Erase – the file contents are overwritten with nulls.
[c] Remove – the file is removed from the disk.
[d] Truncate – the file length is reset to zero.
[e] Purge – the file is sent to /dev/null.

[20 medium] Situation: Suppose “foobar” is a software package available on
the Internet. A user somewhere on the Internet wishes to obtain and use
this package. He does not yet know the appropriate archive to contact.
The command sequence he will follow will probably be…
[a] ftp, cd, vi, tar, make, archie, foobar
[b] archie, cd, ftp, vi, make, tar, foobar
[c] ftp, archie, vi, make, tar, cd, foobar
[d] archie, ftp, tar, cd, vi, make, foobar
[e] make, tar, archie, cd, ftp, vi, foobar.pa

[21 medium] A hypothetical utility program called “foobar” might be configured
at runtime in several ways. It is not a graphics program. The most likely
means of configurations are…

method description
—— ———–
E An environment variable named “FOOBAR”.
P A pseudo-device file called “/dev/foobar”.
X A file, “.Xdefaults” or “.Xresources”, in the user’s home directory.
K Reconfig of the system kernel with an entry for the new package.
F A file called “.foobarrc” in the user’s home directory.

[a] E and F.
[b] E and P.
[c] F and P.
[d] F and X.
[e] P and K.

[22 medium] Certain control characters are typically used in Unix to achieve
certain ends, such as indicating end of input, suspending a job,
interrupting a job, and so on. Select the correct line in the
following table…

suspend end-of-file interrupt erase
—————— ——— —–
[a] ^s^f ^i or ^k ^e or ^b
[b] ^z^d ^c or ^? (del) ^? or ^h
[c] ^q^e ^a or ^\ (fs) ^d or ^u
[d] ^@ (nul) ^z^b or ^q ^p or ^u
[e] ^p^t ^q or ^. (so) ^z or ^k

[23 hard] Situation: A very clueful user just had a program crash in a subdirectory,
but isn’t sure which one. She wishes to remove the core file from the crash,
along with any earlier core files that may have accumulated, without having
to go looking for them. This particular version of Unix does not make
“core.program” files. She should…
[a] ls -R | awk ‘/core/ {print “rm -rf “$0}’ | sh
[b] find . -name core -type f -exec ls -l ‘{}’ ‘;’ -exec rm -if ‘{}’ ‘;’
[c] rm -rf core */core */*/core */*/*/core */*/*/*/core */*/*/*/*/core
[d] rm -i `find . -print | grep core`
[e] find . -name core -exec echo -n rm’ ‘ -print | sh -x

[24 hard] Situation: A Unix guru with a *warped* sense of humor has just written a
program to (1) develop a BNF for arbitrary input text, and (2) dump the
resulting parser. Likely program names include:
[a] dad, dd, develop+dump.
[b] buffalo, ee, yay.
[c] bnf, nyacc, yadd.
[d] bar, foo, qux.
[e] dump, mkparser, parse.

[25 hard] Situation: A very clueful user wishes to catenate the top lines of
every file in the current directory (not subdirectories) to standout
output. She uses…
[a] { for f in `find -type f -print` ; do head -1 $f ; done ; }
[b] head -1 *
[c] cat `head -1 *`
[d] { for f in .* * ; do if [ -f $f ] ; then head -1 $f ; fi ; done ; }
[e] head -1 `ls -dF .* * | grep -v /`

Answers:
1 b
2 b
3 d
4 a # It has been well known that ls is the most common typed command.
5 e # I can’t remember “frame” so e could be a trick and answer could be a.
6 e # Just do a little script to count:
7 a
8 e
9 e
10 d
11 e
12 b
13 e
14 b # all other choices expect hello to be a file or command
15 b
16 d
17 b # by elimination. Got a better answer?
18 b
19 a # important distinction
20 d
21 a
22 b
23 b
24 b # Buffalo cause of lex,yacc,flex,bison
25 b

# script for 6
#/bin/bash
IFS=:
rm -f /tmp/commands$$
for p in $PATH
do
ls -1 $p >> /tmp/commands$$
done
wc /tmp/commands
rm -f /tmp/commands$$