Web Programming (3160713) MCQs

MCQs of Client Side Scripting using JavaScript

Showing 1 to 10 out of 41 Questions
1.
When a user views a page containing a JavaScript program, which machine actually executes the script?
(a) The User's machine running a Web browser
(b) The Web server
(c) A central machine deep within Netscape's corporate offices
(d) None of the above
Answer:

Option (a)

2.
Which of the following can't be done with client-side JavaScript?
(a) Validating a form
(b) Sending a form's contents by email
(c) Storing the form's contents to a database file on the server
(d) None of the above
Answer:

Option (c)

3.
Which of the following is not a valid JavaScript variable name?
(a) 2names
(b) _first_and_last_names
(c) FirstAndLast
(d) None of the above
Answer:

Option (a)

4.
How does JavaScript store dates in a date object?
(a) The number of milliseconds since January 1st, 1970
(b) The number of days since January 1st, 1900
(c) The number of seconds since Netscape's public stock offering.
(d) None of the above
Answer:

Option (a)

5.
What is the correct JavaScript syntax to write "Hello World"?
(a) System.out.println("Hello World")
(b) println ("Hello World")
(c) document.write("Hello World")
(d) response.write("Hello World")
Answer:

Option (c)

6.
Inside which HTML element do we put the JavaScript?
(a) <js>
(b) <scripting>
(c) <script>
(d) <javascript>
Answer:

Option (c)

7.
What is the correct syntax for referring to an external script called " abc.js"?
(a) <script href="abc.js">
(b) <script name="abc.js">
(c) <script src="abc.js">
(d) None of the above
Answer:

Option (c)

8.
Which 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:1=("tim")2=("kim")3=("jim")
(c) var txt = new Array("tim","kim","jim")
(d) var txt = new Array="tim","kim","jim"
Answer:

Option (c)

9.

What does the tag

<noscript></noscript>

do?

(a)

Enclose text to be displayed by non-JavaScript browsers.

(b)

Prevents scripts on the page from executing.

(c)

Describes certain low-budget movies.

(d)

None of the above

Answer:

Option (a)

10.
If para1 is the DOM object for a paragraph, what is the correct syntax to change the text within the paragraph?
(a) "New Text"
(b) para1.value="New Text"
(c) para1.firstChild.nodeValue= "New Text";
(d) para1.nodeValue="New Text";
Answer:

Option (b)

Showing 1 to 10 out of 41 Questions