InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What will happen if you set the private flag as 1?(a) Test will be run only by the administrator(b) Test will not be run(c) Test is public(d) Test is not displayed in public |
|
Answer» Right choice is (d) Test is not displayed in public The best explanation: The WebPageTest results provide rich diagnostic information including resource loading waterfall charts, Page Speed optimization checks and suggestions for improvements which can be kept public or private. Setting the private flag to 1 will make sure that the test is not displayed in the public list of tests. |
|
| 2. |
When the “end” event fires on EOF when no more data will arrive, which function is called?(a) s.on(“data”,f);(b) s.on(“end”,f);(c) s.on(“error”,f);(d) s.on(“default”,f); |
|
Answer» Right answer is (b) s.on(“end”,f); For explanation: ”EOF” stands for end of file.The above code snippet gets “end” event fired on EOF when no more data will arrive. |
|
| 3. |
Which of the following gets converted to DOM elements by the rendering engine?(a) Tokens(b) Strings(c) Address(d) Characters |
|
Answer» The correct option is (a) Tokens Explanation: The string returned by the network layer gets tokenized into meaningful chunks. The rendering engine then takes the tokens and converts them to DOM elements. There are five categories of tokens: 1) constants, 2) identifiers, 3) operators, 4) separators, and 5) reserved words. |
|
| 4. |
When does the browser stop rendering the HTML?(a) Inline JavaScript block(b) External JavaScript file(c) Both Inline JavaScript block & External JavaScript file(d) External HTML file |
|
Answer» Right choice is (c) Both Inline JavaScript block & External JavaScript file Easy explanation: When the browser parses the HTML markup, it stops rendering the HTML when it encounters an inline JavaScript block or external JavaScript file. At this point, the user experiences rendering delays. |
|
| 5. |
What is the method used to pause “data” events?(a) s.pause();(b) s.stop();(c) s.halt();(d) s.wait(); |
|
Answer» Right choice is (a) s.pause(); Explanation: Data events are the events which are performed by either the user or the browser. The above code snippet is used to pause data events, for throttling uploads. |
|
| 6. |
What is the purpose of a Rendering Engine?(a) Parsing objects in page(b) Drawing all objects in page(c) Both Parsing & Drawing all objects in page(d) Rendering object |
|
Answer» Correct choice is (c) Both Parsing & Drawing all objects in page To elaborate: It’s responsible for displaying the web page. The rendering engine parses the HTML and the CSS and displays the parsed content on the screen. A Rendering Engine is generally used for parsing and drawing all of the objects in the page. |
|
| 7. |
Which among the following POSIX signals generate events?(a) SIGDOWN(b) SIGFLOAT(c) SIGINT(d) SIGSHORT |
|
Answer» The correct option is (c) SIGINT The explanation is: The SIGINT is a POSIX signal that generates event. Simple code like below can do a proper clean up and exit on CTRL-C or SIGINT passed from command line / other application to the nodejs app’s ProcessID. |
|
| 8. |
Why do we use Adobe Illustrator along with R?(a) Collect the relevant data(b) Format the chart and to correct the errors(c) Tighten and format the chart(d) Ingest and process the chart |
|
Answer» Right option is (c) Tighten and format the chart The explanation: Adobe Illustrator is used to produce professionally looking at statistical graphics. The Adobe Illustrator is used along with R to tighten and format the chart. |
|
| 9. |
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) Set image() |
|
Answer» The correct answer is (c) Both Use new keyword and Call Image() Easiest explanation: The Image() constructor creates and preloads a new image object. The url is specified and the image is preloaded. |
|
| 10. |
Which of the following are not the properties of a canvas object?(a) fillStyle(b) strokeStyle(c) lineWidth(d) lineSize |
|
Answer» Right choice is (d) lineSize The explanation: The fillStyle property sets or returns the color, gradient, or pattern used to fill the drawing. The strokeStyle property sets or returns the color, gradient, or pattern used for strokes. There is no property called lineSize associated with the canvas object. |
|
| 11. |
How can the nodes in the node list be accessed?(a) Key(b) Index number(c) Looping(d) Value |
|
Answer» Right choice is (b) Index number For explanation I would say: The nodes in the node list can be accessed through their index number. The nodes are sorted as they appear in the source code, and the index starts at 0. |
|
| 12. |
When do uncaught exceptions generate events?(a) When handlers are registered(b) When handlers are deregistered(c) When handler functions are called(d) When handlers do not have a matching catch clause |
|
Answer» Correct option is (a) When handlers are registered For explanation I would say: The on() method and addListener() method perform the same task of acting as an event emitter. The on() and addListener() method is used for registering handlers. |
|
| 13. |
Which two events will have the generated text for key events?(a) key and char(b) char and text(c) text and key(d) key and value |
|
Answer» Right choice is (a) key and char Best explanation: For key events that generate printable characters, key and char will be equal to the generated text. Both key and char are onkeypress event which occurs when the user presses a key (on the keyboard). |
|
| 14. |
Which type of comment is not supported in R?(a) Single-line comments(b) Multi-line comments(c) Both Single-line & Multi-line comments(d) Multiple Comments |
|
Answer» Right option is (b) Multi-line comments The best explanation: R supports single-line comments, but not multiline comments. # is used for making a single line comment. |
|
| 15. |
How can you create a node for comment in JavaScript?(a) comment()(b) createComment()(c) comm()(d) create() |
|
Answer» Right answer is (b) createComment() For explanation: The comment node can be created using the method Comment createComment(string data). The createComment() method creates a Comment node with the specified text. |
|
| 16. |
Which of the following list contains multiple data types?(a) Vectors(b) Data frames(c) Matrices(d) Arrays |
|
Answer» The correct choice is (b) Data frames The best explanation: Data frames are multidimensional lists that can contain multiple data types. |
|
| 17. |
Which of the following is an event emitter?(a) once(b) process(c) listeners(d) on |
|
Answer» Right answer is (b) process To explain: The process object is an event emitter. The Node defines other important globals under the process namespaces that contain properties of that object like version, argv, env, pid, getuid(), cwd(), chdir() and exit(). |
|
| 18. |
DOM Level 3 Events standardizes which of the following events?(a) focusarea and focusover(b) focusall and focusnone(c) focusdown and focusup(d) focusin and focusout |
|
Answer» Right answer is (d) focusin and focusout To explain I would say: The DOM Level 3 Events specification standardizes the focusin and focusout events as bubbling alternatives to the focus and blur events. The focusin and focusout events bubble, the focus and blur events doesn’t. That means that you can use the focusin and focusout on the parent element of a form field. |
|
| 19. |
The Text and Comment is part of __________(a) CharacterData(b) Document(c) Attr(d) Element |
|
Answer» Right option is (a) CharacterData The best explanation: The CharacterData abstract interface represents a Node object that contains characters. This is an abstract interface, meaning there aren’t any object of type CharacterData. The Text and Comment is part of the CharacterData Element. |
|
| 20. |
How will you convert the returned API into an XML object?(a) SimpleElement()(b) SimpleXMLElement()(c) XMLElement()(d) CovertXML() |
|
Answer» The correct option is (b) SimpleXMLElement() For explanation I would say: file_get_contents() is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by your OS to enhance performance. The API returned by the method file_get_contents() can be converted into an XML object using the method SimpleXMLElement(). |
|
| 21. |
The element that can also register handlers for load and error events is _________(a) html(b) img(c) body(d) form |
|
Answer» Right option is (b) img To explain I would say: Individual document elements, such as img elements, can also register handlers for load and error events.onload and onerror methods are used for handling such events. |
|
| 22. |
The libraries that build a new higher-level API for client-side programming is ____________(a) Library(b) Framework(c) APIs(d) Script |
|
Answer» Correct option is (b) Framework Best explanation: Many web developers find it useful to build their web applications on top of a client side 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. |
|
| 23. |
What is the function used to remove all handlers for name events?(a) deleteAllListeners(name)(b) deleteListener(name,f)(c) removeListener(name,f)(d) removeAllListeners(name) |
|
Answer» The correct answer is (d) removeAllListeners(name) To explain I would say: The removeAllListeners(name) is used to remove all handlers from name events represented as : emitter.removeAllListeners(name) |
|
| 24. |
What is the purpose of getting the parameter fvonly?(a) To repeat the view test(b) To get the first view(c) To debug the code(d) To compile the code |
|
Answer» Right option is (b) To get the first view Explanation: fvonly is an optional parameter which is set to 1 to skip the Repeat View test. If you set fvonly to 1, you get results only for the first view and do not run the repeat view test. |
|
| 25. |
What is the purpose of the parameter $value?(a) Field’s expected value(b) Field’s previous value(c) Field’s current value(d) Field’s probability value |
|
Answer» Right option is (c) Field’s current value Easy explanation: getinputhtml() accepts two arguments: $name and $value. The parameter $value is the field’s current value (either from the DB, or the POST data if there was a validation error). |
|
| 26. |
What is not the purpose of the parameter location?(a) Specifies agent location(b) Specifies speed(c) Specifies browser(d) Specifies block |
|
Answer» The correct choice is (d) Specifies block Best explanation: The window.location object can be used to get the current page address (URL) and to redirect the browser to a new page. The parameter location specifies the agent location, speed and browser to use for the test, formatted as location.browser:location. |
|
| 27. |
What is the purpose of the method nodeMap.setNamedItem()?(a) Sets ID(b) Sets attribute node(c) Sets element name(d) Sets element type |
|
Answer» Correct choice is (b) Sets attribute node Explanation: The setNamedItem() method adds the specified node to the NamedNodeMap. The method nodeMap.setNamedItem() sets the specified attribute node (by name). |
|
| 28. |
The central object in a larger API is known as __________(a) Document Object Material(b) Document Object Model(c) Binary Object Model(d) Data object model |
|
Answer» The correct answer is (b) Document Object Model Easy explanation: Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document. It is the central object in a larger API, known as the Document Object Model, or DOM, for representing and manipulating document content. |
|
| 29. |
The high-level events among the following events are ____________(a) User interface events(b) Device-independent events(c) Device-dependent events(d) Stage event change |
|
Answer» Correct option is (a) User interface events Best explanation: UI events are higher-level events, often on HTML form elements that define a user interface for a web application. They include the focus event (when a text input field gains keyboard focus), the change event when the user changes the value displayed by a form element, and the submit event when the user clicks a Submit button in a form. |
|
| 30. |
The node directly above a node is called __________(a) sibling(b) child(c) parent(d) ancestors |
|
Answer» The correct option is (c) parent The best explanation: The node directly above a node is the parent of that node. In HTML, the document itself is the parent node of the HTML element, HEAD and BODY are child nodes of the HTML element. |
|
| 31. |
What is the purpose of the function parameter filetype?(a) File type to be expected(b) File type previously got(c) File type that should not be got(d) File type available |
|
Answer» Correct option is (a) File type to be expected Explanation: The File.type property is an inbuilt function of File WebAPI which gives the media type (MIME) of the file represented by a file object. The function parameter “filetype” lets you tell the script what file type to expect before loading. |
|
| 32. |
Which object is passed as the argument to handlers for keydown, keyup, and keypress events?(a) KeyboardEvent(b) Key Event(c) Mouse Event(d) Alphabet Event |
|
Answer» Right answer is (a) KeyboardEvent Explanation: What is new in the DOM Level 3 Events specification is standardized support for two dimensional mouse wheels via the wheel event and better support for text input events with a new KeyboardEvent object that is passed as the argument to handlers for keydown, keyup, and keypress events. |
|
| 33. |
The events that are not triggered directly by user activity are called ___________(a) Device-independent input events(b) Device-dependent input events(c) User interface events(d) State change events |
|
Answer» Correct choice is (d) State change events Explanation: Some events are not triggered directly by user activity, but by network or browser activity, and indicate some kind of lifecycle or state-related change. The load event, fired on the Window object when the document is fully loaded, is probably the most commonly used of these events. |
|
| 34. |
What will happen when the data of the jQuery.cache is read from an element?(a) Unique number is retrieved as elem[jQuery.expando](b) Data is read from jQuery.cache[id](c) Unique number is retrieved as elem[jQuery.expando] & Data is read from jQuery.cache[id](d) Data is cleared from jQuery.cache[id] |
|
Answer» The correct choice is (c) Unique number is retrieved as elem[jQuery.expando] & Data is read from jQuery.cache[id] The explanation is: jQuery.cache[id] is used to associate handlers and other data with elements. When the data is read from an element: The element unique number is retrieved from id = elem[ jQuery.expando]. The data is read from jQuery.cache[id]. |
|
| 35. |
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» The correct choice is (a) Chrome JQuery To explain: 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. |
|
| 36. |
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) Calculating the number of lines |
|
Answer» Right choice is (c) Timing the code & Calculating the number of operations performed The explanation is: There are a couple of ways to benchmark code—either by timing it or by calculating the number of operations performed during execution. Both of them help in calculating how efficient and modular the code. |
|
| 37. |
Which object can be used to create your own blobs?(a) Creator(b) BlobCreator(c) BlobBuilder(d) BuilderBlob |
|
Answer» Right option is (c) BlobBuilder Explanation: Blobs represent data that isn’t necessarily in a JavaScript-native format. You can create your own blobs, using a BlobBuilder object to build them out of strings, ArrayBuffer objects, and other Blobs. |
|
| 38. |
The events that are directly tied to a specific input device are ____________(a) Device-independent input events(b) Device-dependent input events(c) User interface events(d) State change events |
|
Answer» Right answer is (b) Device-dependent input events Easy explanation: These are events that are directly tied to a specific input device, such as the mouse or keyboard) They include legacy event types such as “mousedown”, “mousemove”, “mouseup”, “keydown”, “keypress”, and “keyup” and also new touch specific events like “touchmove” and “gesturechange”. |
|
| 39. |
What is the purpose of the method symbols in R?(a) Draw symbols(b) Draw other shapes(c) Draw symbols and other shapes(d) Plotting symbols |
|
Answer» The correct option is (b) Draw other shapes The best explanation: The symbols() function can be used to draw other shapes on a plot; for more information about this type ?symbols at the R console. One of six symbols; circles, squares, rectangles, stars, thermometers, and boxplots, can be plotted at a specified set of x and y coordinates. |
|
| 40. |
What is the purpose of the Legacy DOM?(a) Makes the scripting easier(b) Allows access to few keys and elements(c) Modify the nodes(d) Making the script modular |
|
Answer» Correct answer is (b) Allows access to few keys and elements Best explanation: The Legacy DOM: This is the model which was introduced in early versions of JavaScript language. It is well supported by all browsers but allows access only to certain key portions of documents, such as forms, form elements, and images. |
|
| 41. |
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» Correct option is (d) Firefox JSDOM_benc The 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. |
|
| 42. |
What does the NamedNodeMap object represent in the HTML DOM?(a) Unordered collection of elements(b) Unordered collection of attributes(c) Unordered collection of nodes(d) Unordered collection of arrays |
|
Answer» Correct answer is (d) Unordered collection of arrays For explanation: In the HTML DOM, the NamedNodeMap object represents an unordered collection of an elements attribute nodes. The nodes in the NamedNodeMap can be accessed through their name. |
|
| 43. |
What is the purpose of the file_get_contents()?(a) To get the errors and exceptions(b) To get the client’s response(c) To get the server’s response(d) To get the data |
|
Answer» The correct answer is (c) To get the server’s response For explanation I would say: The file_get_contents() is a PHP’s native function used to hit the URL and read the server’s response into a variable $wpt_response: |
|
| 44. |
What is necessary when we need to create a new field in craft?(a) Type of the input(b) Type of the output(c) Type of the field(d) Type of argument |
|
Answer» Right answer is (c) Type of the field The explanation: Whenever someone creates a new field in Craft, they must specify what type of field it is. They are organized into Field Groups for convenience, but Field Groups have very little relevance anywhere else in the system. |
|
| 45. |
Which is the method used to process on the input post data before it is saved to the database?(a) prep()(b) settings()(c) defineSettings()(d) prepSettings() |
|
Answer» Right answer is (d) prepSettings() Easiest explanation: defineSettings() method returns an array whose keys define the setting names, and values define the parameters (the type of value, etc). If you need to do any processing on your settings’ post data before they’re saved to the database’s content table, you can do it with the prepSettings() method. |
|
| 46. |
Which of the following is a successor to the S language?(a) C++(b) R(c) S(d) Java |
|
Answer» The correct option is (b) R Best explanation: R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing. R is an extension of and successor to the S language, which was itself a statistical language. |
|
| 47. |
The Cookie manipulation is done using which property?(a) cookie(b) cookies(c) manipulate(d) modify |
|
Answer» Correct option is (a) cookie For explanation I would say: The cookie property sets or returns all name/value pairs of cookies in the current document. There are no methods involved: cookies are queried, set, and deleted by reading and writing the cookie property of the Document object using specially formatted strings. |
|
| 48. |
Which node type represents the root-node of the DOM tree?(a) Document(b) DocumentFragment(c) DocumentType(d) Entity |
|
Answer» The correct choice is (a) Document For explanation I would say: Everything inside an html document is classified in the form of different nodes. The node type Document represents the root-node of the DOM tree, the entire document. |
|
| 49. |
How many arguments does the getInputHtml() accept?(a) 1(b) 2(c) 3(d) 4 |
|
Answer» Right choice is (b) 2 For explanation: The method getInputHtml() returns a fieldtype’s input HTML. The method getInputHtml(0 accepts two arguments: $name and $value. $name is the name you should assign your HTML input name= attribute, and $value is the field’s current value (either from the DB, or the POST data if there was a validation error). |
|
| 50. |
Which of the following is the assignment operator?(a) (c) =(d) == |
|
Answer» Correct choice is (a) <- For explanation: The operators <- and = can be used, almost interchangeably, to assign to a variable in the same environment. The assignment operator is a left-pointing arrow, so creating and declaring variables looks like this: foo |
|