LearnFrenzy
Sign in Take a free test

JavaScript Basics · Exercise 1 of 4

JavaScript Basics JavaScript Basics MCQ

  • 15 questions
  • Page 2 of 2
  • Answers explained
0Attempted
0Correct
0Wrong
Directions

Fifteen multiple-choice questions on JavaScript basics: engines and ECMAScript, Node.js, defer and async, identifiers and reserved words, comments, semicolons and ASI, template literals, typeof and strict mode. Pick an option to check your answer instantly.

Question 11 Easy

What does typeof function () {} return?

A "function"
B "object"
C "undefined"
D "method"
Question page & discussion
Question 12 Medium

What does console.log("Hi") return?

A "Hi"
B true
C undefined
D The number of characters printed
Question page & discussion
Question 13 Easy

Which line prints Total: 15 when a = 5 and b = 10?

A console.log(`Total: ${a + b}`);
B console.log("Total: ${a + b}");
C console.log('Total: {a + b}');
D console.log(`Total: #{a + b}`);
Question page & discussion
Question 14 Medium

A file containing document.title = "Home"; is run with node app.js. What happens?

A The terminal title changes to Home
B It works, because Node.js includes the DOM
C ReferenceError: document is not defined – the DOM is a browser API, not part of the language
D A SyntaxError before anything runs
Question page & discussion
Question 15 Hard

Line 1 of a script is console.log("start"); and line 40 has a missing closing bracket. What is printed when the script runs?

A Nothing: the SyntaxError is reported when the script is parsed, before line 1 runs
B "start", then a SyntaxError at line 40
C Lines 1 to 39 run, line 40 is skipped
D "start" only; the bad line is ignored
Question page & discussion
Up next · Exercise 2Predict the Output20 questions

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links