CodeHS Web Development Accreditations 3 — Questions and Answers
Question 1: Which HTTP status code indicates a resource was not found on the server?
- 200
- 301
- 404 (Correct answer)
- 500
Correct answer: 404
A 404 status code means the requested resource could not be located on the server.
Question 2: In JavaScript, what does 'typeof null' return?
- 'null'
- 'undefined'
- 'object' (Correct answer)
- 'boolean'
Correct answer: 'object'
Due to a legacy bug in JavaScript, typeof null returns 'object' even though null is not an object.
Question 3: Which CSS property is used to make text bold?
- text-style
- font-weight (Correct answer)
- text-weight
- font-style
Correct answer: font-weight
font-weight controls the thickness of text characters; the value 'bold' or '700' makes text bold.
Question 4: What does the HTML <nav> element semantically represent?
- A navigation bar with links (Correct answer)
- Any visible list
- The page header section
- A sidebar widget
Correct answer: A navigation bar with links
The <nav> element is a semantic HTML5 tag that marks a section containing major navigation links.
Question 5: Which JavaScript keyword declares a variable that cannot be reassigned?
- var
- let
- const (Correct answer)
- static
Correct answer: const
Variables declared with 'const' cannot be reassigned after their initial declaration.
Question 6: In CSS Flexbox, which property on the container defines the main axis direction?
- flex-wrap
- align-items
- flex-direction (Correct answer)
- justify-self
Correct answer: flex-direction
flex-direction sets whether flex items are laid out in a row or column and controls the main axis orientation.
Question 7: What is the correct way to write a single-line comment in JavaScript?
- <!-- comment -->
- # comment
- // comment (Correct answer)
- /* comment */
Correct answer: // comment
Two forward slashes (//) start a single-line comment in JavaScript; everything after them on that line is ignored.
Which HTTP status code indicates a resource was not found on the server?