ProTechSolution
Home
Courses
Exercises
Quiz
Roadmaps
Experts
Login
Sign Up
Bootstrap 5 UI
Programming Concepts
HTML & CSS Masterclass
HTML
CSS
JavaScript
PHP
MySQL
Bootstrap 5
C#
JavaScript Certification Quiz
Test your knowledge to earn your official course certificate!
1. How can you add a comment in a JavaScript?
'This is a comment
<!--This is a comment-->
//This is a comment
**This is a comment**
2. How does a FOR loop start?
for (i <= 5; i++)
for (i = 0; i <= 5)
for (i = 0; i <= 5; i++)
for i = 1 to 5
3. Where is the correct place to insert a JavaScript?
The <body> section
The <head> section
Both the <head> section and the <body> section are correct
Outside the <html> tag
4. What will the following code return: Boolean(10 > 9)
true
false
NaN
undefined
5. How do you declare a JavaScript variable?
v carName;
variable carName;
var carName;
declare carName;
6. How does a WHILE loop start?
while (i <= 10; i++)
while i = 1 to 10
while (i <= 10)
while (i++)
7. The external JavaScript file must contain the <script> tag.
True
False
Only in old browsers
Sometimes
8. Inside which HTML element do we put the JavaScript?
<javascript>
<scripting>
<js>
<script>
9. Which event occurs when the user clicks on an HTML element?
onmouseclick
onchange
onclick
onmouseover
10. How to write an IF statement in JavaScript?
if i = 5 then
if (i == 5)
if i == 5 then
if i = 5
11. How do you find the number with the highest value of x and y?
top(x, y)
Math.max(x, y)
Math.ceil(x, y)
ceil(x, y)
12. How to write an IF statement for executing some code if 'i' is NOT equal to 5?
if (i != 5)
if i =! 5 then
if (i <> 5)
if i <> 5
13. Which operator is used to assign a value to a variable?
-
*
x
=
14. How can you detect the client's browser name?
navigator.appName
browser.name
client.navName
window.browser
15. What is the correct syntax for referring to an external script called 'xxx.js'?
<script href='xxx.js'>
<script name='xxx.js'>
<script src='xxx.js'>
<script file='xxx.js'>
16. JavaScript is the same as Java.
True
False
Mostly True
Only in Netscape
17. How do you round the number 7.25, to the nearest integer?
Math.rnd(7.25)
Math.round(7.25)
round(7.25)
rnd(7.25)
18. What is the correct way to write a JavaScript array?
var colors = 1 = ('red'), 2 = ('green'), 3 = ('blue')
var colors = ['red', 'green', 'blue']
var colors = (1:'red', 2:'green', 3:'blue')
var colors = 'red', 'green', 'blue'
19. How do you call a function named 'myFunction'?
call function myFunction()
myFunction()
call myFunction()
execute myFunction()
20. How do you write 'Hello World' in an alert box?
alertBox('Hello World');
msg('Hello World');
alert('Hello World');
msgBox('Hello World');
Submit Quiz (20 Questions)