JAVASCRIPT CORE EXAM SET 2026/2027 QUESTIONS AND
SOLUTIONS RATED A+
✔✔10. How do you write a conditional statement for executing some statements only if
"i" is NOT equal to 5?
a) if (i != 5)
b) if =! 5 then
c) if (i <> 5)
d) if <>5 - ✔✔a) if (i != 5)
✔✔11. How many looping statements are there in JavaScript?
a) 2. The "for" loop, and the "while" loop
b) 4. The "for" loop, the "while" loop, the "do...while" loop, and the "loop...until" loop
c) 3. The "for" loop, the "while" loop, and the "do...while" loop
d) The "for" loop - ✔✔c) 3. The "for" loop, the "while" loop, and the "do...while" loop
✔✔12. How does a "for" loop start?
a) for (i = 0; i <= 5)
b) for (i = 0; i <= 5; i++)
c) for i = 1 to 5
d) for (i <= 5; i++) - ✔✔b) for (i = 0; i <= 5; i++)
✔✔13. How can you add a comment in a JavaScript?
a) //This is a comment
b) 'This is a comment
c) <!--This is a comment-->
d) #This is a comment - ✔✔a) //This is a comment
✔✔14. What is the correct JavaScript syntax to insert a comment that has more than
one line?
a) /*This comment has
more than one line*/
b) <!--This comment has
more than one line-->
c) //This comment has
more than one line//
d) ##This comment has
##more than one line - ✔✔a) /*This comment has
more than one line*/
✔✔15. What is the correct way to write a JavaScript array?
a) var txt = new Array(1:"tim",2:"kim",3:"jim")
b) var txt = new Array="tim","kim","jim"
c) var txt = new Array:1=("tim")2=("kim")3=("jim")
, d) var txt = new Array("tim","kim","jim") - ✔✔d) var txt = new Array("tim","kim","jim")
✔✔16. How do you round the number 7.25, to the nearest whole number?
a) Math.rnd(7.25)
b) round(7.25)
c) rnd(7.25)
d) Math.round(7.25) - ✔✔d) Math.round(7.25)
✔✔17. How do you find the largest number of 2 and 4?
a) Math.ceil(2,4)
b) Math.max(2,4)
c) ceil(2,4)
d) top(2,4) - ✔✔b) Math.max(2,4)
✔✔18. What is the correct JavaScript syntax for opening a new window called
"window2" ?
a) open.new("http://www.w3schools.com","window2")
b) new("http://www.w3schools.com","window2")
c) new.window("http://www.w3schools.com","window2")
d) window.open("http://www.w3schools.com","window2") - ✔✔d)
window.open("http://www.w3schools.com","window2")
✔✔19. How do you put a message in the browser's status bar?
a) statusbar = "put your message here"
b) window.status("put your message here")
c) window.status = "put your message here"
d) status("put your message here") - ✔✔c) window.status = "put your message here"
✔✔20. How do you find the client's browser name?
a) client.navName
b) navigator.appName
c) browser.name
d) Browser.value - ✔✔b) navigator.appName
✔✔21. What are the basic ways that people can become aware of your Web site?
a) URL is told by somebody.
b) The link is followed from another Web site.
c) Your site is listed in a search engine.
d) All of the above. - ✔✔d) All of the above.
✔✔22. What are the basic ways to provide hints for search engines?
a) Put keywords in the <TITLE> tag of the Web page.
b) Put keywords in the first few lines of the Web page.
c) Put keywords as many times as possible in the Web page.
SOLUTIONS RATED A+
✔✔10. How do you write a conditional statement for executing some statements only if
"i" is NOT equal to 5?
a) if (i != 5)
b) if =! 5 then
c) if (i <> 5)
d) if <>5 - ✔✔a) if (i != 5)
✔✔11. How many looping statements are there in JavaScript?
a) 2. The "for" loop, and the "while" loop
b) 4. The "for" loop, the "while" loop, the "do...while" loop, and the "loop...until" loop
c) 3. The "for" loop, the "while" loop, and the "do...while" loop
d) The "for" loop - ✔✔c) 3. The "for" loop, the "while" loop, and the "do...while" loop
✔✔12. How does a "for" loop start?
a) for (i = 0; i <= 5)
b) for (i = 0; i <= 5; i++)
c) for i = 1 to 5
d) for (i <= 5; i++) - ✔✔b) for (i = 0; i <= 5; i++)
✔✔13. How can you add a comment in a JavaScript?
a) //This is a comment
b) 'This is a comment
c) <!--This is a comment-->
d) #This is a comment - ✔✔a) //This is a comment
✔✔14. What is the correct JavaScript syntax to insert a comment that has more than
one line?
a) /*This comment has
more than one line*/
b) <!--This comment has
more than one line-->
c) //This comment has
more than one line//
d) ##This comment has
##more than one line - ✔✔a) /*This comment has
more than one line*/
✔✔15. What is the correct way to write a JavaScript array?
a) var txt = new Array(1:"tim",2:"kim",3:"jim")
b) var txt = new Array="tim","kim","jim"
c) var txt = new Array:1=("tim")2=("kim")3=("jim")
, d) var txt = new Array("tim","kim","jim") - ✔✔d) var txt = new Array("tim","kim","jim")
✔✔16. How do you round the number 7.25, to the nearest whole number?
a) Math.rnd(7.25)
b) round(7.25)
c) rnd(7.25)
d) Math.round(7.25) - ✔✔d) Math.round(7.25)
✔✔17. How do you find the largest number of 2 and 4?
a) Math.ceil(2,4)
b) Math.max(2,4)
c) ceil(2,4)
d) top(2,4) - ✔✔b) Math.max(2,4)
✔✔18. What is the correct JavaScript syntax for opening a new window called
"window2" ?
a) open.new("http://www.w3schools.com","window2")
b) new("http://www.w3schools.com","window2")
c) new.window("http://www.w3schools.com","window2")
d) window.open("http://www.w3schools.com","window2") - ✔✔d)
window.open("http://www.w3schools.com","window2")
✔✔19. How do you put a message in the browser's status bar?
a) statusbar = "put your message here"
b) window.status("put your message here")
c) window.status = "put your message here"
d) status("put your message here") - ✔✔c) window.status = "put your message here"
✔✔20. How do you find the client's browser name?
a) client.navName
b) navigator.appName
c) browser.name
d) Browser.value - ✔✔b) navigator.appName
✔✔21. What are the basic ways that people can become aware of your Web site?
a) URL is told by somebody.
b) The link is followed from another Web site.
c) Your site is listed in a search engine.
d) All of the above. - ✔✔d) All of the above.
✔✔22. What are the basic ways to provide hints for search engines?
a) Put keywords in the <TITLE> tag of the Web page.
b) Put keywords in the first few lines of the Web page.
c) Put keywords as many times as possible in the Web page.