JavaScript Questions & Answers – Comparison of Core JavaScript versus Frameworks – I

This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “Comparison of Core JavaScript versus Frameworks – I”.

1. What is the framework?
a) User time efficiency
b) Author time efficiency
c) Both User time and Author time efficiency
d) Client time efficiency
View Answer

Answer: b
Explanation: A framework, or software framework, is a platform for developing software applications. Frameworks are an author-time efficiency, meaning that they make coding tasks much simpler by abstracting the real work that goes into doing those tasks.

2. Which is the function used to loop in an array to view all the values?
a) all()
b) loop()
c) each()
d) every()
View Answer

Answer: c
Explanation: for.each() function is used for traversing through each values of the array. The method jQuery.each(array, function) loops through the array.

3. Which of the following has a greater benchmark time for looping and JQuery vs core JavaScript in milliseconds?
a) Chrome JQuery
b) Chrome JavaScript
c) Firefox JQuery
d) Firefox JavaScript
View Answer

Answer: a
Explanation: jQuery Injector allows you to inject jQuery into every frame on a page so that you can use jQuery in the chrome dev console. When we try to compare the average benchmark time for looping and JQuery vs core JavaScript in milliseconds, the Chrome JQuery has a greater benchmark time.
advertisement
advertisement

4. Which class provides an interface for invoking JavaScript methods and examining JavaScript properties?
a) ScriptObject
b) JSObject
c) JavaObject
d) Jobject
View Answer

Answer: b
Explanation: JSObject is the type of JavaScript objects in the JSAPI. When a JavaScript object is passed or returned to Java code, it is wrapped in an instance of JSObject. When a JSObject instance is passed to the JavaScript engine, it is unwrapped back to its original JavaScript object. The JSObject class provides a way to invoke JavaScript methods and examine JavaScript properties.

5. What is the purpose of the function eval?
a) Executes the string as an integer
b) Gets the value of the string
c) Executing string as JavaScript
d) Executing string as an object
View Answer

Answer: c
Explanation: eval is a JavaScript native function that accepts a string and executes the string as JavaScript. The argument of the eval() function is a string. It basically fires up the interpreter and allows the passed-in string to be parsed and interpreted at the time of invocation.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Which of the following has a lesser benchmark time for using JQuery to access DOM versus pure JavaScript in milliseconds?
a) Chrome JQueryDOM_
b) Chrome JSDOM_benc
c) Firefox JQueryDOM_
d) Firefox JSDOM_benc
View Answer

Answer: d
Explanation: jsdom is a pure-JavaScript implementation of many web standards, notably the WHATWG DOM and HTML Standards, for use with Node.js. When we try to compare the average benchmark time for using JQuery to access DOM versus pure JavaScript in milliseconds, the Firefox JSDOM_benc has a lesser benchmark time.

7. Which is a wrapped Java array, accessed from within JavaScript code?
a) JavaArray
b) JavaClass
c) JavaObject
d) JavaPackage
View Answer

Answer: a
Explanation: Java array is an object which contains elements of a similar data type. JavaArray is accessed from within JavaScript code.
advertisement

8. What is the syntax of close method for document object?
a) Close(object)
b) Close(doc)
c) Close(val)
d) Close()
View Answer

Answer: d
Explanation: In order to close a document object, we need to call Close(). In order to close a document object, we need to call Close().

9. How do you find the number with the highest value of x and y?
a) ceil(x,y)
b) top(x,y)
c) Math.ceil(x,y)
d) Math.max(x,y)
View Answer

Answer: d
Explanation: max function is used for comapring and finding maximum values. It is found in the math library. Math.max(x,y) is used to find the highest value of x and y.
advertisement

10. How can you find a client’s browser name?
a) browser.name
b) navigator.appName
c) client.navName
d) client.name
View Answer

Answer: b
Explanation: The client’s browser name can be found by using navigator.appName. It is found inside the navigator object.

Sanfoundry Global Education & Learning Series – Javascript Programming.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
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 & discussions at Telegram SanfoundryClasses.