Javascript MCQ Set 1
1. Which of the following are JavaScript logging library?
a) log
b) loglevel
c) leveljavascript
d) jslogjava
Answer
Answer: b [Reason:] loglevel is a JavaScript logging library that is reliable and extremeley easy-to-use over the various console.log() methods.
2. What is the significance of the JavaScript logging library loglevel?
a) Lightweight
b) Unreliable
c) Minimal usage
d) Inconvenient
Answer
Answer: a [Reason:] loglevel is a lightweight, minimal and convenient JavaScript logging library which provides a reliable and extremely easy-to-use layer over the various console.log() methods that are often available, with none of their downsides. loglevel makes these methods safe to use by gracefully handling the cases where they don’t exist, and also lets you filter the output of these, to only show messages at warn level or above, for example. This level is persisted in cookies (if available, safely handling non-browser environments too). loglevel doesn’t try and go beyond this, instead just sticking to the core fundamentals of logging with no frills.
3. Which of the following browsers support the usage of the JavaScript logging library log4javascript?
a) IE
b) Safari
c) Opera
d) All of the mentioned
Answer
Answer: d [Reason:] Since a major use of JavaScript logging is in browser testing, log4javascript is tested and works across all recent major browsers, including :
- Internet Explorer 5+ for Windows
- Mozilla, Firefox, Netscape
- Google Chrome
- Safari 1.3+
- Opera 7.5+
- WebKit
- Konqueror 3.4+
4. What is the significance of the JavaScript logging library log4javascript?
a) Fully featured
b) Easy to use
c) Fully featured and Easy to use
d) None of the mentioned
Answer
Answer: c [Reason:] log4javascript is a fully-featured, easy-to-use JavaScript logging framework based on the Java logging framework log4j. Its purpose is to provide JavaScript developers with a familiar, robust and flexible logging framework with which to debug JavaScript applications.
5. Which of the following JavaScript logging framework lets one to toggle the plane?
a) Lumberjack
b) Log Hound
c) jsTracer
d) fvlogger
Answer
Answer: a [Reason:] Lumberjack is a javascript logging framework that includes a sexy logging pane/console that stays at the bottom of the page. You can toggle the pane.
6. Which of the following JavaScript logging tool is also a debugging tool?
a) Blackbird
b) Log Hound
c) jsTracer
d) fvlogger
Answer
Answer: c [Reason:] jsTracer is a simple yet feature rich JavaScript logging and debugging tool. It is especially useful for debugging what has been coined “Web 2.0” code.
7. Which of the following JavaScript logging tool is standalone?
a) Blackbird
b) Log Hound
c) jsTracer
d) fvlogger
Answer
Answer: b [Reason:] Log Hound is a standalone JavaScript logging utility that allows you to log messages during execution of JavaScript code. The log messages are stored and are viewable via the logging user interface which allows you to search the messages using multiple cooperative criteria) Log messages can be categorized by severity and by tags that can be associated with the messages when they are logged.
8. Which of the following are appenders?
a) DummyAppender
b) ConsoleAppender
c) FileAppender
d) All of the mentioned
Answer
Answer: d [Reason:] There are several ways to log using “appender”s. The current available Appenders are:
9. Which of the following reads the textual contents of a URL and returns as a string?
a) spawn(f);
b) load(filename,…);
c) readFile(file);
d) readUrl(url);
Answer
Answer: d [Reason:] Rhino defines a handful of important global functions that are not part of core JavaScript in which readUrl(url) reads the textual contents of a URL and return as a string.
10. When does JSNLog have server-side extensions?
a) Use of .NET
b) Use of Java
c) Both .NET and Java
d) None of the mentioned
Answer
Answer: a [Reason:] If you use .Net, JSNLog has server side extensions that receive log data from the browser and have it logged on the server. And it lets you configure your loggers in your web.config.
Javascript MCQ Set 2
1. What is the purpose of script loading?
a) Load Scripts programmatically
b) Load JavaScript files manually
c) Load JavaScript files programmatically
d) All of the mentioned
Answer
Answer: c [Reason:] The script loading loads remote JavaScript files programmatically and allows us to trick the rendering engine.
2. What will happen if the browser encounters a script tag without an src attribute?
a) Throws an error
b) Throws an exception
c) Sends it to the compiler
d) Sends it to the interpreter
Answer
Answer: d [Reason:] If the browser encounters a script tag without a src attribute, the rendering engine simply passes the code to the JavaScript Interpreter for execution.
3. What is the solution to the absence of a script tag without an src attribute?
a) Resend the scripts
b) Create inline JavaScript
c) All of the mentioned
d) None of the mentioned
Answer
Answer: b [Reason:] The solution to the absence of a script tag without an src attribute is to create inline JavaScript to append script tags to the document dynamically, for example:
<script> var script = window.document.createElement('SCRIPT'); script.src = src; window.document.getElementsByTagName('HEAD')[0].appendChild(script); </script>
4. How to get a particular value using the tagged name?
a) getElementbyID()
b) getElementsbyName()
c) getElementsbyTagName()
d) getTagName()
Answer
Answer: c [Reason:] The method getElementsbyTagName() can be used to get a particular value using the tagged name associated with the document.
5. What should be the type of the script_url?
a) Object
b) String
c) Array
d) Any of the mentioned
Answer
Answer: d [Reason:] The type of the script_url can be anything that will be compared with the typeof keyword’s result.
6. What is the purpose of using the async attribute in the script tag?
a) Load the script asynchronously
b) Load the script synchronously
c) Load the page asynchronously
d) Load the page synchronously
Answer
Answer: a [Reason:] The async option is a native attribute that will tell the browser to load the script asynchronously.
7. Why do we need to use an onload event in the script tag after using the async attribute?
a) Invoke code during page loading
b) Invoke code during script loading
c) Invoke code during downloading
d) None of the mentioned
Answer
Answer: c [Reason:] When using async you don’t know when the file will be downloaded, so you can attach an onload event handler to the script tag. This will allow you to invoke or instantiate any code that will need to be run when the file is downloaded:
<script src="[URL"] async onload="init();]"></script>
8. What is the purpose of the startTimeLogging() method?
a) Start the timer
b) Capture time logging
c) Capture timing data for referencing
d) All of the mentioned
Answer
Answer: d [Reason:] The startTimeLogging() method captures the timing data for ad hoc, etc for referencing an uncached document.location.
9. What is the type of datatype the async attribute optionally accepts?
a) Integer
b) String
c) Boolean
d) Decimal
Answer
Answer: c [Reason:] The async attribute optionally accepts the boolean datatype of default value as true.
10. What is the method used to create an element in the HTML DOM?
a) createDOMelement()
b) createElement()
c) createDOMElement()
d) none of the mentioned
Answer
Answer: b [Reason:] The createElement() can be used to create an element in the HTML DOM.
Javascript MCQ Set 3
1. What is the purpose of script loading?
a) Load Scripts programmatically
b) Load JavaScript files manually
c) Load JavaScript files programmatically
d) All of the mentioned
Answer
Answer: c [Reason:] The script loading loads remote JavaScript files programmatically and allows us to trick the rendering engine.
2. What will happen if the browser encounters a script tag without an src attribute?
a) Throws an error
b) Throws an exception
c) Sends it to the compiler
d) Sends it to the interpreter
Answer
Answer: d [Reason:] If the browser encounters a script tag without a src attribute, the rendering engine simply passes the code to the JavaScript Interpreter for execution.
3. What is the solution to the absence of a script tag without an src attribute?
a) Resend the scripts
b) Create inline JavaScript
c) All of the mentioned
d) None of the mentioned
Answer
Answer: b [Reason:] The solution to the absence of a script tag without an src attribute is to create inline JavaScript to append script tags to the document dynamically, for example:
<script> var script = window.document.createElement('SCRIPT'); script.src = src; window.document.getElementsByTagName('HEAD')[0].appendChild(script); </script>
4. How to get a particular value using the tagged name?
a) getElementbyID()
b) getElementsbyName()
c) getElementsbyTagName()
d) getTagName()
Answer
Answer: c [Reason:] The method getElementsbyTagName() can be used to get a particular value using the tagged name associated with the document.
5. What should be the type of the script_url?
a) Object
b) String
c) Array
d) Any of the mentioned
Answer
Answer: d [Reason:] The type of the script_url can be anything that will be compared with the typeof keyword’s result.
6. What is the purpose of using the async attribute in the script tag?
a) Load the script asynchronously
b) Load the script synchronously
c) Load the page asynchronously
d) Load the page synchronously
Answer
Answer: a [Reason:] The async option is a native attribute that will tell the browser to load the script asynchronously.
7. Why do we need to use an onload event in the script tag after using the async attribute?
a) Invoke code during page loading
b) Invoke code during script loading
c) Invoke code during downloading
d) None of the mentioned
Answer
Answer: c [Reason:] When using async you don’t know when the file will be downloaded, so you can attach an onload event handler to the script tag. This will allow you to invoke or instantiate any code that will need to be run when the file is downloaded:
<script src="[URL"] async onload="init();]"></script>
8. What is the purpose of the startTimeLogging() method?
a) Start the timer
b) Capture time logging
c) Capture timing data for referencing
d) All of the mentioned
Answer
Answer: d [Reason:] The startTimeLogging() method captures the timing data for ad hoc, etc for referencing an uncached document.location.
9. What is the type of datatype the async attribute optionally accepts?
a) Integer
b) String
c) Boolean
d) Decimal
Answer
Answer: c [Reason:] The async attribute optionally accepts the boolean datatype of default value as true.
10. What is the method used to create an element in the HTML DOM?
a) createDOMelement()
b) createElement()
c) createDOMElement()
d) none of the mentioned
Answer
Answer: b [Reason:] The createElement() can be used to create an element in the HTML DOM.
Javascript MCQ Set 4
1. Which property helps to initiate the HTTP requests?
a) request
b) location
c) send
d) none of the mentioned
Answer
Answer: b [Reason:] It is possible for JavaScript code to script HTTP, however. HTTP requests are initiated when a script sets the location property of a window object or calls the submit() method of a form object. In both cases, the browser loads a new page.
2. Which method is an alternative of the property location of a window object?
a) submit()
b) locate()
c) load()
d) none of the mentioned
Answer
Answer: a [Reason:] It is possible for JavaScript code to script HTTP, however. HTTP requests are initiated when a script sets the location property of a window object or calls the submit() method of a form object. In both cases, the browser loads a new page.
3. Which of the following uses scripted HTTP?
a) XML
b) HTML
c) Ajax
d) All of the mentioned
Answer
Answer: c [Reason:] The key feature of an Ajax application is that it uses scripted HTTP to initiate data exchange with a web server without causing pages to reload.
4. Which of the below is a lieral reverse of Ajax?
a) HTTP
b) HTML
c) XML
d) Comet
Answer
Answer: d [Reason:] Comet is the reverse of Ajax: in Comet, it is the web server that initiates the communication, asynchronously sending messages to the client.
5. The other name for Comet is
a) Server Push
b) Ajax Push
c) HTTP Streaming
d) All of the mentioned
Answer
Answer: d [Reason:] Other names for Comet include “Server Push”, “Ajax Push”, “HTTP Streaming”.
6. Which is the element that has a src property to initiate HTTP GET request?
a) img
b) iframe
c) script
d) both img and script
Answer
Answer: d [Reason:] Both img and script contains the src property thatt can be set to initiate an HTTP GET request.
7. XMLHttpRequesr is a
a) Object
b) Class
c) Both Object and Class
d) None of the mentioned
Answer
Answer: c [Reason:] XMLHttpRequest is both an object and a class.
8. Which of the following are the features of an HTTP request?
a) URL being requested
b) Optional request body
c) Optional set of request headers
d) All of the mentioned
Answer
Answer: d [Reason:] An HTTP request consists of four parts :
- the HTTP request method or “verb”
- the URL being requested
- an optional set of request headers, which may include authentication information
- an optional request body
9. Which of the following is a feature of the HTTP response?
a) Mandatory response body
b) Optional response body
c) URL being released
d) Optional set of response headers
Answer
Answer: a [Reason:] The HTTP response sent by a server has three parts :
- a numeric and textual status code that indicates the success or failure of the request
- a set of response headers
- the response body
10. Which is the appropriate code to begin a HTTP GET request?
a) request.open("GET","data"); b) request.open(GET,"data.csv"); c) request.open("GET","data.csv"); d) request.open("GET");
Answer
Answer: c [Reason:] The code that begins a HTTP GET request for the contents of the specified URL is
request.open("GET","data.csv");
Javascript MCQ Set 5
1. What is the advantage of the code produced graphics being smaller than the images themselves?
a) Bandwidth saving
b) Increase in bandwidth
c) Dynamic advantages
d) None of the mentioned
Answer
Answer: a [Reason:] The code used to produce graphics on the client side is typically much smaller than the images themselves, creating a substantial bandwidth savings.
2. Which of the following uses a lot of CPU cycles?
a) GUI
b) Statically generated graphics
c) Dynamically generated graphics
d) All of the mentioned
Answer
Answer: c [Reason:] Dynamically generating graphics from real-time data uses a lot of CPU cycles.
3. Which HTML element is used to include images?
a) image
b) img
c) src
d) sourceimg
Answer
Answer: b [Reason:] Web pages include images using the HTML img element.
4. What is the purpose of image replacement?
a) To replace an image
b) To implement special effects
c) Removal of image rollovers
d) Implementation of image rollovers
Answer
Answer: d [Reason:] One common use for image replacement is to implement image rollovers, in which an image changes when the mouse pointer moves over it.
5. When is JavaScript called obtrusive?
a) JavaScript code is medium sized
b) JavaScript code is so small
c) JavaScript code is so large
d) All of the mentioned
Answer
Answer: c [Reason:] When the amount of JavaScript code is so large that it effectively obscures the HTML, we call JavaScript as obtrusive.
6. Which is a possible way of finding all the img elements in the document?
a) document(images)
b) document.images[].
c) document(img)
d) all of the mentioned
Answer
Answer: b [Reason:] The best suited option is document.image[] to find all img elements in the document.
7. Which of the following elements are used to include audio?
a) audio
b) video
c) svg
d) all of the mentioned
Answer
Answer: a [Reason:] The audio tag is used to include audio in the HTML document.
8. Which of the following attributes are common to both audio and video?
a) enter
b) control
c) controls
d) all of the mentioned
Answer
Answer: c [Reason:] Both audio and video support a controls attribute.
9. Which of the following is not the property of the video tag?
a) width
b) height
c) breadth
d) none of the mentioned
Answer
Answer: c [Reason:] The video tag does not contain a breadth property.
10. Which of the following is the parameter used to invoke the Audio() constructor?
a) File type
b) Music type
c) Both File and Music
d) None of the mentioned
Answer
Answer: c [Reason:] The parameter type of the Audio() constructor is any file type that contains audio to be played.
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