HTML Questions & Answers – Essential JavaScript and jQuery – 3


This set of HTML Multiple Choice Questions & Answers (MCQs) focuses on “Essential JavaScript and jQuery – 3”.

1. Which of the following is not a method of AJAX?
a) get()
b) getJSON()
c) post()
d) stop()
View Answer

Answer: d
Explanation: AJAX is basically used for exchanging data with server. There are several methods in jQuery for AJAX. Ajax(), ajaxSetup(), ajaxPrefilter(), ajaxTransport(), getJSON(), post(), ajaxSend(), ajaxError(), load(), serializeArray(), serialize(), ajaxStop(), ajaxStart() are some of the methods.

2. Correct syntax for $.post() method is ____________
a) $.post(URL,data,callback)
b) $.post(URL,data)
c) $.post(URL,callback)
d) $.post(data,callback)
View Answer

Answer: a
Explanation: The correct syntax for $.post() method is $.post(URL,data,callback). URL is the URL we want to request for. Callback is the name of the function that is to be executed. Data specifies the data that is to be send with the request.

3. The method releases jQuery’s control of $ is __________
a) $.param()
b) $.noConflict()
c) each()
d) data()
View Answer

Answer: b
Explanation: $.noConflict() method releases control of $ in jQuery. A reference to jQuery is returned by noConflict() method. E.g. var ty=$.noConflict(); ty(document).ready(function()) { ty(“button”).click(function() {ty(“h”).text(“It is working!”);}); });. $.param() jQuery AJAX method is the representation of an object or array. An each() method particularize function to run for every matched element. data() method either connects data to selected elements or get data from them.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

4. In JavaScript, which one is used to finding the non-whitespace characters?
a) \d
b) \s
c) \S
d) \w
View Answer

Answer: c
Explanation: There are metacharacters defined in JavaScript. \S is used to find the non-whitespace character. \d is used for finding a digit. \s is used for finding whitespace character. \w is used to find word character. \W is used to find non word character.

5. Which one is not regular expression object method?
a) test()
b) exec()
c) compile()
d) each()
View Answer

Answer: d
Explanation: compile(), toString(), exec(), test() are some of the regular expression methods in JavaScript. Compile() is method that compiles regular expression. Test() method is for matching in a string. Exec() is also for matching in a string but it returns first match. toString() method returns string value.

6. Which is not a JavaScript global function?
a) compile()
b) eval()
c) decodeURI()
d) isNaN()
View Answer

Answer: a
Explanation: There are various global functions in JavaScript, decodeURI(), escape(), isFinite(), eval(), isNaN(), encodeURI(), decodeURIComponent(), encodeURIComponent(), isFinite(), is NaN(), parseFloat(), String(), parseInt(), unescape() are some of the methods.

7. Which of the following is not window object property?
a) defaultStatus
b) closed
c) constructor
d) frames
View Answer

Answer: c
Explanation: Window object properties are frames, history, frameElement, defaultStatus, closed, innerHeight, document, innerWidth, location, name, outerHeight, outerHeight, opener, pageXOffset, parent, screenTop, screen, screenLeft, screen, scroll, status, self, sessionStorage, top.

8. Which of the following is not window object method?
a) blur()
b) close()
c) confirm()
d) unescape()
View Answer

Answer: d
Explanation: Some of the window object methods are atob(), close(), focus(), blur(), alert(), clearInterval(), confirm(), btoa(), getComputedStyle(), open(), moveTo(), prompt(), matchMedia(), moveBy(), getSelection(), scroll(), setInterval(), stop(), setTimeout() etc.

9. Which of the following is not navigator object property?
a) appVersion
b) geolocation
c) document
d) cookieEnabled
View Answer

Answer: c
Explanation: The navigator object properties are appVersion, cookieEnabled, appCodeName, geolocation, appName, product, userAgent, platform, online, language. Engine name of the browser is returned by product and the language of the browser is returned by language.

10. Which of the following is the Navigator object method?
a) javaEnabled()
b) moveBy()
c) scroll()
d) stop()
View Answer

Answer: a
Explanation: There are two navigator object methods namely taintEnabled() and javaEnabled(). taintEnabled() the ability of the browser of data tainting. This method can’t be used in JavaScript 1.2 version. javaEnabled() method specifies whether Java is enabled in the browser or not.

11. Which of the following is not screen object property?
a) width
b) colorDepth
c) pixelDepth
d) language
View Answer

Answer: d
Explanation: The screen object properties are availWidth, pixelDepth, width, height, colorDepth, availDepth. The total width of the screen is returned by width, height returns the total height of the screen, pixelDepth returns color resolution of the screen in pixels.

12. Which is not the method of History object?
a) go()
b) moveBy()
c) forward()
d) back()
View Answer

Answer: b
Explanation: There are mainly three methods of history object, forward(), back() and go(). The next URL of history list is loaded by calling forward() function. The previous URL in the history list is loaded by back() method. A specific URL from history list is loaded by go() method.

13. Which is not the location object method?
a) stop()
b) reload()
c) assign()
d) replace()
View Answer

Answer: a
Explanation: assign(), replace(), reload() are the location object methods. A new document is loaded by calling assign() method. The current document is replaced by the new one by calling replace() method. Current document is reloaded by reload() method.

14. Which is not the property of location object?
a) origin
b) port
c) host
d) geolocation
View Answer

Answer: d
Explanation: The properties of location object are host, origin, port, pathname, hostname, href, hash, protocol, search. The port number of URL is set by port. The entire URL is set by href, path name of URL is set by pathname property, protocol of URL is set by protocol property.

15. Which of the following is not DOM property?
a) document.anchors
b) document.cookie
c) document.body
d) document.origin
View Answer

Answer: d
Explanation: Properties of DOM method are: document.anchors, document.applets, document.baseURI, document.body, document.cookie, document.doctype, document.documentElement, document.documentMode, document.documentURI, document.domain, document.domConfig, document.embeds, document.forms, document.head, document.images, document.implementation, document.inputEncoding, document.lastModified, document.links, document.readyState, document.referrer, document.scripts, document.strictErrorChecking, document.title and document.URL.

Sanfoundry Global Education & Learning Series – HTML.

To practice all areas of HTML, here is complete set of 1000+ Multiple Choice Questions and Answers.

Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.