Homework Quiz Review & Solutions

Variables Quiz

  1. let name = 'Jane';

    What process does the code above perform?

  2. let name;

    What process does the code above perform?

  3. Which operator is used to perform variable assignment?

  4. What will the code above print out?
  5. What will the code above print out?
  6. What will the code above print out?
  7. What will the code above print?
  8. What will the code above print out?

Control Flow Quiz

  1. let groceries = ["apples", "potatoes", "milk"]; What is the above groceries variable?
  2. Predict what will happen in the above example. Which console.logs will actually print?

  3. let groceries = ["apples", "potatoes", "milk"];

    Which of the following are the correct ways to access the value of “milk” in the above groceries array?

  4. let puppies = ["Laser", "Katy", "Jet", "Layla"];

    What is the value we’d receive if we read the value at puppies[1]?

  5. In the code snippet above we have written a function that accepts one word and if that word is “potato” the potatoSpeak function is called - otherwise the sadSpeak function is called. The condition inside the isThisPotato function above is an example of what kind of conditional?

  6. Fill in the blank for the following: A(n) _ is an ordered list of values defined by using square brackets.

Comparison Operators Quiz

  1. console.log(25 % 2 === 0); What will the code above print out?
  2. console.log(42 === '42'); What will the code above print out?
  3. console.log(true || (4 / 2 === 0 && !false)); What will the code above print out?
  4. console.log(42 === 42); What will the code above print out?
  5. console.log(42 == '42'); What will the code above print out?
  6. console.log(true && (4 + 2 === 5)); What will the code above print out?
  7. console.log((24 > 3) && false); What will the code above print out?
  8. console.log(26 % 2 === 0); What will the code above print out?