Difficulty: Easy & Basic
Which language defines the structure and meaning of web page content?
A HTML
B CSS
C JavaScript
D SQL
Answer: A. HTML. HTML provides semantic markup for page structure and content.
Why is CSS added to a web page?
A To store records
B To control presentation
C To route packets
D To compile programs
Answer: B. To control presentation. CSS controls how elements are presented on screen.
How does JavaScript mainly extend a web page?
A Defines page meaning
B Stores images
C Adds behavior
D Resolves domain names
Answer: C. Adds behavior. JavaScript adds behavior and interactivity to web pages.
In browser terminology, what does DOM stand for?
A Style sheet file
B Network address
C Database table
D Document Object Model
Answer: D. Document Object Model. DOM means Document Object Model, the browser’s object representation of a document.
Where is an anchor’s destination usually set?
A href attribute
B class attribute
C alt attribute
D title attribute
Answer: A. href attribute. The href attribute gives an anchor its linked destination.
For the main page heading, which element is appropriate?
A meta element
B link element
C h1 element
D script element
Answer: C. h1 element. The h1 element marks the page’s main heading.
Image alt text provides what for assistive technology?
A Image dimensions
B Text alternative
C File location
D Color profile
Answer: B. Text alternative. Alt text gives an image a text alternative.
When is a button element the right choice?
A For an action
B For a page address
C For a paragraph
D For an image caption
Answer: A. For an action. Buttons are intended for actions such as submitting or opening controls.
How does a label connect to a form control?
A href attribute
B src attribute
C target attribute
D for attribute
Answer: D. for attribute. A label’s for value matches the control’s id.
How can a stylesheet target every element with class notice?
A #notice selector
B notice selector
C .notice selector
D *notice selector
Answer: C. .notice selector. The dot selector targets elements whose class includes notice.
On mobile, what does the viewport meta setting help control?
A Audio volume
B Mobile layout width
C Server location
D Text encoding
Answer: B. Mobile layout width. The viewport setting helps pages fit the device’s layout viewport.
Which element links an external stylesheet?
A link element
B style element
C meta element
D label element
Answer: A. link element. A link element with rel=stylesheet connects an external CSS file.
Why is the lang attribute useful on html?
A Sets page width
B Loads fonts
C Identifies page language
D Encrypts traffic
Answer: C. Identifies page language. The lang attribute identifies the document language for tools and users.
For email-address input, which type is appropriate?
A search
B number
C hidden
D email
Answer: D. email. The email type gives the field email-specific semantics and validation.
Relative URLs use which starting point?
A DNS root server
B Document base URL
C Browser version
D Screen resolution
Answer: B. Document base URL. A relative URL resolves against the document’s base URL.
During page inspection, which browser panel shows page elements?
A Elements panel
B Downloads panel
C History panel
D Bookmarks panel
Answer: A. Elements panel. The Elements panel exposes the page’s element tree for inspection.
By matching device or viewport features, what can media queries target?
A Database records
B URL fragments
C Device or viewport features
D HTTP methods
Answer: C. Device or viewport features. Media queries apply styles when viewport or device conditions match.
In JavaScript, which keyword declares a block-scoped constant binding?
A goto
B define
C static
D const
Answer: D. const. Const declares a block-scoped binding that cannot be reassigned.
For a match, document.querySelector() returns which element?
A Every matching element
B First matching element
C The page URL
D A stylesheet rule
Answer: B. First matching element. querySelector returns the first element matching its selector.
Why should form controls have associated labels?
A Faster DNS lookup
B Smaller images
C Clear accessible names
D Automatic encryption
Answer: C. Clear accessible names. Associated labels provide clear names for form controls.
Web pages commonly travel between clients and servers using which protocol?
A HTTP
B SMTP
C SSH
D NTP
Answer: A. HTTP. HTTP carries requests and responses between web clients and servers.
Domain names are mapped to network addresses by which system?
A CSS
B HTTP
C TLS
D DNS
Answer: D. DNS. DNS resolves domain names to network addresses.
Which scheme protects HTTP traffic using TLS?
A FTP
B HTTPS
C file
D mailto
Answer: B. HTTPS. HTTPS protects HTTP communications with TLS.
Which small piece of site state may a browser cookie store?
A A complete web page
B CSS source code
C Small site state
D DNS zone file
Answer: C. Small site state. Cookies can retain small pieces of site state.
How does HTML denote a paragraph of text?
A nav element
B img element
C aside element
D p element
Answer: D. p element. The p element represents a paragraph.