Java MCQ Number 01105

Java MCQ Set 1

1. How can we define the term Performance?
a) Speed of the input take in
b) Speed of the output display
c) Speed at which application functions
d) None of the mentioned

Answer

Answer: c [Reason:] Performance refers to the speed at which an application functions. It is a multifaceted aspect of quality.

2. When is an application said to show a web performance?
a) Time to respond
b) Time to load
c) Time to send a request
d) All of the mentioned

Answer

Answer: b [Reason:] When we’re talking about web applications, the time it takes your application to be presented to your users is what we will call web performance.

3. When is an application said to show a runtime performance?
a) Speed of response to user
b) Speed of user request
c) All of the mentioned
d) None of the mentioned

Answer

Answer: a [Reason:] The speed at which your application responds to your users’ interactions is what we’ll call runtime performance.

4. What does the span of time waiting for the page to be useful depend on?
a) Runtime performance
b) Web performance
c) Speed
d) None of the mentioned

Answer

Answer: b [Reason:] The span of time that you are waiting for the page to be usable depends on web performance.

5. 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.

6. In order to skip or seek to a desired location in a sound or video, which property becomes helpful?
a) audioSkip
b) currentTime
c) videoSkip
d) skiptoTime

Answer

Answer: b [Reason:] In addition to starting and stopping sound and video, you can skip (or “seek”) to a desired location within the media by setting the currentTime property.

7. Which of following shows a better runtime performance for coalescing functionality, using functions, and using objects?
a) Firefox unwoundfun
b) Firefox UsingFunct
c) Firefox UsingObject
d) None of the mentioned

Answer

Answer: b [Reason:] When we compare the runtime performance for coalescing functionality, using functions, and using objects, the Firefox UsingFunct shows a better performance.

8. Which of following shows a poorer runtime performance for coalescing functionality, using functions, and using objects?
a) Firefox unwoundfun
b) Firefox UsingFunct
c) Firefox UsingObject
d) None of the mentioned

Answer

Answer: a [Reason:] When we compare the runtime performance for coalescing functionality, using functions, and using objects, the Firefox UsingFunct shows a poorer performance.

9. In how many modes can the Closure compiler be run?
a) 2
b) 3
c) 4
d) 5

Answer

Answer: a [Reason:] Closure Compiler can be run in either of two modes:

  • In Simple mode it mostly performs like most other minifiers, removing whitespace, line breaks, and comments
  • In Advanced mode it rewrites the JavaScript by renaming variables and functions from longer descriptive names to single letters to save file size, and it inlines functions, coalescing them into single functions wherever it determines that it can

10. What is the purpose of the advanced mode in the Closure compiler?
a) Removing the variables and other parameters
b) Renaming the variables and other parameters
c) Slight alteration to improve the runtime performance
d) None of the mentioned

Answer

Answer: b [Reason:] In Advanced mode, the Closure Compiler rewrites the JavaScript by renaming variables and functions from longer descriptive names to single letters to save file size, and it inlines functions, coalescing them into single functions wherever it determines that it can.

Java MCQ Set 2

1. What does a Node object represent?
a) Single node
b) Set of nodes
c) Sequence of nodes
d) Node array

Answer

Answer: a [Reason:] The Node object represents a single node in the document tree.

2. What does the nodeName of the nodeType Document return?
a) doctype name
b) target
c) #comment
d) #document

Answer

Answer: d [Reason:] The nodeName of the nodeType Document returns #document.

3. What is the purpose of the method item()?
a) Returns node after the specified index
b) Returns node before the specified index
c) Returns node at specified index
d) None of the mentioned

Answer

Answer: c [Reason:] The method item() returns the node at the specified index in a node list.

4. How can the nodes in the node list be accessed?
a) Key
b) Index number
c) Looping
d) All of the mentioned

Answer

Answer: b [Reason:] The nodes in the node list can be accessed through their index number (starting from 0).

5. Which of the following is the child(s) of the node type EntityReference?
a) Element
b) Text
c) Both Element and Text
d) None of the mentioned

Answer

Answer: c [Reason:] The children of the node tyoe EntityReference are Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference.

6. Which node type represents the root-node of the DOM tree?
a) Document
b) DocumentFragment
c) DocumentType
d) Entity

Answer

Answer: a [Reason:] The node type Document represents the root-node of the DOM tree, the entire document.

7. What is the purpose of the DocumentFragment node type?
a) To hold a portion of a document
b) To split the document into fragments
c) To hold the entire document
d) None of the mentioned

Answer

Answer: a [Reason:] The DocumentFragment node type represents a “lightweight” Document object, which can hold a portion of a document.

8. How many nodetype – named constants are available?
a) 13
b) 11
c) 12
d) 10

Answer

Answer: c [Reason:] There are totally 12 nodetype – named constants available.

9. Which of the following Node types have a node value equal to null?
a) Document
b) DocumentFragment
c) DocumentType
d) All of the mentioned

Answer

Answer: d [Reason:] All the three node types namely, Document, DocumentFragment, DocumentType have a node value equal to null.

10. How many node object properties are there?
a) 12
b) 14
c) 16
d) 17

Answer

Answer: c [Reason:] There are totally 16 node object properties.

Java MCQ Set 3

1. What is the purpose of the radix parameter in the parseInt() method?
a) Numeral system not to be used
b) Numeral system to be used
c) Convertion mode
d) None of the mentioned

Answer

Answer: b [Reason:] The radix parameter is used to specify which numeral system to be used, for example, a radix of 16 (hexadecimal) indicates that the number in the string should be parsed from a hexadecimal number to a decimal number.

2. What will be the radix value of the parseInt() method when the string begins with 0?
a) 6
b) 7
c) 8
d) 9

Answer

Answer: c [Reason:] If the string begins with “0”, the radix is 8 (octal). This feature is deprecated.

3. What is the purpose of the method JSON.parse()?
a) Parses a string to integer
b) Parses a string to JSON
c) Parses a string from JSON to JSON2
d) None of the mentioned

Answer

Answer: b [Reason:] The JSON.parse() method parses a string as JSON, optionally transforming the value produced by parsing.

4. What is the return type of the method parseInt()?
a) String
b) Float
c) Integer
d) Date

Answer

Answer: c [Reason:] The method parseInt() returns an integer.

5. What are the parameters of the method JSON.parse()?
a) text
b) reviver
c) both text and reviver
d) none of the mentioned

Answer

Answer: c [Reason:] The parameters of the method JSON.parse() are :

  • text : The string to parse as JSON.
  • reviver : If a function, prescribes how the value originally produced by parsing is transformed, before being returned.

6. What will be the radix value of the parseInt() method when the string begins with any other value other than 0x and 0?
a) 8
b) 9
c) 10
d) 11

Answer

Answer: c [Reason:] The radix value will be 10 when the string of the method parseInt() begins with any other value other than 0x and 0.

7. What kind of an exception will be thrown if the string to parse is not valid JSON?
a) SyntaxError
b) ArrayOutOfBoundException
c) Both SyntaxError and ArrayOutOfBoundException
d) None of the mentioned

Answer

Answer: a [Reason:] The method JSON.parse()throws a SyntaxError exception if the string to parse is not valid JSON.

8. Which of the following is a JavaScript Compressor?
a) Esprima
b) UgilifyJS
c) Acron
d) None of the mentioned

Answer

Answer: b [Reason:] UgilifyJS is a parser, JavaScript Compressor and a beautiful toolkit.

9. What is the purpose of the UgilifyJS?
a) Exposes a simple API
b) Minification
c) Both Exposes a simple API and Minification
d) None of the mentioned

Answer

Answer: c [Reason:] UglifyJS2 is an excellent tool to help you minify your JavaScript! It’s a tried and tested tool, used by libraries such as jQuery.

10. Which of the following is the fastest JavaScript parser?
a) JSLint
b) Esprima
c) Acron
d) Traceur

Answer

Answer: c [Reason:] Acron is the fastest JavaScript parser written in JavaScript which takes only 96.9ms when compared to all the JavaScript parsers available.

Java MCQ Set 4

1. What is the necessity to create a separate file after having an API key?
a) To hold configuration information
b) To hold key details
c) To hold URL details
d) To hold the speed of the process

Answer

Answer: a [Reason:] Once you have an API key you should create a separate file to hold all of the configuration information that you will need to share between processes.

2. How many parameters does the API accept?
a) 5
b) 6
c) 7
d) 8

Answer

Answer: d [Reason:] The API accepts a total of 8 parameters namely :

  1. url
  2. location
  3. runs
  4. fvonly
  5. private
  6. block
  7. f
  8. k
  9. .

3. What is the purpose of the parameter location?
a) Specifies agent location
b) Specifies speed
c) Specifies browser
d) All of the mentioned

Answer

Answer: d [Reason:] The parameter location specifies the agent location, speed and browser to use for the test, formatted as location.browser:location.

4. What will happen if the fvonly parameter is set to 1?
a) Results got for the first view
b) Can run the repeat view test
c) All of the mentioned
d) None of the mentioned

Answer

Answer: a [Reason:] If you set fvonly to 1, you get results only for the first view, and do not run the repeat view test.

5. How many reserved words are there in JavaScript?
a) 63
b) 54
c) 68
d) 90

Answer

Answer: a [Reason:] There are a total of 63 reserved words in JavaScript.

6. What is the purpose of the window.location object in JavaScript?
a) Get the URL and redirect
b) Get the location of the cursor
c) Get the path to the next page
d) All of the mentioned

Answer

Answer: a [Reason:] The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page.

7. Which of the following method loads a new document?
a) location.new()
b) loadnew()
c) location.load()
d) location.assign()

Answer

Answer: d [Reason:] The location.assign() method loads a new document.

8. Which of the following method will wait for certain milliseconds to execute a specified method?
a) setInterval()
b) setTimeout()
c) setmilli()
d) setseconds()

Answer

Answer: a [Reason:] The setInterval() method will wait a specified number of milliseconds, and then execute a specified function, and it will continue to execute the function, once at every given time-interval.

9. What is the method used to stop an execution of a method?
a) clearInterval()
b) clcearTimeout()
c) both clearInterval() and clcearTimeout()
d) none of the mentioned

Answer

Answer: c [Reason:] The clearInterval() method is used to stop further executions of the function specified in the setInterval() method) The clearTimeout() method is used to stop the execution of the function specified in the setTimeout() method.

10. What is the meaning of JavaScript Hoisting?
a) Moving declarations to bottom
b) Moving declarations to top
c) Hosting variables by itself
d) None of the mentioned

Answer

Answer: b [Reason:] Hoisting is JavaScript’s default behavior of moving declarations to the top. In JavaScript, a variable can be declared after it has been used) In other words; a variable can be used before it has been declared.

Java MCQ Set 5

1. Which of the following is not a JavaScript framework?
a) Rico
b) Prototype
c) Joco
d) DoJo

Answer

Answer: d [Reason:] Dojo Toolkit is an open source modular JavaScript library (or more specifically JavaScript toolkit) designed to ease the rapid development of cross-platform, JavaScript/Ajax-based applications and web sites.

2. What is the purpose of the Math method toSource()?
a) Returns the string “Math”
b) Sends the source to the Math Library
c) Returns the value of the object
d) None of the mentioned

Answer

Answer: a [Reason:] The method Math.toSource() returns the string “Math”. But this method does not work with many browsers like IE.

3. Consider the following code snippet :

var o = new F();
o.constructor === F

The output would be :
a) false
b) true
c) 0
d) 1

Answer

Answer: b [Reason:] The result is true: the constructor property specifies the class.

4. How many static methods does a Date object have?
a) 3
b) 5
c) 4
d) 2

Answer

Answer: d [Reason:] The Date object defines two static methods namely Date.parse() and Date.UTC().

5. Which of the following are static methods in JavaScript?
a) Date.parse()
b) Date.UTC()
c) Both Date.parse() and Date.UTC()
d) None of the mentioned

Answer

Answer: c [Reason:] Date.parse() parses a string representation of a date and time and returns the internal millisecond representation of that date. Date.UTC() Returns the millisecond representation of the specified UTC date and time.

6. Scan the following code :

<script>
function getAvg(){
var avg = 0;
for(var x = 0; x < 200; x++){
avg += x;
}
return(avg/200);
}

What is the work of the getAvg function?
a) Multiples values from 0 to 200
b) Adds values from 0 to 200
c) Simply traverses with no operation
d) Find the average of 199 numbers

Answer

Answer: d [Reason:] The above code performs the average calculation of numbers from 0 to 199.

7. If we have an object r and want to know if it is a Range object, we can write:
a) r typeof Range
b) r is Range
c) r equals Range
d) r instanceof Range

Answer

Answer: d [Reason:] The r instanceof Range returns true if r inherits from Range.prototype. The instanceof operatory does not actually check whether r was initialized by the Range constructor.

8. What is the property to access the first child of a node?
a) timestamp.Child1
b) timestamp.Child(1)
c) timestamp.Child(0)
d) timestamp.firstChild

Answer

Answer: d [Reason:] The first child of a node can be accessed using the firstChild property.

9. Which of the following is not an object?
a) Element
b) Location
c) Position
d) Window

Answer

Answer: c [Reason:] There is no object called Position.

10. What is the code snippet to change the class and let the stylesheet specify the details?

a) timestamp.className = "highlight";
b) timestamp.className = "change";
c) timestamp.className = "specify";
d) timestamp.className = "move";
Answer

Answer: a [Reason:] The above code snippet changes the class and lets the stylesheet specify the details.

ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.