JQUERY Multiple Choice Questions :-
1) jQuery is a
a). JavaScript Library. b).JavaScript Language c).JavaScript Method
d). PHP Method
Ans: a
2. jQuery uses CSS selectors to select elements?
A. False
B. True
Ans:B
3. Which sign does jQuery use as a shortcut for jQuery?
A. the % sign
B. the ? Sign
C. the $ sign
Ans: C
4. With jQuery, look at the following selector: $(“div”). What
does it select?
A. All div elements
B. The first div element
Ans: A
5. Is jQuery a library for client scripting or server scripting?
A. Server scripting
B. Client scripting
Ans:A
6. Is it possible to use jQuery together with AJAX?
A. No
B. Yes
Ans:B
7. The jQuery html() method works for both HTML and XML
documents
A. False
B. True
Ans:A
8. What is the correct jQuery code to set the background color
of all p elements to red?
A. $(“p”).layout(“background-color”,”red”);
B. $(“p”).manipulate(“background-color”,”red”);
C. $(“p”).css(“background-color”,”red”);
D. $(“p”).style(“background-color”,”red”);
Ans:C
9. With jQuery, look at the following selector: $(“div.intro”).
What does it select?
A. The first div element with class=”intro”
B. The first div element with id=”intro”
C. All div elements with class=”intro”
D. All div elements with id=”intro”
Ans:C
10. Which jQuery method is used to hide selected elements?
A. hidden()
B. hide()
C. visible(false)
D. display(none)
Ans:B
JQUERY MCQs
11. Which jQuery method is used to set one or more style
properties for selected elements?
A. css()
B. html()
C. style()
Ans:A
12. Which jQuery method is used to perform an asynchronous
HTTP request?
A. jQuery.ajaxAsync()
B. jQuery.ajax()
C. jQuery.ajaxSetup()
Ans:B
13. What is the correct jQuery code for making all div elements
100 pixels high?
A. $(“div”).height=”100″
B. $(“div”).height(100)
C. $(“div”).yPos(100)
Ans:C
14. Which statement is true?
A. To use jQuery, you must buy the jQuery library at www.jquery.com
B. To use jQuery, you do not have to do anything. Most browsers
(Internet Explorer, Chrome, Firefox and Opera) have the jQuery
library built in the browser
C. To use jQuery, you can refer to a hosted jQuery library at Google
Ans: A
15. What scripting language is jQuery written in?
A. VBScript
B. JavaScript
C. C#
D. C++
Ans: B
16. Which jQuery function is used to prevent code from
running, before the document is finished loading?
A. $(document).load()
B. $(document).ready()
C. $(body).onload()
Ans:C
17. Which jQuery method should be used to deal with name
conflicts?
A. noNameConflict()
B. noConflict()
C. nameConflict()
D. conflict()
Ans:D
18. Which jQuery method is used to switch between
adding/removing one or more classes (for CSS) from selected
elements?
A. toggleClass()
B. switch()
C. altClass()
D. switchClass()
Ans: D
19. Look at the following jQuery selector: $(“div#intro .head”).
What does it select?
A. The first element with id=”head” inside any div element with
class=”intro”
B. All elements with class=”head” inside the first div element with
id=”intro”
C. All div elements with id=”intro” or class=”head”
Ans:C
20. Is jQuery a W3C standard?
A. No
B. Yes
Ans: B
21. Which statement best explains what “unobtrusive
JavaScript” is?
A. JavaScript that doesn’t annoy users
B. JavaScript that is separate from HTML
C. JavaScript that does not affect a web page
D. JavaScript that works even with scripting turned off
Ans: B
22. Which of these is NOT a valid comment in JavaScript?
A. // This is a comment
B. /* This is a comment. */
C. /* This is a comment
D. .<!– This is a comment.
Ans: C
23. How do you use JavaScript within CoffeeScript code?
A. Use the JavaScript keyword
B. Wrap the code in<script>// <![CDATA[ tags C. Wrap the
code in backticks or grave accents [`] D. You can’t embed JavaScript
code within CoffeeScript Ans: C 24. In JavaScript, we can keep a
reference to the context outside a function by assigning it to a
variable: var self = this. In CoffeeScript, we use: A. self = this
printScope -> console.log self
B. printScope => console.log @
C. printScope => console.log this
D. All of the above
Ans: D
25. What is the correct JavaScript syntax to write “Hello
World”?
A. document.write(“Hello World”)
B. (“Hello World”)
C. response.write(“Hello World”)
D. “Hello World”
Ans: A
26. jQuery is a…
A. JavaScript library
B. Ruby Gem
C. PHP Framework
D. None of the above
Ans: A
27. jQuery’s main focus is..
A. AJAX
B. DOM Manipulation
C. Animations
D. All of the above
Ans: D
28. $.foo() is equivalent to..
A. javascript.foo()
B. document.foo()
C. jQuery.foo()
D. None of the above
Ans: C
29. Can jQuery be used on the same page alongside other
libraries?
A. Yes
B. No
Ans: A
30. var ps = $(“p”);
ps will be..
A. A linked list
B. A hash or dictionary
C. An array
D. A jQuery object
Ans: D
JQUERY Objective type Questions with Answers
31. $(document).ready(function() {
// Some code.
});
The above code is used to..
A. Make sure no code is executed till the entire page is fully loaded
B. Make sure no code is executed till the DOM is fully loaded
C. Both A and B
D. Neither A nor B
Ans: B
32. Can you can use CSS3 selectors to select or find elements
using jQuery?
A. Yes
B. No
Ans: A
33. You can test whether the browser supports specific features
using…
A. $.support
B. $.browser
C. $.featureTest
D. $.browserTest
Ans: A
34. Multiple document.ready blocks can be placed in a page
without detriments. This statement is..
A. True
B. False
Ans: A
35. Query.noConflict(true) is used to..
A. Free up the $ symbol for use by other libraries
B. Improve compatibility
C. Remove all jQuery variables from the global scope
D. All of the above
Ans: D
36. $(‘p’).click(function(){
// Code here
});
Inside the commented section, the value of the variable this is
a..
A. Array
B. String
C. Reference to the DOM node
D. jQuery object
Ans: C
37. The method that provides AJAX functionality within jQuery
is named..
A. ajax
B. easyAJAX
C. jQueryajax
D. jQajax
Ans: A
38. The CSS selector engine that jQuery uses is called?
A. Badaboom
B. Mango
C. Sizzle
D. AwesomeX
Ans: C
39. You can attach a handler to an event using which method?
A. eventBind
B. bind
C. attach
D. eventAttach
Ans: B
40. $(‘#masterList’).find(‘li’)
.width(500).addClass(‘selected’);
The phenomena occuring in the above code is called?
A. Chaining
B. Event bubbling
C. AJAX
D. Animating
Ans: A
41. What is jQuery?
a) jQuery is a library of JavaScript Functions.
b) jQuery stands for Structured Query Language
c) jQuery stands for Cascading Style Sheets.
d) jQuery communication between computers on the Internet.
Ans: A
42) The jQuery library contains the following features
a) HTML element selections. HTML element manipulation .HTML
event functions
b) CSS manipulation. JavaScript Effects and animations. HTML DOM
traversal and modification
c) JavaScript Effects and animations. HTML DOM traversal and
modification. AJAX. Utilities
d) all of the above
Ans:D
43) AJAX and jQuery
a) jQuery provides a rich set of methods (functions) for AJAX web
development.
b) With jQuery AJAX, you can request TXT, HTML, XML or JSON data
from a remote server using both HTTP Get and HTTP Post.
c) a and b
d) AJAX and jQuery are cross-platform (you can develop in Windows
and serve on a Unix platform)
Ans: C
44) Load remote data using HTTP GET
a) $.get(url,data,callback,type)
b) $.ajax(options)
c) $.post(url,data,callback,type)
d) $.getScript(url,callback)
Ans: A
45) Triggers, or binds a function to the error event of selected
elements.
a) click()
b) error()
c) event.pageX
d) click.error()
Ans: B
46. What are the :odd and :even filters?
a) They allow you to determine if a number is odd or even.
b) They allow you to determine if a specific element is in an odd or
even position.
c) None of the above.
Ans: B
47. When referencing an HTML element preceded by a #
(pound or hash), what javascript function is this equivalent to?
a) getElementById
b) getElementByClassName
c) getElementByTagName
d) None of the above
Ans: A
48. When referencing an HTML element preceded by a . (dot),
what javascript function is this equivalent to?
a) getElementById
b) getElementByClassName
c) getElementByTagName
d) None of the above
Ans: D
49. What is the each function used for?
a) The Each function allows you to loop though every element in a
parent element.
b) The Each function allows you to put the word “Each” into each
element
c) The Each function allows you to loop through different elements
with a class or ID.
d) None of the above.
Ans: C
50. What is the difference between Hover and Mouseover
a) Mouseover allows you to specify an optional function to use for the
mouseout event
b) Hover allows you to specify an optional function to use for the
mouseout event
c) No Difference; Mouseover and Hover are the same
Ans: B
51. What are the various speed options?
a) The words “slow” and “fast” as well as integers for the milliseconds
b) Only the words “slow”, “fast”, and “medium”
c) All of the above
d) None of the above
Ans: A
52. The speed options can be applied to which jQuery
functions?
a) css and ajax
b) show and fadeIn
c) toggleCss
d) All of the above
Ans: B
53. If you want to stop your jQuery for a few milliseconds,
which function do you use?
a) stop()
b) pause()
c) slowdown()
d) delay()
Ans: D
54. Which function do you reference in HTML form data?
a) value()
b) formData()
c) val()
d) None of the above
Ans: C
55. When do you use the $(this) code?
a) When an HTML element will reference its own action.
b) When an HTML element will reference its parent element’s action
c) When an HTML element will reference the entire document
d) None of the above.
Ans: A
56. What does the function $(“.selector”) return?
a) An array.
b) A node list.
c) A new jQuery object.
Ans: C
57. Why do we usually add the stop() method before calling
animate()?
a) stop() halts the execution of the scripts on the page until the
animation has finished.
b) stop() ends any currently running animations on the element, and
prevents conflicts and pile-ups.
c) We tell jQuery that the animation has to be stopped at some point.
Ans: B
58. What is the difference between .width() and .outerWidth()?
a) The methods are basically the same. The only difference is
that .width() returns a number, whereas outerWidth() a string.
b) width() returns the computed width of the element, while
outerWidth() returns the width plus all the margins and paddings.
c) No difference. width() is a shorthand alias for outerWidth()
Ans: B
59. How do you fetch the first span on the page, which has the
class ‘green’?
a) $(‘span, .green, :first’)
b) $(‘first .green span’)
c) $(‘span.green:first’)
Ans: C
60. What does the $(‘#myDiv’).hover() method do?
a) It binds the functions you pass as parameters, to the mouseenter
and mouseleave events.
b) Converts the element upon which it was called, into a hoverable
menu.
Ans: A
61. Which of the following is correct?
A. jQuery is a JavaScript Library
B. jQuery is a JSON Library
Ans: A
Ajax Multiple Choice Questions :-
1. What is AJAX ?
A. is a programe
B. is a country name
C. is a football club name
Ans: A
2. What sever support AJAX ?
A. SMTP
B. WWW
C. HTTP
Ans: C
3. AJAX Stands for:
A. Asynchronous Javascript and XML
B. Abstract JSON and XML
C. Another Java Abstraction for X-Windows
D. Another Java and XML Library
Ans: A
4. What makes Ajax unique?
A. It works as a stand-alone Web-development tool.
B. It works the same with all Web browsers.
C. It uses C++ as its programming language.
D. It makes data requests asynchronously.
Ans: D
5. What does the XMLHttpRequest object accomplish in Ajax?
A. It’s the programming language used to develop Ajax applications.
B. It provides a means of exchanging structured data between the
Web server and client.
C. It provides the ability to asynchronously exchange data between
Web browsers and a Web server.
D. It provides the ability to mark up and style the display of Web-page
text.
Ans: C
6. ________ Of the following technologies, which one provides the
ability to dynamically interact with Web page layout?
A. JavaScript.
B. XML.
C. Document Object Model.
D. HTML.
Ans: C
7. What is the first step in creating a Joke of the Day
application?
A. Create the application’s text file.
B. Write the application’s HTML.
C. Turn the HTML application into an Ajax application.
D. Upload the application to a Web server.
Ans: B
8. Ajax stands for Synchronous JavaScript and XML.
A. True
B. False
Ans: B
9. Ajax is a programming language.
A. True
B. False
Ans: B
10. Regarding the XMLHttpRequest Object, does the order in
which one calls the “open” method and assign a function to the
“onreadystatechange” event handler matter?
A. Yes
B. No
Ans: B
AJAX MCQs
11. Can a call to the “send” method fire an error (assuming the
user’s browser supports the XMLHttpRequest Object and the
“send” method )?
A. Yes
B. No
Ans: B
12. ActiveX can be disabled via browser settings.
A. True
B. False
Ans: A
13. The XMLHttpRequest object can be disabled via browser
settings.
A. True
B. False
Ans: B
14. Assuming that “xmlhttp” is a user-defined variable that
carrys the Ajax requesting object, xmlhttp.status can carry a
value of 4 after a successful request.
A. True
B. False
Ans: B
15. The XMLHttpRequest object supports a method called
“quit”.
A. True
B. False
Ans: B
16. Assuming that “xmlhttp” is a user-defined variable that
carrys the Ajax requesting object, xmlhttp.status can carry a
value of 0 after a successful request.
A. True
B. False
Ans: B
17. The XMLHttpRequest object can be used on
subdomain1.mysite.com to request a page located at
subdomain2.mysite.com according to the specification.
A. True
B. False
Ans: B
18. What combination of technologies gives AJAX its name?
A. ASP and XAML
B. Asynchronous JavaScript and XML
C. Autonomic Computing and DHTML
D. Atlas and XML
Ans: B
19. Which one of these legendary Greek mythical figures or
places is the code name for Microsoft’s version of AJAX ?
A. Oracle
B. Atlas
C. Hercules
D. Delphi
Ans: B
20. Which Web browser is the least optimized for Microsoft’s
version of AJAX?
A. Firefox
B. Opera
C. Safari
D. Internet Explorer
Ans: C
21. Which one of these technologies is NOT used in AJAX?
A. CSS
B. DOM
C. DHTML
D. Flash
Ans: D
22. AJAX comes in ____.
A. 2003
B. 2005
C. 2004
D. 2006
Ans: B
23. AJAX made popular by
A. Microsoft
B. IBM
C. Sun Microsystem
D. Google
Ans: D
24. AJAX based on
A. JavaScript and XML
B. JavaScript and Java
C. VBScript and XML
D. JavaScript and HTTP requests
Ans: A
25. Using AJAX we can made our web page
a. more interactive and faster
b. easy to connect web page with server
c. more dynamic
Ans: A
26. What does the <noscript> tag 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
Ans: A
27. Why so JavaScript and Java have similar name?
A. JavaScript is a stripped-down version of Java
B. JavaScript’s syntax is loosely based on Java’s
C. They both originated on the island of Java
D. None of the above
Ans: B
28. 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
29. _____ JavaScript is also called client-side JavaScript.
A. Microsoft
B. Navigator
C. LiveWire
D. Native
Ans: B
30 _______ JavaScript is also called server-side JavaScript
A. Microsoft
B. Navigator
C. LiveWire
Ans: C
31.Is it possible to use multiple ScriptManager controls on a
Web page?
A. Yes
B. No
Ans: B
32. Is the AjaxControlToolkit.dll file installed in the Global
Assembly Cache?
A. Yes
B. No
Ans: B
33.Extensible HTML (XHTML) is a markup language that
provides….
A. the mixture expressions of HTML and Javascript.
B. the mixture expressions of HTML and XSL.
C. the mixture expressions of HTML and XML.
D. All of above
Ans: C
34.If you want to create a secure application you should not use
AJAX.
A. True
B. False
Ans: A
35. If you want the page to show in a search engine, you must
use AJAX.
A. True
B. False
Ans: B
36.Which of following has AJAX is a built-in functionality?
A. .NET Framework 3.5
B. .NET Framework 2.0
C. .NET Framework 3.0
D. .NET Framework 4.0
Ans: D
37._____ JavaScript statements embedded in an HTML page can
respond to user events such as mouse-clicks, form input, and
page navigation.
A. Client-side
B. Server-side
C. Local
D. Native
Ans: A
38.Which of the following is not a valid JavaScript variable
name?
A. 21abc
B. abc21
C. _abc
D. None of above
Ans: A
39.Which of the following attribute can hold the JavaScript
version?
A. SCRIPT
B. LANGUAGE
C. VERSION
D. None of above
Ans: B
40.What is the correct syntax for referring to an external script
called ” myScript.js”?
A. <script href=” myScript.js”>
B. <script name=” myScript.js”>
C. <script src=” myScript.js”>
D. None of above
Ans: C
41. WebCrawler does not execute JavaScript code,so you should
not use AJAX in commercial sites.
A. True
B. False
Ans: A
42.Choose the server-side JavaScript object?
A. FileUpLoad
B. Function
C. File
D. Date
Ans: C
43.Choose the client-side JavaScript object?
A. Database
B. FileUpLoad
C. File
D. Cursor
Ans: B
44.Is it possible cancel an Asynchronous postback?
A. Yes
B. No
Ans: A
45.which tool is used to debug ASP.NET AJAX applications ?
A. Fiddler
B. Firebug
C. Both
D. None of these
Ans: C
46.Is it possible to use FileUpload control within the update
panel?
A. Yes
B. No
Ans: A
47. Is it compulsory to have Script manager on the page when
you are using any control of ajax control tool kit?
A. Yes
B. No
C. No need
Ans: A
48.Is there any property names “IsNavigating”?
A. Yes
B. No
Ans: A
49.Uninitialized state of XMLHttpRequest object refers to the
state when the object has not been initialized.
A. True
B. False
Ans: A
50.Sent state of XMLHttpRequest object refers to the state
when the object has been created; however, the send function
has not been invoked.
A. True
B. False
Ans: B
51.The XMLHttpRequest object is used to exchange data with a
server.True or False?
A. True
B. False
Ans: A
52. What is the official name of JavaScript?
A. NetscapeScript
B. XMLScript
C. ECMAScript
D. WebScript
Ans: C
53.Determine whether the following line is correct or not: With
AJAX it is possible to work on an image on the client.
A. no
B. yes
Ans: B
54.From the provided methods, pick the right one that returns
the value of an attribute:
A. attribute[index].text
B. attribute()
C. getAttribute()
D. All of above
Ans: C
55. Fill in the blank with the proper option from the following:
A ________________________ to the JavaScript engine starts all
subsequent requests to the server.
A. XML Document
B. Function call
C. HTML page
D. XHTML Tag
Ans: B
56.In AJAX, the word “Synchronous” describes _______________.
A. Ability to handle processes independently from other processes
B. Processes are dependent upon other processes
C. Processes are not fully dependant on other processes
D. All the processes can be run independently
Ans: B
57.In Internet Explorer, from the following, which one is the
right option to obtain XMLHttpRequest object?
A. if (window.XMLHttpRequest) { httpReq = new
XMLHttpRequest(); }
B. if (window.ActiveXObject) { httpReq = new
ActiveXObject(“Microsoft.XMLHTTP”); }
C. if (window.ActiveXObject) { httpReq = new GetObject(“Microsoft
XMLHTTPRequest”); }
D. if (window.XMLHttpRequest) { httpReq = new
XMLHttpRequest(“IE”); }
Ans: A
58.To get the response from a server, responseText or
responseXML property of the XMLHttpRequest object is used.
A. no
B. yes
Ans: B
59.The responseText property returns the response as a string
format.True or False?
A. True
B. False
Ans: A
60.What will be the primary step when you have to send a
request using JavaScript to a server?
A. You will call the connect() method of the XMLHttp object
B. You will call the execute() method of the XMLHttp object
C. You will call the open() method of the XMLHttp object
D. None of above
Ans: C
JavaScript Multiple Choice Questions :-
1. Why so JavaScript and Java have similar name?
A. JavaScript is a stripped-down version of Java
B. JavaScript’s syntax is loosely based on Java’s
C. They both originated on the island of Java
D. None of the above
Ans: B
2. 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
Ans: A
3. ______ JavaScript is also called client-side JavaScript.
A. Microsoft
B. Navigator
C. LiveWire
D. Native
Ans: B
4. __________ JavaScript is also called server-side JavaScript.
A. Microsoft
B. Navigator
C. LiveWire
D. Native
Ans: C
5. What are variables used for in JavaScript Programs?
A. Storing numbers, dates, or other values
B. Varying randomly
C. Causing high-school algebra flashbacks
D. None of the above
Ans: A
6. _____ JavaScript statements embedded in an HTML page can
respond to user events such as mouse-clicks, form input, and
page navigation.
A. Client-side
B. Server-side
C. Local
D. Native
Ans: A
7. What should appear at the very end of your JavaScript?
The <script LANGUAGE=”JavaScript”>tag
A. The </script>
B. The <script>
C. The END statement
D. None of the above
Ans: A
8. 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
Ans: C
9. Which of the following are capabilities of functions in
JavaScript?
A. Return a value
B. Accept parameters and Return a value
C. Accept parameters
D. None of the above
Ans: C
10. 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
Ans: A
JAVASCRIPT Objective Questions
11. ______ tag is an extension to HTML that can enclose any
number of JavaScript statements.
A. <SCRIPT>
B. <BODY>
C. <HEAD>
D. <TITLE>
Ans: A
12. 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
Ans: A
13. Which of the following attribute can hold the JavaScript
version?
A. LANGUAGE
B. SCRIPT
C. VERSION
D. None of the above
Ans: A
14. 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”)
Ans: C
15. Which of the following way can be used to indicate the
LANGUAGE attribute?
A. <LANGUAGE=”JavaScriptVersion”>
B. <SCRIPT LANGUAGE=”JavaScriptVersion”>
C. <SCRIPT LANGUAGE=”JavaScriptVersion”> JavaScript
statements…</SCRIPT>
D. <SCRIPT LANGUAGE=”JavaScriptVersion”!> JavaScript
statements…</SCRIPT>
Ans: C
16. Inside which HTML element do we put the JavaScript?
A. <js>
B. <scripting>
C. <script>
D. <javascript>
Ans: C
17. 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
Ans: C
18. Which types of image maps can be used with JavaScript?
A. Server-side image maps
B. Client-side image maps
C. Server-side image maps and Client-side image maps
D. None of the above
Ans: B
19. Which of the following navigator object properties is the
same in both Netscape and IE?
A. navigator.appCodeName
B. navigator.appName
C. navigator.appVersion
D. None of the above
Ans: A
20. 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”
Ans: C
21. What does the <noscript> tag 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
Ans: A
22. 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”;
Ans: B
23. JavaScript entities start with _______ and end with _________.
A. Semicolon, colon
B. Semicolon, Ampersand
C. Ampersand, colon
D. Ampersand, semicolon
Ans: D
24. Which of the following best describes JavaScript?
A. a low-level programming language.
B. a scripting language precompiled in the browser.
C. a compiled scripting language.
D. an object-oriented scripting language.
Ans: D
25. Choose the server-side JavaScript object?
A. FileUpLoad
B. Function
C. File
D. Date
Ans: C
26. Choose the client-side JavaScript object?
A. Database
B. Cursor
C. Client
D. FileUpLoad
Ans: D
27. Which of the following is not considered a JavaScript
operator?
A. new
B. this
C. delete
D. typeof
Ans: B
28. ______method evaluates a string of JavaScript code in the
context of the specified object.
A. Eval
B. ParseInt
C. ParseFloat
D. Efloat
Ans: A
29. Which of the following event fires when the form element
loses the focus: <button>, <input>, <label>, <select>,
<textarea>?
A. onfocus
B. onblur
C. onclick
D. ondblclick
Ans: B
30. The syntax of Eval is ________________
A. [objectName.]eval(numeriC.
B. [objectName.]eval(string)
C. [EvalName.]eval(string)
D. [EvalName.]eval(numeriC.
Ans: B
JAVASCRIPT Objective Type Questions with Answers
31. JavaScript is interpreted by _________
A. Client
B. Server
C. Object
D. None of the above
Ans: A
32. Using _______ statement is how you test for a specific
condition.
A. Select
B. If
C. Switch
D. For
Ans: B
33. Which of the following is the structure of an if statement?
A. if (conditional expression is true) thenexecute this codeend if
B. if (conditional expression is true)execute this codeend if
C. if (conditional expression is true) {then execute this code>->}
D. if (conditional expression is true) then {execute this code}
Ans: C
34. How to create a Date object in JavaScript?
A. dateObjectName = new Date([parameters])
B. dateObjectName.new Date([parameters])
C. dateObjectName := new Date([parameters])
D. dateObjectName Date([parameters])
Ans: A
35. The _______ method of an Array object adds and/or removes
elements from an array.
A. Reverse
B. Shift
C. Slice
D. Splice
Ans: D
36. To set up the window to capture all Click events, we use
which of the following statement?
A. window.captureEvents(Event.CLICK);
B. window.handleEvents (Event.CLICK);
C. window.routeEvents(Event.CLICK );
D. window.raiseEvents(Event.CLICK );
Ans: A
37. Which tag(s) can handle mouse events in Netscape?
A. <IMG>
B. <A>
C. <BR>
D. None of the above
Ans: B
38. ____________ is the tainted property of a window object.
A. Pathname
B. Protocol
C. Defaultstatus
D. Host
Ans: C
39. To enable data tainting, the end user sets the _________
environment variable.
A. ENABLE_TAINT
B. MS_ENABLE_TAINT
C. NS_ENABLE_TAINT
D. ENABLE_TAINT_NS
Ans: C
40. In JavaScript, _________ is an object of the target language
data type that encloses an object of the source language.
A. a wrapper
B. a link
C. a cursor
D. a form
Ans: A
41. When a JavaScript object is sent to Java, the runtime
engine creates a Java wrapper of type ___________
A. ScriptObject
B. JSObject
C. JavaObject
D. Jobject
Ans: B
42. _______ class provides an interface for invoking JavaScript
methods and examining JavaScript properties.
A. ScriptObject
B. JSObject
C. JavaObject
D. Jobject
Ans: B
43. _________ is a wrapped Java array, accessed from within
JavaScript code.
A. JavaArray
B. JavaClass
C. JavaObject
D. JavaPackage
Ans: A
44. A ________ object is a reference to one of the classes in a Java
package, such as netscape.javascript .
A. JavaArray
B. JavaClass
C. JavaObject
D. JavaPackage
Ans: B
45. The JavaScript exception is available to the Java code as an
instance of __________
A. netscape.javascript.JSObject
B. netscape.javascript.JSException
C. netscape.plugin.JSException
D. None of the above
Ans: B
46. To automatically open the console when a JavaScript error
occurs which of the following is added to prefs.js?
A. user_pref(” javascript.console.open_on_error”, false);
B. user_pref(“javascript.console.open_error “, true);
C. user_pref(“javascript.console.open_error “, false);
D. user_pref(“javascript.console.open_on_error”, true);
Ans: D
47. To open a dialog box each time an error occurs, which of
the following is added to prefs.js?
A. user_pref(“javascript.classic.error_alerts”, true);
B. user_pref(“javascript.classic.error_alerts “, false);
C. user_pref(“javascript.console.open_on_error “, true);
D. user_pref(“javascript.console.open_on_error “, false);
Ans: A
48. The syntax of a blur method in a button object is
______________
A. Blur()
B. Blur(contrast)
C. Blur(value)
D. Blur(depth)
Ans: A
49. The syntax of capture events method for document object is
______________
A. captureEvents()
B. captureEvents(args eventType)
C. captureEvents(eventType)
D. captureEvents(eventVal)
Ans: C
50. The syntax of close method for document object is
______________
A. Close(do).
B. Close(object)
C. Close(val)
D. Close()
Ans: D
51. <script type=”text/javascript”>
x=4+”4″;
document.write(x);
</script>
Output——?
A. 44
B. 8
C. 4
D. Error output
Ans: A
52. Is it possible to nest functions in JavaScript?
A. True
B. False
Ans: A
53. <script>
document.write(navigator.appCodeName);
</script>
A. get code name of the browser of a visitor
B. set code name of the browser of a visitor
C. None of the above
Ans: A
54. Scripting language are
A. High Level Programming language
B. Assembly Level programming language
C. Machine level programming language
Ans: A
55. Which best explains getSelection()?
A. Returns the VALUE of a selected OPTION.
B. Returns document.URL of the window in focus.
C. Returns the value of cursor-selected text
D. Returns the VALUE of a checked radio input.
Ans: C
56. Choose the client-side JavaScript object:
A. Database
B. Cursor
C. Client
D. FileUpLoad
Ans: D
57. 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
Ans: A
58. In JavaScript, Window.prompt() method return true or false
value ?
A. False
B. True
Ans: A
59. <script language=”javascript”>
function x()
{“ a
document.write(2+5+”8″);
}
</script>
A. 258
B. Error
C. 7
D. 78
Ans: D
60. <script type=”text/javascript”>
var s = “9123456 or 80000?”;
var pattern = /d{4}/;
var output = s.match(pattern);
document.write(output);
</script>
A. 9123
B. 91234
C. 80000
D. None of the above
Ans: A
JSON Objective type Questions and Answers List
1. JSON name/value pair is written as
A. name’ : ‘value’
B. name = ‘value’
C. name = “value”
D. “name” : “value”
Ans: D
2. JSON strings have to be in
A. single quote
B. double quote
C. single quote or double quote
Ans:B
3. In the below notation, Employee is of type { “Employee”: [ “Amy”,
“Bob”, “John” ] }
A. Not a valid JSON string
B. Array
C. Class
D. Object
Ans:B
4. Which of the following is not a JSON type?
A. Object
B. date
C. Array
D. string
Ans:B
5. Which of these is correct about the JSON standard?
A. It is an open standard
B. It is privately developed
C. It requires a license to use
Ans:A
6. What is the file extension of JSON?
A. .jn
B. .js
C. .jsn
D. .json
Ans:D
7. In modern websites what is the common usage for JSON?
A. To store information remotely.
B. To send and receive bits of data.
C. To store information locally.
Ans:B
8. Which of the following code will return a valid JSON object?
A. JSON.parse(‘({“FirstName”: “John”, “LastName”:”Doe”})’);
B. JSON.parse(“{‘FirstName’: ‘John’, ‘LastName’:’Doe’}”);
C. JSON.parse(“({‘FirstName’: ‘John’, ‘LastName’:’Doe’})”);
D. JSON.parse(‘{“FirstName”: “John”, “LastName”:”Doe”}’);
Ans:D
9. Which of these is proper a JSON array?
A. { “letters” : [ “a”, “b”, “c”; ] }
B. { ‘letters’ : {“a”, “b”, “c” } }
C. { “letters” : [ a, b, c ] }
D. { “letters” : [ “a”, “b”, “c” ] }
Ans:D
10. In the below notation, Employee is of type { “Employee”: { “Name”:
“Amy”, “Age”: 25 } }
A. Object
B. Array
C. Class
D. Not a valid JSON string
Ans:A
11. Which answer represents the following order of TYPES? Object,
String, Boolean, Number
A. “{ }”, “a string”, “false”, “0”
B. [ ], 0, “true”, “0”
C. { }, “0”, false, 0
D. { }, hello, “false”, “0”
Ans:C
12. In this example, what is the TYPE of employee?
{ “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
A. String
B. Director
C. type
D. Object
Ans:D
13. Given this JSON example:
{ “Employee”: { “Name”: “Amy”, “Age”: 25 } }; What is the type of
Employee.Age ?
A. Number
B. Object
C. Array
D. String
Ans:A
14. Which of these is a benefit JSON has over XML?
A. JSON is more forgiving of poor formatting
B. JSON has less markup requirements and therefore is lighter than
XML
C. JSON can be written poorly and still be parsed
D. JSON does not need to be stored in a file to be sent remotely
Ans:B
15. Which statement about the replacer parameter in JSON.stringify() is
true?
A. If null or omitted, all properties of the object are included in the
resulting JSON string
B. If a function, transforms values and properties encountered while
stringifying
C. All three statements are true
D. If an array, specifies the names of the properties in the object to
include in the resulting JSON string
Ans:C
16. What does JSON stand for?
A. JavaScript Object Nomenclature
B. JavaScript Objective Notation
C. JavaScript Object Notation
D. JavaScript Orientated Nomenclature
Ans:C
17. JSON elements are separated by
A. semi-colon
B. line break
C. comma
D. white space
Ans:C
18. What keywords are reserved in JSON and cannot be used as keys?
A. Value
B. Object
C. There are none.
D. Key
Ans:C
19. Which of the following is a valid JSON string?
A. { “meals” : { “breakfast” , “lunch” , “dinner” } }
B. { “meals” : [ “breakfast” , “lunch” , “dinner” ] }
C. [ “meals” : { “breakfast” , “lunch” , “dinner” } ]
D. [ {“meals” : { “breakfast” , “lunch” , “dinner” } } ]
Ans:B
20. Which of the following code will throw an error?
A. JSON.parse(null);
B. JSON.parse(‘{}’);
C. JSON.parse(undefined);
D. JSON.parse(‘[]’);
Ans: C
21. Which statement about the toJSON method is true?
A. It customizes JSON stringification behavior
B. It allows an object to determine its own JSON representation
C. All three statements are true
D. It is internally called by JSON.stringify()
Ans: C
22. Which of these data interchange formats has seen a decline in
usage in favor of JSON?
A. ASCII
B. Plain-text
C. SQL
D. XML
Ans: D
23. True or false? A disadvantage of JSON is that it requires the use of
JavaScript.
A. False, JSON is language independent.
B. False, JavaScript must be available although it is not necessary to
use.
C. True, though all browsers have JavaScript enabled.
D. True, though JavaScript is readily available in today’s browsers.
Ans: A
24. Which is true about JSON namespacing?
A. JSON namespaces can be accessed immediately after receiving
data.
B. JSON namespaces can be accessed after parsing data.
C. JSON doesn’t have namespaces. Though every object is inherently a
namespace.
Ans:C
25. What kind of format is JSON, and what does the acronym mean?
A. A lightweight data-encoding framework. Java Omnipresent Notation.
B. A lightweight data-interchange format. JavaScript Object Notation.
C. A lightweight data-interchange format. Java Objective Notion.
D. A lightweight database framework. JavaScript Object Notation.
Ans: B
26. Can you use a double quote inside a JSON string?
A. Yes, if you use the ascii code.
B. Yes, you can use it without any special treatment
C. Yes, if it is escaped like ( \” )
D. No, you should use single quotes
Ans:C
27. In this example, what is the TYPE of employee.functions?
{ “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
A. String
B. Object
C. Array
D. Sales, Marketing
Ans:C
28. Which statement about the reviver parameter in JSON.parse() is
true?
A. All three statements are true
B. Used to reform generic objects into instances of pseudo-classes
C. A function that will be called for every key and value at every level of
the final result
D. Each value will be replaced by the result of the reviver function
Ans: A
29. What function will convert a JavaScript object to a JSON string?
A. JSON.text()
B. JSON.serialize()
C. JSON.toString()
D. JSON.stringify()
Ans: D
30. In this example, what would the VALUE of employee.functions[1]
be?
{ “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
A. null
B. undefined
C. marketing
D. sales
Ans: C
31. What is the MIME type of JSON?
A. application/x-json
B. text/json
C. application/json
D. application/javascript
Ans: C
32. In this example, what is the VALUE of employee.type?
{ “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’] } }
A. String
B. Object
C. Director
Ans: C
33. In this example, what would the TYPE of employee.hireDate be?
{ “employee” : { “type” : “Director”, “functions” : [‘sales’, ‘marketing’],
“hireDate” : “March 8, 2011” } }
A. March 8, 2011
B. String
C. Date
D. Number
Ans: B
34. What is JSONP meant to mitigate?
A. Size constraints of JSON
B. Cross-domain communication
C. Future proofing JSON as JavaScript changes.
Ans: B
35. True or false? The order of elements in JSON arrays is always
preserved.
A. False
B. True
Ans: B
36. Which of these is supported as a JSON Value type?
A. Infiniti
B. Null
C. Undefined
D. NaN
Ans: B
37. When coding a string object in JSON, what must separate the string
and the value?
A. A space
B. A semicolon
C. A comma
D. A colon
Ans: D
38. Does JSON support Unicode characters?
A. No, JSON has no support for any kind of character encoding.
B. No, JSON only has support for UTF-8 characters.
C. Yes, JSON has support for Unicode characters. Allowing for almost
any information in any human language
D. Yes, only when stored as the key in a ( key : value ) pair.
Ans: C
39. What is the value of obj in the following code?
var obj = JSON.parse(‘{“fruit”: “Apple”}’, function(k, v) { if (v == “Apple”)
return “Orange” else return v; });
A. { “fruit” : “Apple”}
B. { “fruit” : “Orange”}
C. {“Orange”}
D. {“Apple”}
Ans: B
40. In what situation would you want to use XML over JSON?
A. When JSON is not offered.
B. When you need to use tags to structure your content.
C. You need message validation or you’re using XSLT.
D. Never, JSON is worlds better.
Ans: C
41. What is a JSONStringer used for?
A. It is used to quickly create JSON text.
B. It quickly converts JSON to Java strings.
C. It is used to create number strings in JSON.
D. It is used to create JSON ordered pairs.
Ans: A
42. Which of the following control characters cannot be used when
writing a JSON string without escaping?
A. ; or :
B. “ or \
C. < or >
D. / or {
Ans: B
43. What is the value of json in the following code?
var days = {}; days[‘Monday’] = true; days[‘Wednesday’] = true;
days[‘Sunday’] = false; var json = JSON.stringify({x: days});
A. {“day”:{“Monday”:”true”,”Wednesday”:”true”,”Sunday”:”false”}}
B. {“x”:{“Monday”:true,”Wednesday”:true,”Sunday”:false}}
C. {“day”:{“Monday”:true,”Wednesday”:true,”Sunday”:false}}
D. {“x”:[“Monday”:true,”Wednesday”:true,”Sunday”:false]}
Ans: B
44. How does JSON being “lightweight” translate into a benefit for the
site visitors?
A. Faster transfer times over the internet
B. Parsing JSON is noticeably faster than parsing XML
C. Web apps have a smaller footprint
Ans: A
45. What error does JSON.parse() throw when the string to parse is not
valid JSON?
A. ReferenceError
B. EvalError
C. SyntaxError
D. TypeError
Ans: C
46. What two structures is JSON built on?
A. A collection of name/value pairs, and an ordered list of values, or
array.
B. A collection of object/item pairs, and an ordered list of pairs, or array.
C. A collection of name/value objects, and an ordered list of objects, or
array.
D. A collection of native-value pairs, and an ordered list of arrays, or
values.
Ans: A
47. Which of the following is not a valid way to parse JSON string?
A. JSON.eval()
B. JSON.parse()
C. jQuery.parseJSON()
D. eval()
Ans: A
48. Does whitespace matter in JSON?
A. No, it will be stripped out.
B. Yes, only within strings.
C. Yes, only outside of strings.
D. Yes, both inside and outside of strings
Ans: B
49. What is the value of json in the following code?
var cars = []; cars[0] = ‘Ford’; cars[1] = ‘Toyota’; cars[2] = ‘BMW’; var
json = JSON.stringify({x: cars});
A. {“x”:[‘Ford’,’Toyota’,’BMW’]}
B. {“x”:{“Ford”,”Toyota”,”BMW”}}
C. {“x”:[“Ford”,”Toyota”,”BMW”]}
D. {“cars”:[“Ford”,”Toyota”,”BMW”]}
Ans: C
50. What is the value of json in the following code?
var obj = { fruit: ‘apple’, toJSON: function () { return ‘orange’; } }; var json
= JSON.stringify({x: obj});
A. {“x”:”orange”}
B. {“fruit”:”apple”}
C. {“x”:”apple”}
D. {“fruit”:”orange”}
Ans: A
51. What types of values can you have in JSON key:value pairs?
A. Strings, Arrays, and Primitives
B. Arrays, Primitives, and Objects stored as strings
C. Strings, Arrays, Primitives and Objects
D. Strings only
Ans: C
52. What does JSONP stand for?
A. JSON Procedures
B. JSON Parsing
C. JSON with padding
D. JSON Programming
Ans: C
53. Which of the following code will not throw an error?
A. JSON.parse(”);
B. JSON.parse(null);
C. JSON.parse();
D. JSON.parse({});
Ans:B
54. How does JSON handle numeric values that cannot be represented
by a sequence of digits (like Infiniti and Nan)?
A. They are stored as strings and then converted when parsed.
B. They are not permitted.
C. They are stored fine but it’s the parsers job to convert them to
numeric values.
Ans: B
55. Which of the following number formats are not used in JSON?
A. Octal and gate
B. Octal and binary
C. Binary and hexadecimal
D. Octal and hexadecimal
Ans: D
56. What is used by the JSONObject and JSONArray constructors to
parse JSON source strings?
A. JSONTokener
B. JSONParser
C. JParser
D. ParserJ
Ans: A
57. Which statement about the space parameter in JSON.stringify() is
false?
A. It controls spacing in the resulting JSON string
B. All three statements are false
C. It removes whitespace
D. It is an optional parameter
Ans: C
58. True of False? The external form of a JSON object always begins
and ends with {}
A. True
B. False
Ans: A
59. True of False. The order of JSON objects is always preserved.
A. False
B. True
Ans: A