11. How many times will the following code print the word 'Hello'?

var i = 0;
while(i < 3) {
console.log("Hello");
i++;
}

  • 1
  • 2
  • 3
  • 4

12. How many times will the following code print the word 'Hello'?

for (i = 0; i < 2; i++) {
for (var j = 0; j < 3; j++) {
console.log("Hello");
}
}

  • 2
  • 3
  • 4
  • 6

13. Based on the following code, what will print out when the variable i has the value 7 ?

if(i <= 5) {
console.log("Hello");
} else if(i <= 10) {
console.log("Goodnight");
} else {
console.log("Goodbye");
}

  • Hello
  • Goodnight
  • Goodbye

14. Based on the following code, what will print out when the variable i has the value 3 ?

switch(i) {
case 1: console.log("Hello");
break;
case 2:
console.log("Goodnight");
break;
case 3:
console.log("Goodbye");
break;
}

  • Hello
  • Goodnight
  • Goodbye

15. Based on the following code, what will print out when the variable i has the value 3 ?

if(i == 2 || i == 3) {
console.log("Hello");
} else {
console.log("Goodbye");
}

  • Hello
  • Goodbye

Module quiz: Introduction to JavaScript

16. You can run JavaScript in a web browser's devtools console.

  • true
  • false

17. Which of the following are valid comments in JavaScript? Select all that apply.

  •  \ Comment 1
  • // Comment 2
  •  ##
    ## Comment 3
    ##
  • /*
    * Comment 4
    */

18. Which of the following are valid data types in JavaScript? Select all that apply.

  • string
  • numbers
  • booleans
  • null

Shuffle Q/A 2

19. Which of the following is the logical AND operator in JavaScript?

  • &
  • &&
  • ||
  • |\

20. Which of the following is the assignment operator in JavaScript?

  • =
  • ==
  • ===

Leave a Reply