Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages
Filter by Categories
nmims post
Objective Type Set
Online MCQ Assignment
Question Solution
Solved Question
Uncategorized

Javascript MCQ Set 1

1. Which of the following can be implemented using animation?
a) Fireworks
b) Fade Effect
c) Roll-in or Roll-out
d) All of the mentioned

View Answer

Answer: d [Reason:] You can use JavaScript to create a complex animation which includes but not limited to:

  • Fireworks
  • Fade Effect
  • Roll-in or Roll-out
  • Page-in or Page-out
  • Object movements.

2. Which is the function that calls another function after a time interval?
a) setTimeout()
b) setTime()
c) callafter()
d) none of the mentioned

View Answer

Answer: a [Reason:] The setTimeout(function, duration) calls function after duration milliseconds from now.

3. Which function is used to clear the timer value?
a) clearTimervalue()
b) clearTimeout()
c) clear()
d) flush(timer)

View Answer

Answer: b [Reason:] The clearTimeout(setTimeout_variable) call clears any timer set by the setTimeout() functions.

4. Which is the property used to position the object in the left of the screen?
a) object.position = left
b) object = position.left
c) object.style.left
d) none of the mentioned

View Answer

Answer: c [Reason:] The property object.style.left = distance in pixels or points sets distance from left edge of the screen.

5. Which is the function used to call a function in every time duration?
a) callafter()
b) setInterval()
c) setTimeout()
d) setTime()

View Answer

Answer: b [Reason:] The setInterval(function, duration) calls function after every duration milliseconds.

6. How do we get the DOM object in JavaScript?
a) getElementbyId()
b) getObject()
c) getElement()
d) none of the mentioned

View Answer

Answer: a [Reason:] The getElementbyId() is used to get the DOM object in JavaScript by simply calling that function associated with the HTML document.

7. How to assign the image source in JavaScript?
a) image = “url”
b) source(“url”)
c) image.src = “url”
d) none of the mentioned

View Answer

Answer: c [Reason:] The image source is defined as image.src = “/images/html.gif”.

8. How do we create and preload an image object in JavaScript?
a) Use new keyword
b) Call Image()
c) Both Use new keyword and Call Image()
d) None of the mentioned

View Answer

Answer: c [Reason:] The Image() constructor creates and preloads a new image object.

9. Which event handler is triggered when the user’s mouse moves onto a link?
a) onMouseOver
b) onMouseOut
c) onMouse
d) onMouseOnto

View Answer

Answer: a [Reason:] The onMouseOver event handler is triggered when the user’s mouse moves onto the link.

10. Which event handler is triggered when the user’s mouse moves away from a link?
a) onMouseOver
b) onMouseOut
c) onMouse
d) onMouseOnto

View Answer

Answer: b [Reason:] The onMouseOut event handler is triggered when the user’s mouse moves away from the link.

Javascript MCQ Set 2

1. Consider the code snippet given below

var count = [1,,3];

What is the observation made?
a) The omitted value takes “undefined”
b) This results in an error
c) This results in an exception
d) None of the mentioned

View Answer

Answer: a [Reason:] If you omit a value from an array literal, the omitted element is given the value.

2. Consider the following code snippet

var a1 = [,,,]; 
var a2 = new Array(3); 
0 in a1 
0 in a2

The result would be
a) true false
b) false true
c) true true
d) false true

View Answer

Answer: a [Reason:] a1 has an element with index 0 and a2 has no element with index 0.

3. The pop() method of the array does which of the following task ?
a) decrements the total length by 1
b) increments the total length by 1
c) prints the first element but no effect on the length
d) None of the mentioned

View Answer

Answer: a [Reason:] Arrays have a pop() method (it works with push()) that reduces the length of an array by 1 but also returns the value of the deleted element.

4. Consider the following code snippet :

if (!a[i]) continue;

What is the observation made ?
a) Skips the undefined elements
b) Skips the non existent elements
c) Skips the null elements
d) All of the mentioned

View Answer

Answer: d [Reason:] None.

5. What will happen if reverse() and join() methods are used simultaneously ?
a) Reverses and stores in the same array
b) Reverses and concatenates the elements of the array
c) Reverses
d) All of the mentioned

View Answer

Answer: a [Reason:] The reverse() followed by a join() will reverse the respective array and will store the reversed array in the memory.

6. Consider the following code snippet :

var a = [1,2,3,4,5];
a.slice(0,3);

What is the possible output for the above code snippet ?
a) Returns [1,2,3].
b) Returns [4,5].
c) Returns [1,2,3,4].
d) Returns [1,2,3,4,5].

View Answer

Answer: a [Reason:] None.

7. Consider the following code snippet :

var a = []; 
a.unshift(1); 
a.unshift(22);
a.shift(); 
a.unshift(3,[4,5]); 
a.shift(); 
a.shift();
a.shift();

The final output for the shift() is
a) 1
b) [4,5].
c) [3,4,5].
d) Exception is thrown

View Answer

Answer: a [Reason:] The unshift() and shift() methods behave much like push() and pop(), except that they insert and remove elements from the beginning of an array rather than from the end. unshift() adds an element or elements to the beginning of the array, shifts the existing array elements up to higher indexes to make room, and returns the new length of the array. shift() removes and returns the first element of the array, shifting all subsequent elements down one place to occupy the newly vacant space at the start of the array.

8. The primary purpose of the array map() function is that it
a) maps the elements of another array into itself
b) passes each element of the array and returns the necessary mapped elements
c) passes each element of the array on which it is invoked to the function you specify, and returns an array containing the values returned by that function
d) None of the mentioned

View Answer

Answer: c [Reason:] The map() method passes each element of the array on which it is invoked to the functionyou specify, and returns an array containing the values returned by that function.

9. The reduce and reduceRight methods follow a common operation called
a) filter and fold
b) inject and fold
c) finger and fold
d) fold

View Answer

Answer: b [Reason:] None.

10. The method or operator used to identify the array is
a) isarrayType()
b) ==
c) ===
d) typeof

View Answer

Answer: d [Reason:] The typeof property is used to identify the array type.

Javascript MCQ Set 3

1. Which is a fast C++ based JavaScript interpreter?
a) Node
b) Sockets
c) Processors
d) Closures

View Answer

Answer: a [Reason:] Node is a fast C++-based JavaScript interpreter with bindings to the low-level Unix APIs for working with processes, files, network sockets, etc., and also to HTTP client and server APIs.

2. Why does the Node rely on event handlers?
a) APIs are synchronous
b) APIs are asynchronous
c) APIs are reusable
d) None of the mentioned

View Answer

Answer: b [Reason:] Because the APIs are asynchronous, Node relies on event handlers, which are often implemented using nested functions and closures.

3. What is the command to run the node programs?
a) node(program.js)
b) program.js
c) node program.js
d) node.program.js

View Answer

Answer: c [Reason:] The node programs can be run with the command: node program.js

4. What is the alternative command used in Node for load()?
a) store()
b) module()
c) log()
d) require()

View Answer

Answer: d [Reason:] Use require() instead of load(). It loads and executes (only once) the named module, returning an object that contains its exported symbols.

5. What is the command used for debugging output in Node?
a) print();
b) console.log(…);
c) debug(…);
d) execute(…);

View Answer

Answer: b [Reason:] Node defines console.log() for debugging output like browsers do.

6. What is the code to print hello one second from now?

a) setTimeout(function() { console.log("Hello World"); }, 1000);
b) setTimeout(function() { 1000, console.log("Hello World"); });
c) setTimeout(function(1000) { console.log("Hello World"); });
d) setTimeout(function() { console.log("Hello World"); });

View Answer

Answer: a [Reason:] The above code snippet says hello one second from now.

7. Among the below given functions, Node supports which of the following client-side timer functions?
a) getInterval()
b) Interval()
c) clearTime()
d) clearTimeout()

View Answer

Answer: d [Reason:] Node supports the client-side timer functions set setTimeout(), setInterval(), clearTimeout(), and clearInterval().

8. The necessary globals of a node are defined under which namespace?
a) variables
b) system
c) process
d) using

View Answer

Answer: c [Reason:] Node defines other important globals under the process namespace.

9. Why does Node not block while waiting for operations to complete?
a) Static
b) Asynchronous
c) Synchronous
d) None of the mentioned

View Answer

Answer: b [Reason:] Because Node’s functions and methods are asynchronous, they do not block while waiting for operations to complete.

10. Which is the method used for registering handlers?
a) on()
b) register()
c) add()
d) include()

View Answer

Answer: a [Reason:] Node objects that generate events (known as event emitters) define an on() method for registering handlers.

Javascript MCQ Set 4

1. The four kinds of class members are
a) Instance methods, Instance fields, Static method, Dynamic method
b) Instance fields, Instance methods, Class fields, Class methods
c) Instance fields, Non-instance fields, Dynamic methods, Global methods
d) Global methods, Local methods, Dynamic methods, Static methods

View Answer

Answer: b [Reason:] The four kinds of class members are Instance fields, Instance methods, Class fields, Class methods.

2. The properties of the objects act like different kinds of class members. They are
a) Public object, Private object, Protected object
b) Constructor object, Function object, Destructor object
c) Constructor object, Prototype object, Instance object
d) Instance method, Static object, Dynamic object

View Answer

Answer: c [Reason:] In JavaScript, there are three different objects involved inany class definition, and the properties of these three objects act like different kinds of class members namely, Constructor object, Prototype object, and Instance object.

3. The object whose properties are inherited by all instances of the class, and properties whose values are functions behaving like instance methods of the class, is
a) Instance object
b) Constructor object
c) Destructor object
d) Prototype object

View Answer

Answer: d [Reason:] The properties of the prototype object are inhertied by all instances of the class, and properties whose values are functions behave like instance methods of the class.

4. Which are usually variables that are used internally in object methods and also are globally visible variables?
a) Object properties
b) Variable properties
c) Method properties
d) Internal properties

View Answer

Answer: b [Reason:] The variable properties are usually variables that are used internally in the objects methods, but can also be globally visible variables that are used through the page.

5. The class that represents the regular expressions is
a) RegExpObj
b) RegExpClass
c) RegExp
d) StringExp

View Answer

Answer: c [Reason:] The JavaScript RegExp class represents regular expressions, and both string and RegExp define methods that use regular expressions.

6. The different variant of Date() constructor to create date object is/are
i. new Date(date)
ii. new Date(milliseconds)
iii. new Date(date string)
iv. new Date(year, month, date[, hour, minute, second, millisecond])
a) i, ii and iii only
b) ii, iii and iv only
c) i, ii and iv only
d) All i, ii, iii and iv

View Answer

Answer: b [Reason:] The Date() consturctore appears in three different ways as mentioned above.

7. Which is the correct code that returns a complex number that is the complex conjugate of this one?

a) Complex.prototype.conj = function() { return new Complex(this.r, -this.i); };
b) Complex.prototype.conj = function() { return Complex(this.r, -this.i); };
c) Complex.prototype.conj = function() { return (this.r, -this.i); };
d) Complex.prototype.conj = function() { new Complex(this.r, -this.i); };

View Answer

Answer: a [Reason:] The above code snippet returns a complex number that is the complex conjugate of this one.

8. How can we make methods available on all objects?
a) Object.add(methods)
b) Object.methods(add)
c) Object.add.methods(…)
d) Object.prototype

View Answer

Answer: d [Reason:] It is possible to add methods to Object.prototype, making them available on all objects. This is not recommended, however, because prior to ECMAScript5, there is no way to make these add-on methods nonenumerable, and if you add properties to Object.prototype, those properties will be reported by all for/in loops.

9. What is the procedure to add methods to HTMLElement so that they will be inherited by the objects that represent the HTML tags in the current document?
a) HTMLElement.prototype(…)
b) HTMLElement.prototype
c) HTML.addmethods()
d) HTML.elements(add)

View Answer

Answer: b [Reason:] It is implementation-dependent whether classes defined by the host environment (such as the web browser) can be augmented using Object.prototype. In many web browsers, for example, you can add methods to HTMLElement.prototype and those methods will be inherited by the objects that represent the HTML tags in the current document.

10. You can refresh the webpage in JavaScript by using
a) window.reload
b) location.reload
c) window.refresh
d) page.refresh

View Answer

Answer: b [Reason:] One can refresh the webpage in JavaScript by using location.reload.

Javascript MCQ Set 5

1. What is the purpose of a Rendering Engine?
a) Parsing objects in the page
b) Drawing all objects in the page
c) Both Parsing & Drawing all objects in the page
d) None of the mentioned

View Answer

Answer: c [Reason:] A Rendering Engine is generally used for parsing and drawing all of the objects in the page.

2. What is the purpose of the JavaScript Engine?
a) Compiling the JavaScript
b) Interpreting the JavaScript
c) Both Compiling & Interpreting the JavaScript
d) None of the mentioned

View Answer

Answer: b [Reason:] The JavaScript Engine is generally used for interpreting the JavaScript.

3. Which layer is used to handle the HTTP requests?
a) Network Layer
b) Transport Layer
c) Application Layer
d) Presentation Layer

View Answer

Answer: a [Reason:] The network layer is used to handle the HTTP requests.

4. The User Interface is taken care by which layer?
a) Transport Layer
b) Network Layer
c) UI Layer
d) Presentation Layer

View Answer

Answer: b [Reason:] The UI Layer takes care of the User Interface.

5. Which of the following browsers use Webkit?
a) Chrome
b) Internet Explorer
c) Safari
d) Both Chrome and Safari

View Answer

Answer: d [Reason:] Webkit is what Chrome and Safari use, and is your target for most mobile web development since it is used as the layout or rendering engine for Android devices as well as mobile Safari for iOS devices and the Silk browser on Kindle Fires.

6. Which of the following first developed Gecko?
a) Safari
b) Netscape
c) Opera
d) Internet Explorer

View Answer

Answer: b [Reason:] Gecko was first developed at Netscape, before the Mozilla Project spun out as its own entity, as the successor to the original Netscape rendering engine, back in 1997.

7. Which of the following render HTML?
a) Browsers
b) Email Clients
c) Web Components
d) All of the mentioned

View Answer

Answer: d [Reason:] More tools than just browsers render HTML, including email clients and web components in other applications.

8. SpiderMonkey was developed by
a) Firefox
b) Internet Explorer
c) Safari
d) Opera

View Answer

Answer: a [Reason:] SpiderMonkey is the JavaScript engine made by Mozilla that is used in Firefox.

9. Carakan is used by which of the following browsers?
a) Firefox
b) Internet Explorer
c) Safari
d) Opera

View Answer

Answer: d [Reason:] Opera uses Carakan, which was introduced in 2010.

10. Which is the alternate name for JavaScriptCore that is used by Safari?
a) Nitro
b) SpiderMoney
c) Carakan
d) None of the mentioned

View Answer

Answer: a [Reason:] Safari uses JavaScriptCore, sometimes called Nitro.

Javascript MCQ Set 6

1. The libraries that build a new higher-level API for client-side programming is
a) Library
b) Framework
c) APIs
d) All of the mentioned

View Answer

Answer: b [Reason:] Many web developers find it useful to build their web applications on top of a clientside framework library. These libraries are “frameworks” in the sense that they build a new higher-level API for client-side programming on top of the standard and proprietary APIs offered by web browsers: once you adopt a framework, your code needs to be written to use the APIs defined by that framework.

2. Which of the following is not a framework?
a) jQuery
b) .NET
c) JavaScript
d) None of the mentioned

View Answer

Answer: c [Reason:] One of the most popular frameworks is jQuery. Here, JavaScript is a scripting language and not a framework.

3. Which of the following frameworks focuses on DOM and Ajax utilities?
a) jQuery
b) Prototype
c) Dojo
d) Both jQueryand Prototype

View Answer

Answer: d [Reason:] The Prototype library focuses on DOM and Ajax utilities like jQuery does, and adds quite a few core-language utilities as well.

4. What is the purpose of Dojo framework?
a) Focuses on DOM and Ajax utilities
b) Advertises incredible depth
c) Ajax utilities
d) None of the mentioned

View Answer

Answer: b [Reason:] Dojo is a large framework that advertises its “incredible depth.” It includes an extensive set of UI widgets, a package system, a data abstraction layer, and more.

5. Which is the in-house library of Yahoo!?
a) Dojo
b) YUI
c) Prototype
d) Closure

View Answer

Answer: b [Reason:] YUI is the in-house library of Yahoo!, and it is used on their home page.

6. What does Dojo and YUI have in common?
a) Facilitates DOM utilities and UI Widgets
b) Doesnot facilitates DOM utilities and UI Widgets
c) Client-side library
d) None of the mentioned

View Answer

Answer: a [Reason:] Like Dojo, it is a large, all-encompassing library with language utilities, DOM utilities, UI widgets, and so on. There are actually two incompatible versions of YUI, known as YUI 2 and YUI 3.

7. What are the two incompatible versions of YUI?
a) YUI1 and YUI2
b) YUI2 and YUI4
c) YUI1 and YUI3
d) YUI2 and YUI3

View Answer

Answer: a [Reason:] Like Dojo, it is a large, all-encompassing library with language utilities, DOM utilities, UI widgets, and so on. There are actually two incompatible versions of YUI, known as YUI 2 and YUI 3.

8. Which of the following framework was used by Google for Gmail?
a) Dojo
b) GWT
c) Closure
d) YUI

View Answer

Answer: d [Reason:] The Closure library is the client-side library that Google uses for Gmail, Google Docs, and other web applications. This library is intended to be used with the Closure compiler, which strips out unused library functions.

9. Which of the following is a web application API framework?
a) Dojo
b) YUI
c) GWT
d) All of the mentioned

View Answer

Answer: c [Reason:] GWT, the Google Web Toolkit , is a completely different kind of client-side framework. It defines a web application API in Java and provides a compiler to translate your Java programs into compatible clientside JavaScript.

10. Which is more widely used than GWT in Google?
a) Closure
b) Dojo
c) Procedure
d) jQuery

View Answer

Answer: a [Reason:] GWT, the Google Web Toolkit , is a completely different kind of client-side framework. It defines a web application API in Java and provides a compiler to translate your Java programs into compatible client-side JavaScript. GWT is used in some of Google’s products, but it is not as widelyused as their Closure library.

Synopsis and Project Report

You can buy synopsis and project from distpub.com. Just visit https://distpub.com/product-category/projects/ and buy your university/institute project from distpub.com