Home » Quiz & Trivia » JavaScript » JavaScript Quiz with answers – Part 1

JavaScript Quiz with answers – Part 1

Practical questions to test your knowledge of JavaScript programming – Part 1

In which HTML tag do we place the JavaScript code?
js tag
javascript tag
script
rel

Correct!

Wrong!

How do you call a function called "sum"?
sum()
call function sum()
call sum()
None of these answers is true.

Correct!

Wrong!

What is the correct syntax for referring to an external script called "myscript.js"?
<script href="myscript.js">
<script name="myscript.js">
<script src="myscript.js">
All the answers are true

Correct!

Wrong!

Should the external JavaScript file contain the <script> tag?
True
False

Correct!

Wrong!

Where is the right place to insert JavaScript code?
The section
Both sections and are correct
The section
None of these answers is true.

Correct!

Wrong!

How do you write "Hello World" in an alert box?
msg("Hello World");
alert("Hello World");
msgBox("Hello World");
alertBox("Hello World");

Correct!

Wrong!

How to write an IF condition in JavaScript?
if a = 2 then
if a = 2
if a == 2 else
if (a == 2)

Correct!

Wrong!

How to write an IF condition to check if "a" is NOT equal to 2?
if a <> 2
if (a != 2)
if a =! 2 then
if (a <> 2)

Correct!

Wrong!

How to create a function in JavaScript?
function f()
function = f()
function:f()
None of these answers is true.

Correct!

Wrong!

What is the correct syntax to check the value of "c"?
if (c == "XYZ") then { } else { }
if (c = "XYZ") then { } else { }
if (c == "XYZ") { } else { }
if (c = "XYZ") { } else { }

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

JavaScript Quiz – Part 1

I got %%score%% of %%total%% right

%%description%%

%%description%%

Loading...

Leave a Reply

Your email address will not be published. Required fields are marked *

*