0% found this document useful (0 votes)
10 views3 pages

JavaScript Basics: Key Concepts & Syntax

The document covers basic JavaScript concepts including file extensions, HTML elements for JavaScript code, comments, variable declarations, operators, and type checking. It includes multiple-choice questions to test knowledge on these topics. Key concepts include variable scope, strict equality, and the behavior of different operators.

Uploaded by

sg21cse014
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

JavaScript Basics: Key Concepts & Syntax

The document covers basic JavaScript concepts including file extensions, HTML elements for JavaScript code, comments, variable declarations, operators, and type checking. It includes multiple-choice questions to test knowledge on these topics. Key concepts include variable scope, strict equality, and the behavior of different operators.

Uploaded by

sg21cse014
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

JavaScript Basics

Which of the following is the correct extension of JavaScript files?

.java
.js
.javascript
.script

Inside which HTML element do we place JavaScript code?

<js>
<script>
<javascript>
<code>

Which symbol is used for single-line comments in JavaScript?

//
/* */
<!-- -->

Which company developed JavaScript?

Microsoft
Netscape
Sun Microsystems
Oracle

What is the output of [Link](typeof null); ?

"null"
"object"
"undefined"
"boolean"

Variables

Which keyword is used to declare a variable that cannot be reassigned?

var
let
const
final

What will be the output?


var x;
[Link](x);

null
undefined
0
ReferenceError

Which is the correct way to declare multiple variables in one line?

var a, b, c;
let a b c;
const a = b = c;
var: a, b, c;

What is the scope of variables declared with var?

Block scope
Function scope
Global scope only
Module scope

Which declaration will throw an error if reassigned?

var a = 10;
let b = 20;
const c = 30;
let d;

Operators

Which operator is used for strict equality comparison?

=
==
===
!=

What is the output of 2 + "2" in JavaScript?

22
4
"4"
NaN

Which operator is used to find the remainder of division?

%
/
//
div

What is the result of true && false?

true
false
undefined
error

Which of the following is a ternary operator?

?:
??
=>
===

More JavaScript Concepts


What will typeof NaN return?

"undefined"
"NaN"
"object"
"number"

What is the result of 5 == "5" ?

true
false
undefined
error

Which operator returns true if either condition is true?

&&
||
==
!==

What does typeof [] return?

"object"
"array"
"list"
"undefined"

Which of the following is NOT a valid JavaScript operator?

++
**
<>

You might also like