
Practice: Internal vs. External Scripts
Authored by Wayground CTE
Information technology (IT)
9th Grade
Blooms Level: Understand covered

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
17 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which tag and attribute combination correctly loads an external JavaScript file?
Answer explanation
External scripts use the script tag with the src attribute. The href attribute belongs to anchor and link tags, not script tags.
Tags
Blooms Level: Remember
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A team needs the same validation logic on five pages. Which approach reduces duplicate code?
Write inline handlers on each input field
Paste the function into each page's body
Link one external .js file from each page
Copy the script block into each page's head
Answer explanation
One external file linked by all pages keeps logic in a single location, so updates apply everywhere at once.
Tags
Blooms Level: Apply
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What benefit does an external script offer over an internal script for a large site?
Bypasses the DOM tree entirely
Can be cached by the browser
Runs before the HTML parses
Avoids the need for a script tag
Answer explanation
Browsers cache external .js files, so repeat visits load faster. Internal scripts re-download with every HTML request.
Tags
Blooms Level: Understand
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A script in the head queries an element that appears later in the body. What is the likely result?
The query returns the body tag
The element is created automatically
The query returns null
The query pauses until the element loads
Answer explanation
Head scripts run before body elements are parsed, so DOM lookups return null. Move the script to the bottom or use a load event to fix this.
Tags
Blooms Level: Apply
5.
MULTIPLE SELECT QUESTION
2 mins • 2 pts
Which TWO statements about external JavaScript files are correct?
They cannot be used with HTML forms
They are saved with a .js extension
They must include their own script tags inside the file
They run only after the user clicks a button
They are linked using the src attribute
Answer explanation
External JS files use the .js extension and are referenced via src. Script tags belong in the HTML, not inside the .js file.
Tags
Blooms Level: Understand
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Where should a script tag be placed so it runs after all HTML elements are available?
Inside the title element
Inside the head element
At the top of the document
Just before the closing body tag
Answer explanation
Placing scripts before the closing body tag ensures the DOM is fully parsed first, so element lookups succeed without extra event listeners.
Tags
Blooms Level: Remember
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A developer has a few lines of test code used only on the homepage. Which choice fits best?
A new external file linked to every page
An internal script on that page only
A separate external file linked in the head
A minified library hosted on a CDN
Answer explanation
Page-specific, throwaway code belongs inline on that page. Creating an external file for one page adds an unneeded network request.
Tags
Blooms Level: Apply
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?