Answer & Solution
<script>
tag is used to specify the scripting language, such as text/javascript. It helps browsers identify the type of script being used and handle it accordingly.
<script>
tag?
<script>
tag is used to specify the scripting language, such as text/javascript. It helps browsers identify the type of script being used and handle it accordingly.
What is the correct way to include an inline JavaScript code block using the <script>
tag?
A). <script type='text/javascript'>
...</script>
B). <script inline>
...</script>
C). <script>
D). <js>
...</js>
Which attribute of the <script>
tag is used to delay script execution until after the document is parsed?
A). type='defer'
B). async='false'
C). defer='true'
D). defer
How can you include an external JavaScript file using the <script>
tag?
A). <script src='script.js'>
</script>
B). <script>
src='script.js'
C). <script type='text/javascript' src='script.js'>
</script>
D). <js src='script.js'>
</js>
How can you specify the version of JavaScript used in a <script>
tag?
A). By including the version attribute in the <script>
tag.
B). By specifying the JavaScript version in the opening <script>
tag comment.
C). By using the type attribute with the appropriate MIME type.
D). By placing the JavaScript code within a CDATA section.
When including multiple <script>
tags in an HTML document, what determines the order of script execution?
A). The order in which the <script>
tags appear in the HTML document.
B). The order specified by the async attribute in each <script>
tag.
C). The alphabetical order of the script filenames.
D). The defer attribute in each <script>
tag.
What is the purpose of using external JavaScript files instead of inline code?
A). To reduce code redundancy and promote code reusability.
B). To execute JavaScript code asynchronously.
C). To ensure inline code executes before external code.
D). To improve security by isolating JavaScript code.
Which of the following is true about inline JavaScript code execution?
A). It always executes before external JavaScript files.
B). It executes simultaneously with external JavaScript files.
C). It executes after external JavaScript files.
D). It depends on the order of inclusion in the HTML document.
Which attribute can be used to include a JavaScript file asynchronously?
A). async='true'
B). defer='async'
C). type='async'
D). async
What is the purpose of including the defer attribute in a <script>
tag?
A). To execute the script asynchronously.
B). To delay script execution until after the document is parsed.
C). To specify the scripting language used in the script.
D). To load an external script file.
Which scenario is ideal for using the async attribute in the <script>
tag?
A). When the script must be executed in a specific order.
B). When the script contains critical functionality that should not be delayed.
C). When the script can be executed independently and does not depend on other scripts or document elements.
D). When the script must be executed after the document is parsed.