Test Your Knowledge

   

1:

You create a shell program and save it into a file with name " more ". Your current directory name is included in the PATH variable at the end. When you run this program by typing " more ", nothing happens and the cursor just stops at the next line. What may be the problem?

  1. You have written some commands in the program that the shell does not understand.

  2. The shell program file is not executable.

  3. You have used a program name that matches a standard HP-UX command.

  4. There is a problem with your terminal and you need to reset it.

2:

What is true about variables used in shell programs?

  1. Variables starting with letters can be used in programs.

  2. Values of variables can be changed in the programs.

  3. The shell can read and modify environment variables for its own use.

  4. All of the above.

3:

You use the echo $? command. The result is 2 . What do you conclude from this?

  1. The echo command printed the number of characters in its first argument.

  2. The last command terminated abnormally.

  3. The " ? " symbol has an ASCII value equal to 2.

  4. None of the above.

4:

You used shift 3 in your shell program. What will be its effect?

  1. It will shift the first three command line arguments to the left.

  2. It will shift the last three command line arguments to the left.

  3. It will shift all command line arguments by three places toward the left.

  4. It will shift all command line arguments by three places toward the right.

5:

What does the echo "\a" command do?

  1. It prints the character a .

  2. It prints the character \a .

  3. It prints a hexadecimal character " a " that represents decimal 10.

  4. It gives a beep sound.

6:

What is wrong with the command [ "ABC" -eq "ABC" ]?

  1. You are comparing strings with a numeric operator.

  2. The same string is used on both sides of the operator.

  3. The quotation marks are not needed here.

  4. Parentheses should be used instead of square brackets.

7:

A shell script with the name myscript does not have the execution bit set. How can you execute it?

  1. exec myscript

  2. sh myscript

  3. run myscript

  4. No shell script can be executed until its execution bit is set.

8:

How can you list all command line arguments?

  1. using $*

  2. using $#

  3. using the shift command

  4. using the list command

9:

The true return value of the test command is:

  1. 1

  2. any positive number

  3. any number not equal to zero

10:

You have a shell script as shown here. What will be the result when it is executed?

 #!/usr/bin/sh ABC=aac case $ABC in   a)     echo "First"          ;; [aa]c)   echo "Second"          ;; a*)      echo "Third"          ;; *)       echo "Last"          ;; esac 
  1. First

  2. Second

  3. Third

  4. Last


   
Top


HP Certified
HP Certified: HP-UX System Administration
ISBN: 0130183741
EAN: 2147483647
Year: 2000
Pages: 390
Authors: Rafeeq Rehman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net