Web Programming (3160713) MCQs

MCQs of Client Side Scripting using JavaScript

Showing 21 to 30 out of 41 Questions
21.
How do you write "Hello World" in an alert box?
(a) alert("Hello World");
(b) alertBox("Hello World");
(c) msg("Hello World");
(d) msgBox("Hello World");
Answer:

Option (a)

22.
How do you create a function in JavaScript?
(a) function=myFunction()
(b) function myFunction()
(c) function:myFunction()
(d) none
Answer:

Option (b)

23.
How do you call a function named "myFunction"?
(a) call myFunction()
(b) myFunction()
(c) call function myFunction()
(d) function myFunction()
Answer:

Option (b)

24.
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
Answer:

Option (b)

25.
How do you round the number 7.25, to the nearest integer?
(a) Math.round(7.25)
(b) rnd(7.25)
(c) Math.rnd(7.25)
(d) round(7.25)
Answer:

Option (a)

26.
How can you detect the client's browser name?
(a) browser.name
(b) client.navName
(c) navigator.appName
(d) window.appName
Answer:

Option (c)

27.
<script type="text/javascript" language="javascript">

var qpt = "Darshan Engg College";
var result = qpt.split(" ");
document.write(result); 
</script>

Output?

(a)

Darshan

(b)

D,a,r,s,h,a,n, ,E,n,g,g, ,C,o,l,l,e,g,e

(c)

Darshan,Engg,College

(d)

D,a,r,s,h,a,n,E,n,g,g,C,o,l,l,e,g,e

Answer:

Option (c)

28.
Is it possible to nest functions in JavaScript?
(a) True
(b) False
Answer:

Option (a)

29.

<script type="text/javascript" language="javascript">

var qpt="Darshan Engg College"; 
alert(qpt.charAt(qpt.length-1));
</script>

Output?

(a)

p

(b)

e

(c)

s

(d)

Error

Answer:

Option (b)

30.
What is mean by "this" keyword in javascript?
(a) It refers current object
(b) It referes previous object
(c) It is variable which contains value
(d) None of the above
Answer:

Option (a)

Showing 21 to 30 out of 41 Questions