Test Your Knowledge

   

1:

Which command will you use to add the values of two variables VAR1 and VAR2 , and store the result in VAR3 ?

  1. [ $VAR3 = $VAR1 + $VAR2 ]

  2. $VAR3 = [ $VAR1 + $VAR2 ]

  3. $VAR3 = (( VAR1 + VAR2 ))

  4. $VAR3 = VAR1 + VAR2 ))

2:

You want to wait for 10 seconds at the end of the loop in each loop cycle. Which command will you use?

  1. sleep

  2. pause

  3. wait

  4. Any of the three commands can be used.

3:

Consider the following code segment. How many times does the loop execute?

 A=1 until [ $A < 10 ] do    echo $A    (( $A=$A+1)) done 
  1. zero

  2. one

  3. nine

  4. ten

4:

What will be the output of the program shown here?

 #!/usr/bin/sh A=1 while [ $A -lt 10 ] do    B=1    while [ $B -lt 10 ]    do       break 2       echo "Inner loop"    done    echo "Outer Loop" done 
  1. " Inner Loop " will be printed 10 times.

  2. " Outer Loop " will be printed 10 times.

  3. " Outer Loop " will be printed 9 times.

  4. Nothing will be printed.

5:

While writing a program, you meet a situation where you want to break the normal execution and shift control to the beginning of the loop, skipping the remaining commands in the loop. Which command will you use?

  1. break

  2. continue

  3. exit

  4. shift


   
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