Unix Commands  «Prev  Next»

Debugging Shell Scripts - Quiz

 
Each question is worth one point. Select the best answer or answers for each question.

1. Which of the following commands resets the trap for signal 2 back to normal system behavior?
Please select the best answer.
  A. trap 2
  B. trap 2
  C. trap 'echo error' 2
  D. trap 'r 2

2. Which of the following lines of code does not contain a syntax error?
Please select the best answer.
  A.
if [ $answer =   'yes'   ]
then
  echo 'yahoo'
fi
  B.
if [ $answer ='yes'   ]
then
  echo 'yahoo'
fi
  C.
while [ $answer = 'yes' ]
  echo 'yahoo'
done
  D.
while [$answer = 'yes' ]
do
  echo 'yahoo'
done

3. Which type of error is usually the easiest to spot in a shell script?
Please select the best answer.
  A. Logic
  B. Robust
  C. Syntax
  D. Run-time

Correct answers:

Your Score: 0