Javascript practice quiz
16. How do you round the number 7.25, to the nearest integer? Math.round(7.25) Math.rnd(7.25) rnd(7.25) round(7.25)
...
17. How do you find the number with the highest value of x and y? Math.ceil(x,y) Math.max(x,y) ceil(x,y) top(x,y)
...
18. What is the correct JavaScript syntax for opening a new window called "w2" ? w2=window.open("http://www.w3schools.com"); w2=window.new("http://www.w3schools.com");
...
JavaScript is a _____-side scripting language
client
20. How can you find a client's browser name? navigator.appName client.navName browser.name
...
4. What is the correct syntax for referring to an external script called "xxx.js"? <script type="text/javascript" href="xxx.js"> <script type="text/javascript" src="xxx.js"> <script type="text/javascript" name="xxx.js">
...
9. How do you put a message in the browser's status bar? statusbar = "put your message here" window.status = "put your message here" window.status("put your message here") status("put your message here")
...
How can you add a comment in a JavaScript? //This is a comment <!--This is a comment--> 'This is a comment
...
How do you call a function named "myFunction"? call function myFunction myFunction() call myFunction()
...
How do you create a function? function=myFunction() function myFunction() function:myFunction()
...
How do you write "Hello World" in an alert box? alert("Hello World") msgBox("Hello World") alertBox="Hello World" alertBox("Hello World")
...
How do you write a conditional statement for executing some code if "i" is NOT equal to 5? if <>5 if (i <> 5) if =! 5 then if (i != 5)
...
How do you write a conditional statement for executing some code if "i" is equal to 5? if i==5 then if i=5 if i=5 then if (i==5)
...
How does a "for" loop start? for (i = 0; i <= 5; i++) for (i <= 5; i++) for (i = 0; i <= 5) for i = 1 to 5
...
How does a "while" loop start? while i=1 to 10 while (i<=10) while (i<=10;i++)
...
Inside which HTML element do we put the JavaScript? <script> <javascript> <scripting> <js>
...
The external JavaScript file must contain the <script> tag False True
...
What is the correct JavaScript syntax to insert a comment that has more than one line? /*This comment has more than one line*/ //This comment has more than one line// <!--This comment has more than one line-->
...
What is the correct JavaScript syntax to write "Hello World"? response.write("Hello World") document.write("Hello World") "Hello World" ("Hello World")
...
What is the correct way to write a JavaScript array? var txt = new Array="tim","kim","jim" var txt = new Array("tim","kim","jim") var txt = new Array:1=("tim")2=("kim")3=("jim") var txt = new Array(1:"tim",2:"kim",3:"jim")
...
Where is the correct place to insert a JavaScript? The <head> section Both the <head> section and the <body> section are correct The <body> section
...
what was the first browser to support javascript
...
which company first implemented javascript
...
variable
A named element in a program that stores information
javascript
An object-based scripting language used to manipulate objects associated with web page documents
types of message boxes in javascript
alert, confirm, prompt
object and method language
document.write("text or HTML"); use parenthesis and end with a semi-colon no line breaks
is javascript case sensitive
no
syntax
set of rules that define a correctly structured program
Document object
the container for all HTML HEAD and BODY objects associated within the HTML tags of an HTML document