Certification: HP-UX – HP UNIX FUNDAMENTALS
HP UNIX FUNDAMENTALS
SHORT SELF-ASSESSMENT TEST
On a sheet of paper, write down the numbers of the questions and the letters of the appropriate answers.
1. Which command lists the contents of your current directory and all directories below it?
A.Is -R or lsr
B.Is
C.dir
D.Tree
2. The following output is from the “ll” command:
drwx——2 you other 96 Mar 2 19:51 data
From this information “data” is a:
A.deleted file waiting for trash collection.
B.file, currently in use by two users.
C.private directory.
D.public directory.
3. The tar command is used for:
A.printing the contents of a file
B.reformatting a file
C.making archive tapes
D.merging a file
4. Job control refers to the shell’s ability to:
A.handle multiple tasks at one time
B.adjust the priority of running jobs
C.move a job from the foreground to the background and vice-versa
D.repeat the same action over and over
5. Pipes allow:
A.data to be transferred from one system to another
B.file contents to be combined into a single stream
C.the output of one command to be used as input for another command
D.the same data to be sent to multiple commands at the same time
6. By default, a command sends its output and error messages to the:
A.top and bottom of the screen.
B.file descriptor 1 and 2 respectively.
C.screen and the syslog file.
D.bit bucket unless specified by the user.
7. If yon wish a command to run in background how do you set it off?
A.bg command
B.nohup command
C.command bg
D.command &
8. What permissions are required on a file to be able to run it as a program?
A.read and execute
B.read
C.execute
D.read and execute and write
9. What variable is used to hold the result of test command?
A.$#
B.$error
C.$?
D.$!
10. The alias shell command is used to create:
A.alternate names for files in your home directory
B.personal shortcuts for frequently used command strings
C.a nickname for you system
D.a second user login for your account
11. What is the difference between local and environmental variables?
A.Environmental variables bring values back to the parent process from the child process
B.Only local variables can be set up by a normal user
C.A local variable is only known about in the current process whereas an environmental variable is also known about in child processes
D.A local variable is only known about in the users own processes whereas an environmental variable is known about by the whole system
12. In a directory containing the files: abc aabc bac baac bca bcaa, the command ls *a? would list the following file names:
A.abc aabc
B.bac baac bca bcaa
C.bac baac bcaa
D.abd bac baac
13. In “let” statements what action does “/” represent?
A.escape the meaning of the next character
B.division
C.percentage
D.remainder
14. The VAR=$(date) is an example of:
A. variable substitution
B.command substitution
C.tilde substitution
D.alias substitution
15. What does the command tr -s “” do?
A.squeeze out multiple spaces from stdin
B.replace all s with “”
C.change single spaces into double spaces from stdin
D.translate spaces into s
16. Which command is used to pull out all lines of a file which contain a specified pattern?
A.pr
B.tr
C.wc
D.grep
17. How would you get a list of the absolute path names of all files in your home directory, which end in “.c”. The list is to be held in a file called outfile.
A.find $HOME -name “*.c”>outfile
B.find .-name *.c >outfile
C.find $HOME -name “*.c”2>outfile
D.find $home -name *.c >outfile
18. Assuming that the variable abc is not defined, what is returned by the command echo ‘$abc’?
A.blank
B. abc
C.an error message
D.$abc
19. What file name generation string would find all file names that start with “a” or “A”, end in “z”, and have exactly 5 characters in them?
A.[ aA] *z
B.aA???z
C.[ aA] ???z
D.[ aA] .*z
20. If you entered “cat myfile > yourfile” what would be the result on your screen?
A.the contents of myfile
B.the word “my file”
C.an error
D.nothing
21. What command combination would you use if you wanted a sorted listing of all processes belonging to users, whose names started with “user”, and you wanted the list a page at a time?
A.ps -ef |grep user |more
B.ps -ef |grep user |sort |more
C.ps -ef |sort |more
D.ps -ef |grep |sort |more
22. Which variables hold the string of all command line arguments and the number of them?
A.$# and $* respectively
B.$* and $0 respectively
C.$* and $# respectively
D.$0 and $# respectively
23. What does “test -d abcd” mean ?
A.does the variable abcd hold a value
B.is the file abcd executable
C.is the file abcd a directory
D.nothing -the syntax is wrong
24. How do you set a value into $? when returning from a shell script ?.
A.$?=value
B.set $?255
C.$? Can not be set
D.use the exit command
25. What is the purpose of a “continue” command?
A.to proceed with a shell script after a pause command
B.to continue processing an infinite loop from the current point
C.to go back to the start of a loop structure
D.to proceed with a shell script after a sleep command