nerdexam
IBM

C9010-022 · Question #88

Why does the following ksh code segment fail to run? if [ $src -eq 0 ]; then echo "command completed successfully." exit $src elseIf [ $src -eq 101 ]; then echo "command failed with debug return…

The correct answer is C. The 'elseif' keyword is not valid within ksh scripts. See the full explanation below for the reasoning.

Question

Why does the following ksh code segment fail to run? if [ $src -eq 0 ]; then echo "command completed successfully." exit $src elseIf [ $src -eq 101 ]; then echo "command failed with debug return code 101." exit $src fi

Options

  • AAn alphanumeric operator is being used to compare the integer variable.
  • BThe 'if' statement must be terminated with an 'end' keyword.
  • CThe 'elseif' keyword is not valid within ksh scripts.
  • DThe segment is missing an 'else' default statement.

How the community answered

(24 responses)
  • A
    13% (3)
  • B
    4% (1)
  • C
    79% (19)
  • D
    4% (1)

Community Discussion

No community discussion yet for this question.

Full C9010-022 Practice