Answer & Solution
<container><script></container>. It is used with the src attribute to specify the path of the external file.
<container><script></container>. It is used with the src attribute to specify the path of the external file.
What does the async attribute do when used in a <container><script></container> tag?
A). Executes the script immediately
B). Delays script execution until HTML parsing is complete
C). Executes the script asynchronously
D). Executes the script before the HTML parsing begins
What is the correct syntax for referring to an external script called 'app.js'?
A). <container><script src='app.js'></container>
B). <container><script href='app.js'></container>
C). <container><script link='app.js'></container>
D). <container><script file='app.js'></container>
What is the purpose of using external JavaScript files?
A). To keep HTML and JavaScript code separate
B). To reuse the JavaScript code on multiple pages
C). To improve the maintainability of the code
D). All of the above
Where should the <container><script></container> tag be placed in HTML?
A). In the <container><head></container> section
B). In the <container><body></container> section
C). At the end of the <container><body></container> section
D). All of the above
How can you prevent an external JavaScript file from being cached by the browser?
A). Add a query string to the src attribute
B). Use the async attribute
C). Use the defer attribute
D). It is not possible to prevent caching
Which file extension is used for JavaScript files?
A). .java
B). .js
C). .javascript
D). .jsx
What is the effect of using the defer attribute in the <container><script></container> tag?
A). The script will be executed after the HTML document has been fully parsed
B). The script will be executed as soon as it is downloaded
C). The script will not be executed
D). The script will be executed before the HTML document is parsed
What attribute is used to specify the path of an external JavaScript file?
A). href
B). src
C). path
D). file
What happens if the external JavaScript file is not found?
A). The browser will ignore the script
B). The browser will show a 404 error
C). The script will not run
D). All of the above
How do you comment out code in JavaScript?
A). // This is a comment
B). /* This is a comment */
C). <!-- This is a comment --!>
D). ## This is a comment