This set of Javascript Multiple Choice Questions & Answers (MCQs) focuses on “Page Render BottleNecks Optimization”.
1. 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
View Answer
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.
2. Which of the following handles painting the content on to the screen?
a) Rendering engine
b) JavaScript Interpreter
c) UI Layer
d) Network Layer
View Answer
Explanation: 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.
3. 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 code
View Answer
Explanation: 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.
4. 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 compiler
View Answer
Explanation: 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.
5. Which of the following layer retrieves the content from the network?
a) Transport Layer
b) Application Layer
c) Network Layer
d) Physical Layer
View Answer
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.
6. Which of the following gets converted to DOM elements by the rendering engine?
a) Tokens
b) Strings
c) Address
d) Characters
View Answer
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.
7. 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 identifiers
View Answer
Explanation: 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.
8. Which is the next step after retrieving the content in chunks?
a) Paint DOM elements
b) Parse Content
c) Build DOM nodes in render tree
d) Layout positioning of DOM elements
View Answer
Explanation: After retrieving the content in chunks, the contents will be parsed. The Render engine workflow contains:
- Parse Content
- Build DOM nodes in render tree
- Layout positioning of DOM elements
- Paint DOM elements.
9. 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 tree
View Answer
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.
10. What would happen if there were no script tags?
a) Build DOM nodes in render tree
b) Layout positioning of DOM elements
c) Paint DOM elements
d) Execute script
View Answer
Explanation: If there were no script tags, the DOM nodes will be built in the render tree. After executing the script, the DOM nodes will be built in the render tree.
Sanfoundry Global Education & Learning Series – Javascript Programming.
- Practice MCA MCQs
- Check Programming Books
- Check JavaScript Books
- Practice Programming MCQs
- Apply for Computer Science Internship