Single Choice Question

  1. Which statement is not belong to the loop statement
    1. for
    2. while
    3. do...while
    4. if...else...
  2. Which follows is true about loop statement
    1. For loop is used to iterate over a block of code a specified number of times.
    2. While loop is used to iterate over a block of code until a specified condition is met.
    3. For loop is more efficient than while loop.
    4. While loop is more efficient than for loop.
  3. Which statement is not belong to the conditional statement
    1. if...else
    2. switch...case
    3. for...in
    4. if...
  4. Which loop statement will execute the loop body at least once
    1. for
    2. while
    3. do...while
    4. for...in
  5. Which statement is not belong to the jump statement
    1. break
    2. return
    3. throw
    4. jump js中不存在
  6. The if...else...statement belong to
    1. Single conditional statement
    2. Loop statement
    3. Multiple statement
    4. Double conditional statement

True or False Question

  1. The statement "do...while" will execute the loop body at least once. True
  2. Empty statement is not allowed in a loop body. False
  3. Every statement must be ended with a semicolon. True
  4. Break statement can only be used in a loop body. False switch也可以用
  5. Nest loop or conditional statement with too many levels is not a good practice. True
  6. The for-in loop is a special type of loop that iterates over the properties of an object, or the elements of an array. True
  7. The for...of loop doesn't work with objects because they are not iterable. True

Definition of Term

  1. Break statement
  2. Continue statement

Short Answer

  1. How many ways to write a conditional statement?
  2. How many ways to write a loop statement?
  3. What are the differences between for and while loop?
  4. What are the differences between break and continue in a loop?
  5. What are the differences between for...in and for...of?

Programming

  1. Write code to determine if the user's input number is positive, negative, or 0. If it is non-zero, parity still needs to be determined.
  2. Write code to output the level of the input score, 0-59 is F, 60-69 is D, 70-79 is C, 80-89 is B, 90-100 is A.
  3. Write code to output the first 10 Fibonacci numbers.
  4. Write code to determine the input year from user is leap year or not repeatedly until user input 'q'.
  5. Write code to output the first 10 prime numbers.
  6. Get a number from the user then output the sum of all the digits of the integral value, for example, if the user input "1234", your program will output 10.