Java MCQ Set 1
1. What is a stateless file server ?
a) It keeps tracks of states of different objects
b) It maintains internally no state information at all
c) It maintains some information in them
d) None of the mentioned
Answer
Answer: b [Reason:] None.
2. What are the characteristics of stateless server ?
a) Easier to implement
b) They are not fault-tolerant upon client or server failures
c) They store all information file server
d) They are redundant to keep data safe
Answer
Answer: a [Reason:] None.
3. Implementation of a stateless file server must not follow ?
a) Idempotency requirement
b) Encryption of keys
c) File locking mechanism
d) Cache consistency
Answer
Answer: b [Reason:] None.
4. What are the advantages of file replication ?
a) Improves availability &performance
b) Decreases performance
c) They are consistent
d) Improves speed
Answer
Answer: a [Reason:] None.
5. What are characteristic of NFS protocol ?
a) Search for file withing directory
b) Read a set of directory entries
c) Manipulate links and directories
d) All of the mentioned
Answer
Answer: d [Reason:] None.
6. What is coherency of replicated data ?
a) All replicas are identical at all times
b) Replicas are perceived as identical only at some points in time
c) Users always read the most recent data in the replicas
d) All of the mentioned
Answer
Answer: d [Reason:] None.
7. What are the three popular semantic modes ?
a) Unix, Coherent & Session semantics
b) Unix, Transaction & Session semantics
c) Coherent, Transaction & Session semantics
d) Session, Coherent semantics
Answer
Answer: b [Reason:] None.
8. What are the characteristics of Unix semantics ?
a) Easy to implement in a single processor system
b) Data cached on a per process basis using write through case control
c) Write-back enhances access performance
d) All of the mentioned
Answer
Answer: d [Reason:] None.
9. What are the characteristics of transaction semantics ?
a) Suitable for applications that are concerned about coherence of data
b) The users of this model are interested in the atomicity property for their transaction
c) Easy to implement in a single processor system
d) Write-back enhances access performance
Answer
Answer: b [Reason:] None.
10. What are non characteristics of session semantics ?
a) Each client obtains a working copy from the server
b) When file is closed, the modified file is copied to the file server
c) The burden of coordinating file sharing is ignored by the system
d) Easy to implement in a single processor system
Answer
Answer: d [Reason:] None.
Java MCQ Set 2
1. How many default number methods are available in JavaScript?
a) 5
b) 6
c) 7
d) 8
Answer
Answer: c [Reason:] There are a total of 7 default number methods in JavaScript namely :
- constructor()
- toExponential()
- toFixed()
- toLocaleString()
- toPrecision()
- toString()
- valueOf()
2. What is an observer effect?
a) Observing influences outcome
b) Observing never influences outcome
c) Obversing and outcome are independent
d) None of the mentioned
Answer
Answer: a [Reason:] The observer effect says that simply observing an act influences its outcome.
3. Which of the following are ways to benchmark code?
a) Timing the code
b) Calculating the number of operations performed
c) Timing the code & Calculating the number of operations performed
d) None of the mentioned
Answer
Answer: c [Reason:] There are a couple of ways to benchmark code—either by timing it or by calculating the number of operations performed during execution.
4. How to calculate the run time of a code?
a) Start time – End time
b) End time – Start time
c) Start time/ End time
d) Start time * End time
Answer
Answer: b [Reason:] The run time of a code can be calculated as :
run time = end time – start time
5. According to the workflow of a runtime logging, what happens after calculating the run time?
a) Display to screen
b) Log to server
c) Either Display to screen or Log to server
d) None of the mentioned
Answer
Answer: c [Reason:] According to the workflow of a runtime logging, after calculating the run time, decision boxes are kept that will check to either display to the debug screen or log to the server.
6. Which of the following object is used to post the data to an external process, say savePerfData?
a) XML
b) XBT
c) XHR
d) None of the mentioned
Answer
Answer: c [Reason:] The benchmarking process will call the external process. We use XHR object to post the data to the external process.
7. Where does the external process save the result of the test?
a) Normal file
b) Flat file
c) Folder
d) None of the mentioned
Answer
Answer: b [Reason:] The external process, say savePerfData should in turn save the results of the test in a flat file.
8. Which function is used to start the time logging?
a) startTimeLogging()
b) start()
c) Loggingstart()
d) startLogging()
Answer
Answer: a [Reason:] The function startTimeLogging() is used to start the time logging.
9. Which of the following attribute of form tag is not set by using document object in JavaScript?
a) Target
b) Enctype
c) Action
d) None of the mentioned
Answer
Answer: d [Reason:] All of the above can be set by using document object in JavaScript.
Java MCQ Set 3
1. How many default number methods are available in JavaScript?
a) 5
b) 6
c) 7
d) 8
Answer
Answer: c [Reason:] There are a total of 7 default number methods in JavaScript namely :
- constructor()
- toExponential()
- toFixed()
- toLocaleString()
- toPrecision()
- toString()
- valueOf()
2. What is an observer effect?
a) Observing influences outcome
b) Observing never influences outcome
c) Obversing and outcome are independent
d) None of the mentioned
Answer
Answer: a [Reason:] The observer effect says that simply observing an act influences its outcome.
3. Which of the following are ways to benchmark code?
a) Timing the code
b) Calculating the number of operations performed
c) Timing the code & Calculating the number of operations performed
d) None of the mentioned
Answer
Answer: c [Reason:] There are a couple of ways to benchmark code—either by timing it or by calculating the number of operations performed during execution.
4. How to calculate the run time of a code?
a) Start time – End time
b) End time – Start time
c) Start time/ End time
d) Start time * End time
Answer
Answer: b [Reason:] The run time of a code can be calculated as :
run time = end time – start time
5. According to the workflow of a runtime logging, what happens after calculating the run time?
a) Display to screen
b) Log to server
c) Either Display to screen or Log to server
d) None of the mentioned
Answer
Answer: c [Reason:] According to the workflow of a runtime logging, after calculating the run time, decision boxes are kept that will check to either display to the debug screen or log to the server.
6. Which of the following object is used to post the data to an external process, say savePerfData?
a) XML
b) XBT
c) XHR
d) None of the mentioned
Answer
Answer: c [Reason:] The benchmarking process will call the external process. We use XHR object to post the data to the external process.
7. Where does the external process save the result of the test?
a) Normal file
b) Flat file
c) Folder
d) None of the mentioned
Answer
Answer: b [Reason:] The external process, say savePerfData should in turn save the results of the test in a flat file.
8. Which function is used to start the time logging?
a) startTimeLogging()
b) start()
c) Loggingstart()
d) startLogging()
Answer
Answer: a [Reason:] The function startTimeLogging() is used to start the time logging.
9. Which of the following attribute of form tag is not set by using document object in JavaScript?
a) Target
b) Enctype
c) Action
d) None of the mentioned
Answer
Answer: d [Reason:] All of the above can be set by using document object in JavaScript.
Java MCQ Set 4
1. BLOB stands for
a) Binary Little Object
b) Binary Large Object
c) Broken Large Object
d) None of the mentioned
Answer
Answer: b [Reason:] A Blob is an opaque reference to, or handle for, a chunk of data. The name comes from SQL databases, where it means “Binary Large Object.” In JavaScript, Blobs often represent binary data, and they can be large, but neither is required: a Blob could also represent the contents of a small text file.
2. The size of blobs are generally calculated in
a) Meters
b) Kilometers
c) Bytes
d) Pixels
Answer
Answer: c [Reason:] Blobs are opaque: all you can do with them directly is determine their size in bytes, ask for their MIME type, and chop them up into smaller Blobs.
3. The blobs are generally stored in
a) Memory
b) Disk
c) Both Memory and Disk
d) None of the mentioned
Answer
Answer: c [Reason:] The web browser can store Blobs in memory or on disk, and Blobs can represent really enormous chunks of data (such as video files) that are too large to fit in main memory without first being broken into smaller pieces with slice().
4. The blobs are broken into smaller pieces using which of the following functions?
a) partition()
b) cut()
c) sliceall()
d) slice()
Answer
Answer: d [Reason:] The web browser can store Blobs in memory or on disk, and Blobs can represent really enormous chunks of data (such as video files) that are too large to fit in main memory without first being broken into smaller pieces with slice().
5. Which algorithm supports blobs?
a) Structured clone algorithm
b) Double buffer algorithm
c) Chen’s algorithm
d) Retrieval algorithm
Answer
Answer: a [Reason:] Blobs are supported by the structured clone algorithm, which means that you can obtain one from another window or thread via the message event.
6. Which database can be used to retrieve blobs?
a) Server-side databases
b) Client-side databases
c) Both Server-side and Client-side databases
d) None of the mentioned
Answer
Answer: b [Reason:] Blobs can be retrieved fro client-side databases.
7. Which object can be used to create your own blobs?
a) Creator
b) BlobCreator
c) BlobBuilder
d) None of the mentioned
Answer
Answer: c [Reason:] You can create your own blobs, using a BlobBuilder object to build them out of strings, ArrayBuffer objects, and other Blobs.
8. Which of the following is a subtype of Blob?
a) Elemental Object
b) Create Object
c) Data Object
d) File Object
Answer
Answer: d [Reason:] The client-side JavaScript File object is a subtype of Blob: a File is just a Blob of data with a name and a modification date.
9. Which method facilitates in uploading a Blob to a server?
a) send()
b) pass()
c) upload()
d) store()
Answer
Answer: a [Reason:] You can upload a Blob to a server by passing it to the send() method of an XMLHttpRequest object.
10. A Blob URL can be created using which of the following function?
a) createURL()
b) createObjectURL()
c) designURL()
d) URLCreation()
Answer
Answer: b [Reason:] Create a Blob URL with the function createObjectURL(). At the time of this writing, the draft specification and Firefox 4 put this function in a global object named URL, and Chrome and Webkit prefix that new global, calling it webkitURL.
Java MCQ Set 5
1. The behaviour of the instances present of a class inside a method is defined by
a) Method
b) Classes
c) Interfaces
d) Classes and Interfaces
Answer
Answer: b [Reason:] The behaviour of the instance of a class is defined by the class and is shared by all instances.
2. The keyword or the property that you use to refer to an object through which they were invoked is
a) from
b) to
c) this
d) object
Answer
Answer: c [Reason:] The ‘this’ keyword is used to refer to the object through which the properties or methods were invoked. This use of ‘this’ is a fundamental characteristic of the methods of any class.
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. The basic difference between JavaScript and Java is
a) There is no difference
b) Functions are considered as fields
c) Variables are specific
d) Functions are values, and there is no hard distinction between methods and fields
Answer
Answer: d [Reason:] The basic difference between JavaScript and Java is that the functions are values, and there is no hard distinction between methods and fields.
5. The meaning for Augmenting classes is that
a) objects inherit prototype properties even in dynamic state
b) objects inherit prototype properties only in dynamic state
c) objects inherit prototype properties in static state
d) None of the mentioned
Answer
Answer: a [Reason:] JavaScript’s prototype-based inheritance mechanism is dynamic: an object inherits properties from its prototype, even if the prototype changes after the object is created. This means that we can augment JavaScript classes simply by adding new methods to their prototype objects.
6. The property of JSON() method is:
a) it can be invoked manually as object.JSON()
b) it will be automatically invoked by the compiler
c) it is invoked automatically by the JSON.stringify() method
d) it cannot be invoked in any form
Answer
Answer: c [Reason:] The JSON format is intended for serialization of data structures and can handle JavaScript primitive values, arrays, and plain objects. It does not know about classes, and when serializing an object, it ignores the object’s prototype and constructor. If you call JSON.stringify() on a Range or Complex object, for example, it returns a string like {“from”:1, “to”:3} or {“r”:1, “i”:-1}.
7. When a class B can extend another class A, we say that
a) A is the superclass and B is the subclass
b) B is the superclass and A is the subclass
c) Both A and B are the superclass
d) Both A and B are the subclass
Answer
Answer: a [Reason:] Instances of B inherit all the instance methods of A. The class B can define its own instance methods, some of which may override methods of the same name defined by class A.
8. If A is the superclass and B is the subclass, then subclass inherting the superclass can be represented as
a) B=inherit(A);
b) B=A.inherit();
c) B.prototype=inherit(A);
d) B.prototype=inherit(A.prototype);
Answer
Answer: c [Reason:] The subclass B inherits the prototype of the class A.
9. The snippet that filters the filtered set is
a) var t=new FilteredSet(s, {function(s) {return !(x instanceof Set);}); b) var t=new FilteredSet{function(s) {return !(x instanceof Set);}); c) var t=new FilteredSet(s, {function(s) {return (x instanceof Set);}); d) var t=new FilteredSet(s, {function(s) {return x;});
Answer
Answer: a [Reason:] None.
10. The method that can be used to create new properties and also to modify the attributes of existing properties is
a) Object.defineProperty()
b) Object.defineProperties()
c) Both Object.defineProperty() and Object.defineProperties()
d) None of the mentioned
Answer
Answer: c [Reason:] When used to define new properties, any attributes you omit default to false. Therefore, both Object.defineProperty() and Object.defineProperties() can be used to create and modify the attributes.
Java MCQ Set 6
1. The main purpose of JavaScript in web browser is to
a) Creating animations and other visual effects
b) User Interface
c) Visual effects
d) None of the mentioned
Answer
Answer: a [Reason:] JavaScript can help to facilitate that experience, for example by:
- Creating animations and other visual effects to subtly guide a user and help with page navigation
- Sorting the columns of a table to make it easier for a user to find what she needs
- Hiding certain content and revealing details progressively as the user “drills down”
into that content
2. A JavaScript program can traverse and manipulate document content through
a) Element Object
b) Document Object
c) Both Element and Document Object
d) None of the mentioned
Answer
Answer: c [Reason:] A JavaScript program can traverse and manipulate document content through the Document object and the Element objects it contains. It can alter the presentation of that content by scripting CSS styles and classes.
3. The behaviour of the document elements can be defined by
a) Using document object
b) Registering appropriate event handlers
c) Using element object
d) All of the mentioned
Answer
Answer: b [Reason:] The JavaScript program can define the behavior of document elements by registering appropriate event handlers.
4. The service(s) that enables networking through scripted HTTP requests is
a) XMLHttpResponse
b) XMLRequest
c) XMLHttpRequest
d) All of the mentioned
Answer
Answer: c [Reason:] The best known advanced services is the XMLHttpRequest object, which enables networking through scripted HTTP requests.
5. The HTML5 specification includes
a) Data storage
b) Graphics APIs
c) Other APIs for web apps
d) All of the mentioned
Answer
Answer: d [Reason:] The HTML5 specification (which, at the time of this writing, is still in draft form) and related specifications are defining a number of other important APIs for web apps.
These include the data storage and graphics APIs.
6. Which of the following are not advanced services?
a) Data storage
b) Networking
c) XMLHttpRequest object
d) None of the mentioned
Answer
Answer: d [Reason:] All the above mentioned are advanced services.
7. JavaScript code between a pair of “script” tags are called
a) Non-inline
b) External
c) Referenced
d) Inline
Answer
Answer: d [Reason:] Inline code are those that are writeen between a pair of “script” tags.
8. Client-side JavaScript code is embedded within HTML documents in
a) A URL that uses the special javascript:encoding
b) A URL that uses the special javascript:stack
c) A URL that uses the special javascript:protocol
d) A URL that uses the special javascript:code
Answer
Answer: c [Reason:] The Client-side JavaScript code is embedded within HTML documents in four ways :
- Inline, between a pair of “script” tags
- From an external file specified by the src attribute of a “script” tag
- In an HTML event handler attribute, such as onclick or onmouseover
- In a URL that uses the special javascript: protocol.
9. What is the programming philosophy that argues that content and behaviour should as much as possible be kept separate?
a) Unobtrusive JavaScript
b) Obtrusive JavaScript
c) Inherited JavaScript
d) Modular JavaScript
Answer
Answer: a [Reason:] A programming philosophy known as unobtrusive JavaScript argues that content (HTML) and behavior (JavaScript code) should as much as possible be kept separate. According to this programming philosophy, JavaScript is best embedded in HTML documents using “script” elements with src attributes.
10. Which of the following communicates with server-side CGI scripts through HTML form submissions and can be written without the use of JavaScript?
a) Static Web Pages
b) Interactive Web Pages
c) Conditional Web Pages
d) None of the mentioned
Answer
Answer: b [Reason:] Interactive web pages that communicate with server-side CGI scripts through HTML form submissions were the original “web application” and can be written without the use of JavaScript.
Java MCQ Set 7
1. What is a framework?
a) User time efficiency
b) Author time efficiency
c) Both User time and Author time efficiency
d) None of the mentioned
Answer
Answer: b [Reason:] 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) none of the mentioned
Answer
Answer: c [Reason:] 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
Answer
Answer: a [Reason:] 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.
4. Which class provides an interface for invoking JavaScript methods and examining JavaScript properties?
a) ScriptObject
b) JSObject
c) JavaObject
d) Jobject
Answer
Answer: b [Reason:] 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) None of the mentioned
Answer
Answer: c [Reason:] eval is a JavaScript native function that accepts a string and executes the string as JavaScript. It basically fires up the interpreter and allows the passed-in string to be parsed and interpreted at the time of invocation.
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
Answer
Answer: d [Reason:] 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
Answer
Answer: a [Reason:] JavaArray is accessed from within JavaScript code.
8. What is the syntax of close method for document object?
a) Close(object)
b) Close(doc)
c) Close(val)
d) Close()
Answer
Answer: d [Reason:] 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)
Answer
Answer: d [Reason:] Math.max(x,y) is used to find the highest value of x and y.
10. How can you find a client’s browser name?
a) browser.name
b) navigator.appName
c) client.navName
d) none of the mentioned
Answer
Answer: b [Reason:] The client’s browser name can be found by using navigator.appName.