Explore topic-wise InterviewSolutions in .

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 does the rel attribute of a variable have when the type of file is CSS?(a) css(b) stylesheet(c) text/css(d) plainsheetThe question was asked during an online exam.I need to ask this question from Lazy Loading in portion Invocation and Performance Navigation of JavaScript

Answer»

Correct option is (b) stylesheet

The explanation: A web style sheet is a form of separation of presentation and content for web DESIGN in which the markup (i.e., HTML or XHTML) of a webpage CONTAINS the page’s semantic content and STRUCTURE, but does not define its VISUAL layout (style). The rel attribute must hold the value rel = ‘stylesheet’.

2.

Which of the below does not belong to the Render Engine workflow?(a) Paint DOM elements(b) Parse Content(c) Build DOM nodes in render tree(d) Parse identifiersThis question was addressed to me in an interview.I need to ask this question from Page Render BottleNecks Optimization in section Invocation and Performance Navigation of JavaScript

Answer»

Correct option is (d) Parse identifiers

To elaborate: A rendering ENGINE is SOFTWARE that DRAWS text and images on the screen. All of the mentioned belongs to the Render Engine workflow. The Render engine workflow contains:

Parse Content

Build DOM nodes in render tree

Layout positioning of DOM ELEMENTS

Paint DOM elements.

3.

Which of the following layer retrieves the content from the network?(a) Transport Layer(b) Application Layer(c) Network Layer(d) Physical LayerThe question was posed to me by my school principal while I was bunking the class.My question is taken from Page Render BottleNecks Optimization topic in section Invocation and Performance Navigation of JavaScript

Answer»

Right OPTION is (c) Network Layer

Explanation: The network layer is the third level of the Open Systems INTERCONNECTION Model (OSI Model) and the layer that provides DATA routing paths for network communication. The network layer RETRIEVES the content from the network.

4.

What is the purpose of the property PerformanceTiming.navigationStart?(a) Ready to end the navigation(b) Ready to jump the navigation(c) Ready for navigation(d) Ready to changing the navigationThe question was posed to me during an online exam.Question is from Integrating the Performance Object with perfLogger topic in chapter Invocation and Performance Navigation of JavaScript

Answer»

Right ANSWER is (c) Ready for navigation

To explain I would say: The PerformanceTiming.navigationStart read-only PROPERTY returns an UNSIGNED long long representing the moment, in milliseconds since the UNIX epoch, right after the prompt for unload terminates on the previous document in the same BROWSING context. If there is no previous document, this value will be the same as:PerformanceTiming.fetchStart.

5.

What should be the value of the type attribute of a variable if the type of file is CSS?(a) text/js/css(b) text/js(c) text/css(d) textI have been asked this question in homework.This key question is from Lazy Loading in portion Invocation and Performance Navigation of JavaScript

Answer»

The correct answer is (C) text/css

To EXPLAIN: Since the type of FILE is CSS, the type attribute should hold the value text/css. For javascript file type attribute WOULD hold the VALE text/js.

6.

What is the purpose of garbage collection?(a) Removes object with many reference(b) Removes object with reference(c) Removes object with invalid reference(d) Removes object with no referenceThe question was posed to me by my school principal while I was bunking the class.The doubt is from Performance Navigation and Memory in section Invocation and Performance Navigation of JavaScript

Answer» RIGHT answer is (d) Removes object with no reference

Explanation: When the interpreter sees an object in the HEAP with no object references, it removes that object from the heap. This is called garbage collection. An object is considered garbage collectible if there are ZERO references pointing at this object.
7.

How many properties does a prototype object have?(a) 6(b) 7(c) 8(d) 9This question was posed to me in examination.My enquiry is from Integrating the Performance Object with perfLogger topic in portion Invocation and Performance Navigation of JavaScript

Answer» RIGHT option is (b) 7

For explanation I would say: The prototype is an object that is associated with every functions and objects by DEFAULT in JAVASCRIPT, where function’s prototype property is accessible and modifiable and object’s prototype property (aka attribute) is not VISIBLE. There are a total of 7 properties in the prototype object namely:

perceivedTime

redirectTime

cacheTime

dnsLookupTime

tcpConnectionTime

roundTripTime

pageRenderTime.
8.

What is the purpose of the timing property in the window.performance object?(a) Time of navigation event(b) Time of page load event(c) Time of navigation and page load event(d) Time of scrollingI got this question during an internship interview.This is a very interesting question from Invocation of the Performance Object topic in division Invocation and Performance Navigation of JavaScript

Answer»

Correct option is (c) Time of navigation and page load event

For explanation I would say: Each PERFORMANCE.timing attribute shows the time of a navigation event (such as when the page was REQUESTED) or page load event (such as when the DOM began loading), measured in MILLISECONDS. The legacy Performance.timing read-only property returns a PerformanceTiming object CONTAINING latency-related performance INFORMATION.

9.

What is the purpose of the domLoading attribute?(a) Document exists(b) Document can load(c) Document has loaded(d) Document begins to loadI got this question in class test.My question comes from Lazy Loading topic in chapter Invocation and Performance Navigation of JavaScript

Answer»

Correct OPTION is (d) Document begins to LOAD

Easiest explanation: domLoading is the TIME immediately before the USER agent SETS the current document readiness to ‘loading’. The domLoading attribute is used when the document begins to load.

10.

Which of the following are client-side JavaScript object?(a) Database(b) Cursor(c) Client(d) FileUpLoadI have been asked this question by my school principal while I was bunking the class.My doubt is from Script Loading topic in chapter Invocation and Performance Navigation of JavaScript

Answer»

The CORRECT CHOICE is (d) FileUpLoad

Best EXPLANATION: The Input FileUpload object represents an HTML ELEMENT with type=”file”. The FileUpLoad is a client-side JAVASCRIPT object.

11.

How many constant values can the property type be represented?(a) 2(b) 3(c) 4(d) 5I have been asked this question during an interview for a job.My doubt is from Performance Navigation and Memory topic in section Invocation and Performance Navigation of JavaScript

Answer»

Correct option is (C) 4

Explanation: The type property SETS or returns the value of the type attribute of an ELEMENT. The type attribute specifies the Internet media type (formerly known as MIME type) of the object. Totally 4 constant VALUES can be represented by the property type.

12.

Which of the following gives the high level breakdown of memory usage?(a) about:memory(b) memory(c) about-memory(d) about::memoryThe question was posed to me in an online interview.My question comes from Performance Navigation and Memory topic in chapter Invocation and Performance Navigation of JavaScript

Answer» RIGHT option is (a) about:memory

Explanation: The Memory column represents native memory. DOM NODES are stored in native memory. If this value is increasing, DOM nodes are getting CREATED. Typing about:memory into the location bar brings up a PAGE that gives a high-level breakdown of memory usage.
13.

Which of the following does JSON.stringify not serialize?(a) Undefined values(b) Functions within an object(c) Both Undefined values and Functions within an object(d) Functions outside the objectThis question was addressed to me at a job interview.This interesting question is from Integrating the Performance Object with perfLogger in portion Invocation and Performance Navigation of JavaScript

Answer»

The CORRECT ANSWER is (c) Both Undefined values and Functions WITHIN an object

To elaborate: JSON.stringify does not serialize undefined values or functions within an object. JSON.stringify() converts a JavaScript object into a string.

14.

Which of the following property gives access to the JavaScript memory usage data?(a) performance.memory(b) memory(performance)(c) performance(memory)(d) performance()I have been asked this question in a national level competition.The doubt is from Invocation of the Performance Object in chapter Invocation and Performance Navigation of JavaScript

Answer»

Correct option is (a) performance.MEMORY

To ELABORATE: The property performance.memory gives access to the JavaScript memory USAGE DATA. It returns an object of TYPE ObjectObject.

15.

How many properties are there in the interface PerformanceTiming?(a) 21(b) 22(c) 23(d) 24The question was posed to me during an online interview.Origin of the question is Integrating the Performance Object with perfLogger in chapter Invocation and Performance Navigation of JavaScript

Answer»

Correct option is (a) 21

For explanation I WOULD SAY: PERFORMANCE.timing read-only property returns a PerformanceTiming object CONTAINING latency-related performance information. There are a total of 23 properties associated with the interface PerformanceTiming.

16.

What is the purpose of creating a data frame?(a) Hold the page render time(b) Hold the load time(c) Hold the page render time & load time(d) Hold the reload timeI have been asked this question in final exam.My doubt is from Script Loading topic in portion Invocation and Performance Navigation of JavaScript

Answer» RIGHT choice is (c) Hold the PAGE render time & load time

For explanation: A Data FRAME is a two-dimensional data STRUCTURE, i.e., data is aligned in a tabular fashion in rows and columns. You can create a data frame to hold the mean page render times for each test URL, and a data frame to hold the mean load time for each test URL.
17.

What is the purpose of the navigation property in the window.performance object?(a) To which page the user navigated(b) How the user navigated(c) Information about the page(d) Information of the curserThis question was posed to me in an international level competition.This key question is from Integrating the Performance Object with perfLogger topic in section Invocation and Performance Navigation of JavaScript

Answer»

The CORRECT ANSWER is (b) How the user navigated

To explain I WOULD SAY: The NAVIGATION tells how the user navigated to the page.

18.

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 mentionedI got this question during an internship interview.The above asked question is from Script Loading in portion Invocation and Performance Navigation of JavaScript

Answer» RIGHT option is (d) All of the mentioned

To explain: The startTimeLogging() method CAPTURES the TIMING DATA for ad hoc, etc for referencing an uncached document.location. Once the startTimeLogging() method is called, run the code to TEST.
19.

What is the solution to the absence of a script tag without an src attribute?(a) Resend the scripts(b) Create inline JavaScript(c) Attach a javascript file(d) Include a fileI got this question in an interview.This intriguing question originated from Script Loading topic in portion Invocation and Performance Navigation of JavaScript

Answer»

Correct answer is (b) Create inline JAVASCRIPT

For EXPLANATION I WOULD say: 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:

20.

Which of the following runs the JavaScript code?(a) Just In Time compiler(b) JavaScript Interpreter(c) Both Just In Time compiler and JavaScript Interpreter(d) Javascript compilerThe question was posed to me in an interview for internship.My enquiry is from Page Render BottleNecks Optimization topic in chapter Invocation and Performance Navigation of JavaScript

Answer»

Right option is (B) JavaScript Interpreter

To explain I would say: A JavaScript engine is a computer program that executes JavaScript (JS) CODE. The first JS engines were mere interpreters, but all relevant MODERN engines utilize just-in-time compilation for IMPROVED performance. The JavaScript Interpreter runs the JavaScript code.

21.

Which of the following property indicate the total size of the heap?(a) heapSize(b) totalHeapSize(c) totalJsHeapSize(d) totalHeapThe question was asked in an interview.The query is from Performance Navigation and Memory topic in chapter Invocation and Performance Navigation of JavaScript

Answer»

The correct answer is (C) totalJsHeapSize

To explain I would SAY: usedJsHeapSize stores an object CREATED with MemoryInfo constructor, CONTAINING jsHeapSizeLimit, totalJSHeapSize and usedJSHeapSize properties with numerical VALUES.

22.

What does the usedJsHeapSize property indicate?(a) Amount of memory used(b) Amount of memory unused(c) Amount of memory used & unused(d) Amount of memory requiredThe question was posed to me by my college director while I was bunking the class.The question is from Performance Navigation and Memory in section Invocation and Performance Navigation of JavaScript

Answer»

Correct answer is (a) Amount of memory used

To EXPLAIN I WOULD SAY: usedJsHeapSize returns an object of type ObjectObject. An object created with MemoryInfo CONSTRUCTOR, containing jsHeapSizeLimit, totalJSHeapSize and usedJSHeapSize properties with numerical values. The usedJsHeapSize property is the amount of memory that all of the CURRENT objects in the heap are using.

23.

What does the constant TYPE_BACK_FORWRD indicate?(a) Navigation via browser history(b) Navigation via user request(c) Navigation via URL(d) Navigation via load operationI had been asked this question in my homework.The origin of the question is Performance Navigation and Memory in division Invocation and Performance Navigation of JavaScript

Answer»

Right OPTION is (a) Navigation via BROWSER HISTORY

For explanation I WOULD say: TYPE_BACK_FORWARD performs navigation through a history traversal operation. TYPE_BACK_FORWARD Has the value of 2, INDICATING that the page was navigated to via the browser history, either using the back or forward buttons or programmatically through the browser’s history object.

24.

Which of the following constants has the value 255?(a) TYPE_NAVIGATE(b) TYPE_RELOAD(c) TYPE_BACK_FORWARD(d) TYPE_RESERVEDI had been asked this question in semester exam.I'd like to ask this question from Performance Navigation and Memory topic in section Invocation and Performance Navigation of JavaScript

Answer»

The correct answer is (d) TYPE_RESERVED

The explanation: TYPE_BACK_FORWARD performs NAVIGATION through a history traversal operation. TYPE_RESERVED Has the VALUE of 255 and is a catch-all for any navigation TYPE not defined above.

25.

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);The question was asked during a job interview.Origin of the question is Script Loading topic in division Invocation and Performance Navigation of JavaScript

Answer»

Right choice is (b) s.on(“end”,f);

The explanation is: In COMPUTING, end-of-file (commonly ABBREVIATED EOF) is a condition in a computer operating system where no more DATA can be read from a data source. The above code snippet GETS “end” EVENT fired on EOF when no more data will arrive.

26.

Which of the following navigator object properties is the same in bothNetscape and IE?(a) navigator.appCodeName(b) navigator.appName(c) navigator.appVersion(d) appcode.navigator()The question was posed to me in semester exam.My query is from Script Loading in section Invocation and Performance Navigation of JavaScript

Answer» RIGHT CHOICE is (a) navigator.appCodeName

The explanation is: The property navigator.appCodeName is the same in both NETSCAPE and IE. The appCodeName property returns the CODE name of the browser.
27.

Which of the following handles painting the content on to the screen?(a) Rendering engine(b) JavaScript Interpreter(c) UI Layer(d) Network LayerI had been asked this question during an interview.Asked question is from Page Render BottleNecks Optimization topic in section Invocation and Performance Navigation of JavaScript

Answer» RIGHT answer is (a) Rendering ENGINE

To elaborate: A rendering engine is a software that draws text and images on the SCREEN. The rendering engine HANDLES painting the content to the screen. When it encounters JavaScript, it hands it off to the JavaScript interpreter.
28.

What is the function of the memory object?(a) Gets unused memory details(b) Shows optimization(c) Gets memory usage(d) Memory optimizationThis question was addressed to me during an internship interview.This intriguing question comes from Performance Navigation and Memory in division Invocation and Performance Navigation of JavaScript

Answer»

The correct option is (c) Gets MEMORY USAGE

To elaborate: The JavaScript Memory column represents the JS heap. This column contains two values. The value you’re interested in is the LIVE number (the number in parentheses). The memory object is a FEATURE of Chrome that allows US to see the memory usage that Chrome is taking up while running our page.

29.

What can be done to monitor the memory usage?(a) Profiling(b) Sequencing(c) Serializing(d) Serializing & SequencingI had been asked this question in unit test.I would like to ask this question from Performance Navigation and Memory topic in division Invocation and Performance Navigation of JavaScript

Answer»

Correct answer is (a) PROFILING

The best EXPLANATION: Garbage collected languages help developers MANAGE MEMORY by periodically checking which previously allocated pieces of memory can still be “reached” from other parts of the application. Profiling ALLOWS us to monitor our memory usage.

30.

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 objectI had been asked this question by my school principal while I was bunking the class.My question is from Lazy Loading topic in portion Invocation and Performance Navigation of JavaScript

Answer»

Right choice is (d) PROTOTYPE object

Easiest explanation: A prototype is an object that is associated with EVERY functions and object by default in JavaScript, where function’s prototype property is accessible and modifiable and object’s prototype property (aka attribute) is not visible. The properties of the prototype object are inherited by all instances of the class, and properties WHOSE values are functions BEHAVE LIKE instance methods of the class.

31.

What is the parameter of the method getElementsbyTagName() if we need to get an image?(a) image(b) src(c) img(d) imageurlI had been asked this question in my homework.My question is taken from Lazy Loading topic in chapter Invocation and Performance Navigation of JavaScript

Answer» RIGHT choice is (c) img

Explanation: To get the SOURCE attribute the parameter is src. The method must look LIKE getElementsbyTageName(“img”) if we need to get an IMAGE.
32.

Which best explains getSelection()?(a) Returns the VALUE of a selected OPTION(b) Returns document.URL of the window in focus(c) Returns the value of cursor-selected text(d) Returns the VALUE of a checked radio inputI had been asked this question during an online interview.Enquiry is from Script Loading in chapter Invocation and Performance Navigation of JavaScript

Answer»

Right CHOICE is (c) Returns the VALUE of cursor-selected text

The best I can explain: The Window.GETSELECTION() method returns a Selection object representing the range of text selected by the USER or the current POSITION of the caret. The getSelection() method returns the value of the cursor-selected text.

33.

What is the default value of the asyc attribute?(a) 0(b) 1(c) False(d) TrueI got this question in an interview for internship.My doubt stems from Script Loading topic in portion Invocation and Performance Navigation of JavaScript

Answer»

Correct answer is (d) True

The EXPLANATION: The ASYNC attribute is a boolean attribute. When present, it specifies that the script will be executed asynchronously as soon as it is AVAILABLE. The async attribute optionally ACCEPTS a boolean value and by default HOLDS the value true.

34.

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) Invoke code during reloadingI got this question in a job interview.Asked question is from Script Loading in section Invocation and Performance Navigation of JavaScript

Answer»

The correct answer is (c) INVOKE code during downloading

Easy explanation: 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:

35.

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 synchronouslyI had been asked this question in homework.This key question is from Script Loading in chapter Invocation and Performance Navigation of JavaScript

Answer» RIGHT choice is (a) Load the script asynchronously

To ELABORATE: The ASYNC option is a NATIVE attribute that will tell the browser to load the script asynchronously. The async attribute is a BOOLEAN attribute. When present, it specifies that the script will be executed asynchronously as soon as it is available.
36.

What will happen after executing the script?(a) Execute script(b) Layout positioning of DOM elements(c) Paint DOM elements(d) Build DOM nodes in render treeI got this question in an interview for job.Enquiry is from Page Render BottleNecks Optimization in chapter Invocation and Performance Navigation of JavaScript

Answer»

The correct CHOICE is (d) Build DOM nodes in RENDER tree

Explanation: After EXECUTING the script, the DOM nodes will be BUILT in the render tree. The Render engine workflow contains:

PARSE Content

Build DOM nodes in render tree

Layout positioning of DOM elements

Paint DOM elements.

37.

What is the command to access the Heap size limit?(a) performance.memory. SizeLimit(b) performance.memory. jsHeapSizeLimit(c) jsHeapSizeLimit(d) performance.jsHeapSizeLimitThis question was posed to me in an internship interview.This key question is from Performance Navigation and Memory topic in section Invocation and Performance Navigation of JavaScript

Answer»

The correct ANSWER is (b) performance.memory. jsHeapSizeLimit

Explanation: Memory CONTAINS an object created with MemoryInfo constructor, CONTAINING jsHeapSizeLimit, totalJSHeapSize and usedJSHeapSize properties with numerical values. The command performance.memory. jsHeapSizeLimit is used to access the HEAP SIZE limit.

38.

What is the purpose of the constant TYPE_RELOAD?(a) Reload performed(b) Reload not performed(c) Reload must be performed(d) Reload may be performedThis question was addressed to me in an interview for internship.This intriguing question originated from Performance Navigation and Memory in portion Invocation and Performance Navigation of JavaScript

Answer» CORRECT choice is (a) Reload performed

The EXPLANATION is: TYPE_RELOAD: Has the VALUE of 1, indicating that the current page was ARRIVED at VIA a reload operation. TYPE_RELOAD performs navigation through the reload operation or the location.reload() method.
39.

How many properties are associated with the Response event?(a) 1(b) 2(c) 3(d) 4The question was asked in a national level competition.The query is from Invocation of the Performance Object in section Invocation and Performance Navigation of JavaScript

Answer»

The correct option is (b) 2

Easy explanation: There are a total of 2 properties ASSOCIATED with the Response event namely:

PerformanceTiming.responseEnd

PerformanceTiming.responseStart.

PerformanceTiming.responseStart read-only PROPERTY returns an unsigned LONG long representing the moment in time (in milliseconds since the UNIX epoch) when the browser received the first byte of the response from the server, cache, or local resource.

40.

Where does the DNS reply go to in a single HTTP redirect?(a) Browser(b) Client(c) Server(d) DNS ServerThis question was posed to me in semester exam.This question is from Performance Navigation and Memory topic in division Invocation and Performance Navigation of JavaScript

Answer»

Right answer is (a) BROWSER

The EXPLANATION is: DNS is a query/response protocol. The client queries information (for example the IP address corresponding to www.google.com) in a single UDP REQUEST. The DNS reply GOES to the Browser in a single HTTP redirect.

41.

Which of the following is a read-only property?(a) PerformanceTiming.navigationStart(b) PerformanceTiming.fetchStart(c) PerformanceTiming.navigationStart & PerformanceTiming.fetchStart(d) PerformanceTiming.responseStartThe question was asked in an internship interview.My question comes from Invocation of the Performance Object in division Invocation and Performance Navigation of JavaScript

Answer»

The correct answer is (c) PerformanceTiming.navigationStart & PerformanceTiming.fetchStart

For explanation I WOULD say: PerformanceTiming.navigationStart read-only PROPERTY returns an unsigned long long REPRESENTING the moment, in miliseconds since the UNIX epoch, right after the prompt for unload terminates on the previous document in the same browsing context. If there is no previous document, this value will be the same as PerformanceTiming.fetchStart. Both PerformanceTiming.navigationStart and also the PerformanceTiming.fetchStart are a read-only PROPERTIES.

42.

What does the rendering engine do when it encounters JavaScript?(a) Skips the code(b) Continues painting(c) Switches to Javascript Interpreter(d) Restructures the codeThis question was addressed to me at a job interview.My question comes from Page Render BottleNecks Optimization topic in section Invocation and Performance Navigation of JavaScript

Answer»

The CORRECT answer is (c) Switches to Javascript Interpreter

To explain I would say: A rendering engine is a software that draws text and images on the SCREEN. The rendering engine HANDLES PAINTING the content to the screen. When it encounters JavaScript, it hands it off to the JavaScript interpreter.

43.

What does the appendChild() method perform?(a) Appends a node in the middle of the index taken as the parameter(b) Appends a node as the first child(c) Appends a node as the last child(d) Replaces and appends at the last nodeThe question was posed to me in an interview.The origin of the question is Lazy Loading in chapter Invocation and Performance Navigation of JavaScript

Answer»

The correct answer is (c) Appends a node as the LAST CHILD

The best explanation: The appendChild() method appends a node as the last child of a node. You can also use this method to move an element from ONE element to another.

44.

Where is the external JavaScript placed in the case of lazy loading?(a) After window.onload event(b) Before window.onload event(c) In the header tag(d) In the HTML tagI have been asked this question in unit test.Enquiry is from Lazy Loading in portion Invocation and Performance Navigation of JavaScript

Answer»

Right choice is (a) After window.onload EVENT

The EXPLANATION: LAZY LOADING is a kind of loading in which we don’t need our JavaScript code to be available as soon as the page LOADS. When we don’t need our JavaScript code to be available as soon as the page loads, we can script-load our external JavaScript after the window.onload event.

45.

What is the purpose of the method localeCompare()?(a) If the reference string comes before or after another string(b) If the reference string is validated(c) If the string is a reference string(d) If the reference string comes firstThe question was asked in an online quiz.The doubt is from Script Loading topic in chapter Invocation and Performance Navigation of JavaScript

Answer»

Correct option is (a) If the reference string comes before or after another string

Explanation: The localeCompare() method compares two strings in the current LOCALE. The locale is based on the language settings of the BROWSER. The method localeCompare() returns a number INDICATING whether a reference string comes before or after or is the same as the GIVEN string in sort ORDER.

46.

What is the purpose of script loading?(a) Load Scripts programmatically(b) Load JavaScript files manually(c) Load JavaScript files programmatically(d) Load Scripts programmatically & manuallyThe question was asked during an interview.This interesting question is from Script Loading topic in section Invocation and Performance Navigation of JavaScript

Answer»

The correct choice is (c) Load JAVASCRIPT files PROGRAMMATICALLY

Easy explanation: The script loading loads remote JavaScript files programmatically and allow us to trick the rendering engine. The async attribute is a BOOLEAN attribute. When PRESENT, it SPECIFIES that the script will be executed asynchronously as soon as it is available.

47.

What is a heap in JavaScript?(a) Collection of Java objects(b) Collection of JavaScript objects(c) Collection of memory usage values(d) Collection of data stored in memoryThis question was posed to me in an interview for job.The query is from Performance Navigation and Memory topic in division Invocation and Performance Navigation of JavaScript

Answer» RIGHT CHOICE is (b) Collection of JAVASCRIPT objects

To EXPLAIN: A heap is a tree-like data structure where each node must be ORDERED with respect to the value of its children. The heap is the collection of JavaScript objects that the interpreter keeps in resident memory.
48.

How many properties are available in a memory object?(a) 1(b) 2(c) 3(d) 4The question was posed to me in an online quiz.The question is from Performance Navigation and Memory topic in portion Invocation and Performance Navigation of JavaScript

Answer»

Right answer is (C) 3

Best explanation: Advanced JavaScript APPLICATION features such as caches and UNDO buffers need to know the memory consumption of objects in ORDER to function effectively. There are a total of 3 memory objects namely:

jsHeapSizeLimit

totalJsHeapSize

usedJsHeapSize.

49.

How can one access the redirectCount property?(a) navigation.redirectCount(b) performance.navigation.redirectCount(c) performance.redirectCount(d) redirectCountI got this question in semester exam.Query is from Performance Navigation and Memory topic in section Invocation and Performance Navigation of JavaScript

Answer»

Correct OPTION is (b) performance.navigation.redirectCount

The EXPLANATION is: The redirectCount property can be accessed as performance.navigation.redirectCount. The PerformanceNavigation.redirectCount read-only property returns an unsigned SHORT representing the number of REDIRECTs DONE before reaching the page.

50.

What is the purpose of the property PerformanceTiming.fetchStart?(a) Browser ready to fetch input(b) Browser ready to fetch document(c) Browser ready to fetch summary(d) Browser ready to fetch outputI got this question during a job interview.Enquiry is from Integrating the Performance Object with perfLogger in chapter Invocation and Performance Navigation of JavaScript

Answer»

The correct choice is (b) Browser ready to fetch DOCUMENT

To explain I WOULD say: The PerformanceTiming.fetchStart read-only property RETURNS an unsigned long long representing the moment, in MILLISECONDS since the UNIX epoch, the browser is ready to fetch the document using an HTTP REQUEST. If there is no previous document, this value will be the same as PerformanceTiming.fetchStart.