LearnFrenzy
Sign in Take a free test

JavaScript Basics · Exercise 1 of 4

JavaScript Basics JavaScript Basics MCQ

  • 15 questions
  • Page 1 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 1 Easy

Which JavaScript engine is used by both Google Chrome and Node.js?

A SpiderMonkey
B JavaScriptCore
C Chakra
D V8
Question page & discussion
Question 2 Easy

Which statement about JavaScript is true?

A It is statically typed like Java
B It is dynamically typed and runs your code on a single thread with an event loop
C It must be compiled to an .exe before it can run
D It can run only inside a web browser
Question page & discussion
Question 3 Easy

How is JavaScript related to ECMAScript?

A ECMAScript is the standard specification; JavaScript is an implementation of it
B ECMAScript is a JavaScript library like jQuery
C ECMAScript is the server-side version of JavaScript
D They are two unrelated languages
Question page & discussion
Question 4 Medium

Three scripts in the <head> depend on each other and must run in order, after the HTML is parsed, without blocking parsing while they download. Which attribute should they use?

A async
B No attribute
C defer
D nomodule
Question page & discussion
Question 5 Easy

Which of these is a valid JavaScript variable name?

A 2ndPrice
B $price_2
C final-price
D new
Question page & discussion
Question 6 Medium

Which of these words is reserved and can never be used as a variable name?

A undefined
B name
C typeof
D of
Question page & discussion
Question 7 Medium

What happens with the line /* outer /* inner */ still outer */ in a script?

A The whole line is one comment
B Only "inner" is treated as a comment
C A SyntaxError: the comment ends at the first */, so "still outer */" is parsed as code
D The engine ignores the line and prints a warning
Question page & discussion
Question 8 Medium

Which statement about Automatic Semicolon Insertion (ASI) is correct?

A ASI inserts a semicolon at the end of every line
B ASI never applies to return statements
C A line break directly after return always ends the statement, so the function returns undefined
D ASI is disabled in strict mode
Question page & discussion
Question 9 Easy

In strict mode, what happens when you assign to a variable that was never declared, e.g. total = 50;?

A A global variable named total is created
B The assignment is ignored silently
C A ReferenceError is thrown
D total becomes a constant
Question page & discussion
Question 10 Hard

Which code runs in strict mode even without a "use strict" directive?

A Arrow functions
B ES modules and the bodies of classes
C Any code inside a try block
D Code that uses let and const
Question page & discussion

Ready to test your Programming?

Timed online tests with instant scores and explanations.

Search LearnFrenzy

Esc

Quick links