Home > Articles

  • Print
  • + Share This
This chapter is from the book

Workshop

Quiz questions and exercises to test your understanding and to stretch your skills.

Quiz

  1. How is “greater than or equal to” expressed in JavaScript?

    1. >

    2. >=

    3. >==

  2. What command forces the cancellation of a loop and moves code operation to the statement after the closing brace?

    1. break;

    2. loop;

    3. close;

  3. Which of the following is likely to cause an infinite loop to occur?

    1. The wrong sort of loop has been used.

    2. The condition to terminate the loop is never met.

    3. There are too many statements in the loop.

  4. If no specified case is matched in a switch statement,

    1. An error will be generated.

    2. The optional default case will execute, if one is present.

    3. The obligatory default case is executed.

  5. The statements in a do ... while clause

    1. Will always be executed at least once

    2. May be executed zero or more times

    3. Will continue to be executed until a break statement is encountered

Answers

  1. b. JavaScript interprets >= as “greater than or equal to.”

  2. a. The break command ends loop execution.

  3. b. An infinite loop occurs if the condition to terminate the loop is never met.

  4. b. The optional default case will execute, if one is present.

  5. a. The statements in a do ... while clause will always be executed at least once.

  • + Share This
  • 🔖 Save To Your Account