What does HTML stand for?
- A. Hyper Trainer Marking Language
- B. Hyper Text Markup Language (correct)
- C. High Text Machine Language
- D. Hyperlinks and Text Markup Language
Which HTML tag is used to create a hyperlink?
- A. <href>
- B. <link>
- C. <a> (correct)
- D. <url>
What does CSS stand for?
- A. Cascading Style Sheets (correct)
- B. Creative Style System
- C. Computer Style Sheets
- D. Colorful Style Syntax
Which CSS property changes the text color?
- A. font-color
- B. fgcolor
- C. text-style
- D. color (correct)
Which HTML tag defines the largest heading?
- A. <h6>
- B. <h1> (correct)
- C. <head>
- D. <heading>
Which keyword declares a block-scoped variable that can be reassigned in JavaScript?
- A. var
- B. int
- C. let (correct)
- D. dim
Which HTTP method is normally used to retrieve data from a server?
- A. GET (correct)
- B. POST
- C. PUT
- D. DELETE
What does === do in JavaScript?
- A. Compares value only
- B. Compares value and type (correct)
- C. Assigns a value
- D. Compares type only
Which Flexbox property aligns items along the main axis?
- A. align-content
- B. text-align
- C. flex-wrap
- D. justify-content (correct)
Which of these is NOT a primitive data type in JavaScript?
- A. string
- B. boolean
- C. float (correct)
- D. undefined
What does DOM stand for?
- A. Data Object Mode
- B. Document Order Model
- C. Document Object Model (correct)
- D. Display Object Management
Which attribute provides alternative text for an image?
- A. alt (correct)
- B. title
- C. src
- D. name
What is the default display value of a <div> element?
- A. inline
- B. block (correct)
- C. flex
- D. inline-block
Which method converts a JSON string into a JavaScript object?
- A. JSON.decode()
- B. JSON.stringify()
- C. JSON.toObject()
- D. JSON.parse() (correct)
Which HTTP status code means "Not Found"?
- A. 200
- B. 301
- C. 404 (correct)
- D. 500
What is event bubbling in JavaScript?
- A. Events travel from ancestors down to the target
- B. Events travel from the target up through its ancestors (correct)
- C. Events are cancelled automatically
- D. Events fire only once
What is a closure in JavaScript?
- A. A function that closes the browser window
- B. A way to end a loop
- C. A private class field
- D. A function that remembers variables from its outer scope (correct)
What does CORS stand for?
- A. Client Origin Request Security
- B. Cross-Origin Request Session
- C. Cross-Origin Resource Sharing (correct)
- D. Central Origin Resource System
What does an async function always return?
- A. A Promise (correct)
- B. undefined
- C. A callback
- D. A string
How does sessionStorage differ from localStorage?
- A. sessionStorage is shared across all tabs
- B. localStorage is cleared when the tab closes
- C. sessionStorage is cleared when the tab closes, localStorage persists (correct)
- D. They are identical
Which HTML tag creates a paragraph?
- A. <para>
- B. <p> (correct)
- C. <pg>
- D. <text>
Which HTML tag inserts an image?
- A. <pic>
- B. <img> (correct)
- C. <src>
- D. <image>
Which HTML tag creates an unordered (bulleted) list?
- A. <list>
- B. <ul> (correct)
- C. <ol>
- D. <li>
Which HTML tag creates a numbered list?
- A. <num>
- B. <ul>
- C. <ol> (correct)
- D. <nl>
Which tag is used for a single list item?
- A. <item>
- B. <ul>
- C. <li> (correct)
- D. <dl>
Which HTML tag creates a table row?
- A. <th>
- B. <row>
- C. <td>
- D. <tr> (correct)
Which HTML element holds the visible page content?
- A. <head>
- B. <html>
- C. <body> (correct)
- D. <meta>
Where does the <title> tag go?
- A. Inside <footer>
- B. Inside <body>
- C. Inside <head> (correct)
- D. Before <html>
Which tag creates a text input in a form?
- A. <textfield>
- B. <text>
- C. <input type="string">
- D. <input type="text"> (correct)
Which CSS property changes the background colour?
- A. color
- B. background-color (correct)
- C. bgcolor
- D. fill
Which CSS property changes the font size?
- A. font-style
- B. size
- C. font-size (correct)
- D. text-size
Which CSS selector targets an element with id="main"?
- A. .main
- B. #main (correct)
- C. *main
- D. main
Which CSS selector targets elements with class="card"?
- A. card
- B. #card
- C. .card (correct)
- D. @card
Which CSS property adds space inside an element's border?
- A. gap only
- B. margin
- C. padding (correct)
- D. spacing
Which CSS property adds space outside an element's border?
- A. border-spacing
- B. padding
- C. margin (correct)
- D. outline
Where is JavaScript usually linked in an HTML page?
- A. With a <script> tag (correct)
- B. With a <js> tag
- C. With a <link rel="js"> tag
- D. With a <code> tag
Which JavaScript method shows a message in the browser console?
- A. alert.log()
- B. document.print()
- C. print()
- D. console.log() (correct)
Which keyword declares a constant in JavaScript?
- A. final
- B. let
- C. const (correct)
- D. var
Which HTML attribute makes a link open in a new tab?
- A. href="_blank"
- B. target="_blank" (correct)
- C. open="new"
- D. new="tab"
Which file extension is used for CSS files?
- A. .css (correct)
- B. .style
- C. .cs
- D. .sty
What does the box-sizing: border-box rule do?
- A. Makes the element a flex container
- B. Includes padding and border in an element's width and height (correct)
- C. Removes the border
- D. Adds a box shadow
Which CSS property creates a flex container?
- A. align: flex
- B. display: flex (correct)
- C. position: flex
- D. flex: 1
Which property aligns flex items on the cross axis?
- A. text-align
- B. flex-direction
- C. justify-content
- D. align-items (correct)
Which CSS property makes a grid with three equal columns?
- A. grid-columns: 3
- B. grid: 3fr
- C. grid-template-columns: repeat(3, 1fr) (correct)
- D. columns: 3 equal
What does position: absolute position an element relative to?
- A. Its nearest positioned ancestor (correct)
- B. The body only
- C. The browser window always
- D. Its previous sibling
What does position: sticky do?
- A. Makes it draggable
- B. Fixes the element permanently
- C. Removes it from layout
- D. Acts like relative until a scroll threshold, then sticks (correct)
What is a media query used for?
- A. Applying styles based on screen size or device features (correct)
- B. Querying a database
- C. Playing media files
- D. Loading images lazily
Which unit is relative to the root element's font size?
- A. em
- B. rem (correct)
- C. vh
- D. px
What does 100vh mean in CSS?
- A. 100 em units
- B. 100 pixels
- C. 100% of the parent
- D. 100% of the viewport height (correct)
What does document.querySelector(".btn") return?
- A. All matching elements
- B. The first element matching the selector (correct)
- C. A CSS rule
- D. The number of matches
Which method attaches an event handler in JavaScript?
- A. attachHandler()
- B. addEventListener() (correct)
- C. listen()
- D. onEvent()
What does Array.prototype.map() return?
- A. The same array modified
- B. A boolean
- C. A single value
- D. A new array with each element transformed (correct)
What does Array.prototype.filter() return?
- A. A new array with elements that pass a test (correct)
- B. The first matching element
- C. A boolean
- D. The index of a match
What does Array.prototype.reduce() do?
- A. Removes elements
- B. Combines all elements into a single value (correct)
- C. Sorts elements
- D. Reverses elements
What is the difference between let and var?
- A. let is function-scoped
- B. let is block-scoped; var is function-scoped (correct)
- C. They are identical
- D. var cannot be reassigned
What does typeof null return in JavaScript?
- A. "number"
- B. "null"
- C. "undefined"
- D. "object" (correct)
What does fetch() return?
- A. A Promise (correct)
- B. An XMLHttpRequest
- C. A string
- D. The response body directly
What does JSON.stringify() do?
- A. Parses JSON text
- B. Validates JSON
- C. Converts a JavaScript value to a JSON string (correct)
- D. Downloads JSON
What is the purpose of semantic HTML tags like <article> and <nav>?
- A. They add styling automatically
- B. They describe the meaning of content for accessibility and SEO (correct)
- C. They load faster
- D. They run JavaScript
What is the purpose of the <meta name="viewport"> tag?
- A. Adds keywords for SEO
- B. Sets the page title
- C. Controls page scaling and width on mobile devices (correct)
- D. Links a stylesheet
What is the CSS specificity order from strongest to weakest?
- A. Id, inline, class, element
- B. Inline style, id, class, element (correct)
- C. Class, id, element, inline
- D. Element, class, id, inline
What does the spread operator ... do with arrays?
- A. Joins strings
- B. Creates a range
- C. Expands an array into individual elements (correct)
- D. Deletes elements
What is a template literal in JavaScript?
- A. A string in backticks that can embed ${expressions} (correct)
- B. A CSS template
- C. A JSON schema
- D. A reusable HTML file
What does the HTTP status code 500 mean?
- A. Internal server error (correct)
- B. Unauthorized
- C. Not found
- D. OK
What does the HTTP status code 201 mean?
- A. Accepted for later
- B. Created (correct)
- C. No content
- D. OK
What is the event loop in JavaScript?
- A. A browser plugin
- B. A loop that listens for clicks
- C. The mechanism that runs queued callbacks when the call stack is empty (correct)
- D. A for loop over events
Which runs first: a resolved Promise callback or a setTimeout(fn, 0) callback?
- A. The Promise callback (microtask) (correct)
- B. It is random
- C. The setTimeout callback
- D. They run at the same time
What does await do inside an async function?
- A. Retries the Promise
- B. Blocks the whole browser
- C. Pauses the function until the Promise settles (correct)
- D. Creates a new thread
What is the virtual DOM in React?
- A. An in-memory representation used to compute minimal real DOM updates (correct)
- B. A CSS framework
- C. A second browser window
- D. A server-side DOM
What does React's useState hook return?
- A. The current state value and a function to update it (correct)
- B. Only the state value
- C. A ref to a DOM node
- D. A Promise
When does a useEffect with an empty dependency array run?
- A. Once after the first render (correct)
- B. On every render
- C. Never
- D. Before the first render
What is event delegation?
- A. Passing events to the server
- B. Cancelling events
- C. Handling events on a parent element instead of each child (correct)
- D. Creating custom events only
What does event.preventDefault() do?
- A. Stops the browser's default action for the event (correct)
- B. Removes the event listener
- C. Stops the event from bubbling
- D. Reloads the page
What is the difference between == and === in JavaScript?
- A. == only compares strings
- B. === converts types
- C. They are identical
- D. == converts types before comparing; === does not (correct)
Which HTTP header lets a server allow cross-origin requests from another site?
- A. Cache-Control
- B. Authorization
- C. Access-Control-Allow-Origin (correct)
- D. Content-Type
What is XSS (cross-site scripting)?
- A. A CSS framework
- B. Cross-server syncing
- C. Injecting malicious scripts into pages viewed by other users (correct)
- D. A slow script error
What is the main benefit of server-side rendering for SEO?
- A. It makes images smaller
- B. Search engines receive complete HTML without running JavaScript (correct)
- C. It hides the source code
- D. It removes the need for CSS
What does the defer attribute on a <script> tag do?
- A. Never runs the script
- B. Runs the script immediately, blocking parsing
- C. Downloads the script in parallel and runs it after the HTML is parsed (correct)
- D. Runs it only on mobile
What is debouncing?
- A. Running a function repeatedly
- B. Removing bugs
- C. Delaying a function until events stop firing for a set time (correct)
- D. Caching API results
What does the CSS property z-index control?
- A. Stacking order of positioned elements (correct)
- B. Horizontal position
- C. Opacity
- D. Zoom level