All LPI exams

Free 030-100 practice test: 30 questions with answers

30 original questions for Web Development Essentials, drawn from every topic area. Answer each one to see whether you got it right and why. No sign-up.

Free questions
30
Full bank
112 questions
Real exam
40 questions, 60 min

030-100 exam guide: topics, cost and format

All 30 030-100 questions with answers

The same questions as the test above, grouped by exam topic. Open any question to see the answer and explanation.

034 JavaScript Programming (6 questions)

  1. Question 1

    A developer declares const settings = { theme: 'dark' }; and later in the same function runs settings.theme = 'light';. What happens?

    1. AAn error is thrown, because const values can never be changed
    2. Bsettings becomes undefined, because const values are read-only
    3. CThe property changes, because const only blocks reassigning the binding
    4. DThe write is ignored, because const objects are frozen
    Show answer and explanation
    Correct answer: C

    const prevents reassigning the variable itself, but the object it refers to remains mutable, so the property update succeeds. The other options confuse const with Object.freeze, which is a separate mechanism that makes an object's properties read-only.

  2. Question 2

    What does the typeof operator return for a variable whose value is null?

    1. Anull
    2. Bundefined
    3. Cboolean
    4. Dobject
    Show answer and explanation
    Correct answer: D

    typeof null returns the string object, a long-standing quirk of JavaScript that cannot be changed without breaking existing code. Null is checked with an explicit comparison such as value === null, because undefined and boolean are not what typeof reports for it.

  3. Question 3

    Which comparison evaluates to true in JavaScript?

    1. Anull === undefined
    2. B0 === '0'
    3. C0 == '0'
    4. DNaN === NaN
    Show answer and explanation
    Correct answer: C

    The loose equality operator converts the string '0' to a number before comparing, so 0 == '0' is true. Strict equality also compares types, so 0 === '0' is false, null and undefined are different values, and NaN is never equal to itself.

  4. Question 4

    A developer needs a new array holding only the prices above 100 from an existing array, while the original array must remain unchanged. Which method is the most appropriate?

    1. Asplice, which removes items from the original array
    2. Bpush, which appends items to the end of the array
    3. Csort, which reorders the items in place
    4. Dfilter, which returns a new array of matching elements
    Show answer and explanation
    Correct answer: D

    filter builds and returns a new array containing only the elements that pass the test, and the source array is untouched. splice, push and sort all modify the original array in place, so they do not produce a filtered copy without changing the source.

  5. Question 5

    A function returns another function that still reads a variable declared in the outer function, even after the outer function has finished running. What is this behavior called?

    1. AHoisting
    2. BDebouncing
    3. CDestructuring
    4. DClosure
    Show answer and explanation
    Correct answer: D

    A closure is a function bundled with references to the variables of its enclosing scope, so it can use them after the outer function returns. Hoisting moves declarations up in their scope, destructuring unpacks values from structures, and debouncing delays repeated calls.

  6. Question 6

    Which two statements about JavaScript Set and Map objects are correct? (Choose two.)

    1. AA Map keys must always be strings
    2. BA Set stores each value only once
    3. CA Set stores key and value pairs
    4. DA Map keeps its entries in insertion order
    5. EA Set is accessed by numeric index with bracket notation
    Show answer and explanation
    Correct answer: B, D

    A Set rejects duplicate values, and a Map iterates its entries in the order they were inserted. Map keys can be of any type, and a Set holds only values with no key-value pairs and no index access.

032 HTML Document Markup (6 questions)

  1. Question 7

    Which element must appear in the head section of an HTML document to set the text shown in the browser tab?

    1. AThe title element
    2. BThe meta element
    3. CThe header element
    4. DThe h1 element
    Show answer and explanation
    Correct answer: A

    The title element in the head provides the document title that browsers show in tabs and use in bookmarks. h1 is a visible heading in the body, meta supplies machine-readable metadata such as the character set, and header is a body-level element for introductory content.

  2. Question 8

    A developer is marking up a blog post. The site navigation, the main article text and the site footer should be identified by their role in the document rather than by how they look. Which markup best fits?

    1. AGeneric div elements styled with classes
    2. BThe nav, article and footer elements
    3. CSpan elements with inline style attributes
    4. DParagraph elements with bold and italic tags
    Show answer and explanation
    Correct answer: B

    nav, article and footer are semantic elements that describe the role of each block, which assistive technology and search engines can use. Generic div and span elements carry no meaning and need classes to convey structure, and paragraphs with bold and italic tags describe appearance rather than role.

  3. Question 9

    A product page shows a photo of a jacket. A screen reader user needs to hear what the photo shows, and the image is not decorative. Which attribute of the img element should the developer write to provide this?

    1. Asrc
    2. Balt
    3. Ctitle
    4. Dhref
    Show answer and explanation
    Correct answer: B

    The alt attribute supplies the text alternative that screen readers announce when the image cannot be seen or loaded. src gives the image location, href belongs to anchor and link elements, and title creates a tooltip that is not a reliable replacement for a text alternative.

  4. Question 10

    A script element in the head of a page loads a large file before the browser parses the body, which delays the first render. The scripts must still run in the order they appear. Which change lets the HTML parse first while keeping execution order?

    1. AAdd the async attribute to the script element
    2. BAdd the defer attribute to the script element
    3. CMove the script into an inline style attribute
    4. DChange the type attribute to text/css
    Show answer and explanation
    Correct answer: B

    defer downloads the script in parallel and runs it after parsing finishes, in document order. async runs each script as soon as it downloads, so the order is not guaranteed, and the other two options do not change when the script runs.

  5. Question 11

    Which meta element tells a mobile browser to match the layout width to the device width so that a responsive page scales correctly?

    1. AA meta element with charset set to utf-8 only
    2. BA link element with rel set to stylesheet and media set to screen
    3. CA meta element named viewport with content width=device-width
    4. DA title element containing the device width value
    Show answer and explanation
    Correct answer: C

    The viewport meta element with width=device-width sets the layout width to the device width, which is the basis for responsive design. The charset meta element declares the text encoding, a stylesheet link loads CSS, and a title element only sets the document title.

  6. Question 12

    A signup form has an email text box, but a screen reader announces only edit text for it. The developer adds the words Email address in a label element. Which change correctly associates the label with the input?

    1. ASet the placeholder attribute to a single space character
    2. BWrap the input inside a div element with the class email
    3. CGive the input an id and set the label's for attribute to match
    4. DPut the label text into the input value attribute only
    Show answer and explanation
    Correct answer: C

    A label's for attribute matches the id of the control, which gives the input an accessible name. A placeholder is not a reliable label, wrapping the input in a div creates no association, and a value attribute pre-fills the field rather than naming it.

033 CSS Content Styling (6 questions)

  1. Question 13

    A stylesheet contains p.intro { color: navy; } and #hero p { color: red; }. A paragraph with the class intro sits inside a container with the id hero. Which color does the paragraph show?

    1. ANavy, because the class selector is listed first in the stylesheet
    2. BNavy, because a class selector is more specific than an element selector
    3. CRed, because an id selector outweighs any number of class selectors
    4. DBlack, because two conflicting rules cancel each other out
    Show answer and explanation
    Correct answer: C

    #hero p has one id and one element (1,0,1), while p.intro has one class and one element (0,1,1), and an id outranks any number of classes, so red wins. Source order only decides between rules of equal specificity, and conflicting rules never cancel each other out.

  2. Question 14

    Which box-sizing value makes an element's declared width include its padding and border, so the box stays the same size when padding is added?

    1. Acontent-box
    2. Bpadding-box
    3. Cborder-box
    4. Dmargin-box
    Show answer and explanation
    Correct answer: C

    border-box makes width and height include padding and border, while content-box, the default, adds them on top of the declared width. Neither padding-box nor margin-box is a box-sizing value, since padding-box belongs to background properties.

  3. Question 15

    Two paragraphs are stacked in normal flow. The first has a bottom margin of 20px, and the second has a top margin of 30px. What vertical gap appears between them?

    1. A30px, the larger of the two margins
    2. B50px, the sum of both margins
    3. C20px, the bottom margin of the first paragraph
    4. D0px, because margins always cancel each other out
    Show answer and explanation
    Correct answer: A

    Adjacent vertical margins of block boxes collapse into one margin equal to the larger value, so the gap is 30px. A 50px gap is what happens when margins do not collapse, such as horizontal margins, and the other options either ignore the second margin or invent a rule that margins cancel.

  4. Question 16

    Which CSS unit is relative to the font size of the root html element and is commonly used for scalable spacing and text sizes?

    1. Aem
    2. Brem
    3. Cpx
    4. Dvw
    Show answer and explanation
    Correct answer: B

    rem is relative to the root element's font size, so it scales consistently across the page. em is relative to the font size of the current element or its parent, vw is a percentage of the viewport width, and px is a fixed absolute length.

  5. Question 17

    A navigation list has three items that stack vertically. The developer wants the items to sit side by side in one row, without changing the list markup. Which declaration on the ul element achieves this?

    1. Adisplay: block;
    2. Bdisplay: none;
    3. Cdisplay: flex;
    4. Dvisibility: hidden;
    Show answer and explanation
    Correct answer: C

    display: flex on the list makes its direct children flex items, which line up in a row by default. display: block keeps the stacked layout, display: none removes the list from rendering, and visibility: hidden hides it while keeping its space.

  6. Question 18

    Which two CSS properties are inherited by default by child elements when they are set on a parent element? (Choose two.)

    1. Amargin
    2. Bcolor
    3. Cborder-width
    4. Dfont-family
    5. Epadding
    Show answer and explanation
    Correct answer: B, D

    color and font-family are inherited, so children take them unless they declare their own values. margin, border-width and padding are not inherited, so each element sets its own box spacing and borders.

035 NodeJS Server Programming (6 questions)

  1. Question 19

    A developer wants to share a helper function from one Node.js file with another file in a CommonJS project. Which pattern is appropriate?

    1. AAssign it to module.exports in the helper and call require in the other file
    2. BCopy the function text into the other file each time it is needed
    3. CCall the helper through the window object from the other file
    4. DPlace the helper in the HTML file and load it with a script tag
    Show answer and explanation
    Correct answer: A

    module.exports publishes a value from a CommonJS module, and require loads it where it is needed. Copying code duplicates it and makes changes hard to maintain, while window and script tags belong to the browser and are not part of Node.js module loading.

  2. Question 20

    Which file records a Node.js project's metadata, scripts and dependency list, and is read by npm when packages are installed?

    1. Apackage.json
    2. Bnode_modules
    3. CREADME.md
    4. Dindex.js
    Show answer and explanation
    Correct answer: A

    package.json holds the project's name, version, scripts and dependencies, which npm reads during npm install. index.js is typically an entry-point script, node_modules holds installed packages, and README.md documents the project for people.

  3. Question 21

    Which core Node.js module provides functions for reading and writing files on the local file system?

    1. Ahttp module
    2. Bfs module
    3. Cpath module
    4. Dos module
    Show answer and explanation
    Correct answer: B

    The fs module offers file system operations such as readFile and writeFile. The http module creates servers and clients, the path module manipulates file path strings, and the os module reports information about the operating system.

  4. Question 22

    A Node.js route handler calls fs.readFileSync on a large file for every incoming request, and other requests slow down sharply under load. What is the most likely cause?

    1. AThe http module refuses to send files above one kilobyte
    2. BNode.js starts a separate thread for each request, which exhausts memory
    3. CJavaScript strings cannot hold text that was read from a file
    4. DThe synchronous read blocks the event loop until the whole file is read
    Show answer and explanation
    Correct answer: D

    readFileSync does not return until the file is fully read, so the single JavaScript thread cannot handle other events in the meantime. The other options invent limits or threading behavior that Node.js does not have, and strings can hold file contents without problems.

  5. Question 23

    Which two statements about Node.js are correct? (Choose two.)

    1. ANode.js is a browser extension that modifies the page DOM
    2. BNode.js runs JavaScript outside the browser on the V8 engine
    3. CNode.js code must always be written in TypeScript
    4. Dnpm install reads the dependencies listed in package.json
    5. ENode.js is available only on Windows operating systems
    Show answer and explanation
    Correct answer: B, D

    Node.js executes JavaScript on the V8 engine outside the browser, and npm install installs the dependencies declared in package.json. Node.js is a server-side runtime rather than a browser extension, it does not require TypeScript, and it runs on Linux, macOS and Windows.

  6. Question 24

    An Express application defines the route app.get('/users/:id', handler). A request to /users/42 arrives. Where does the handler find the value 42?

    1. Areq.query.id
    2. Bres.locals.id
    3. Creq.body.id
    4. Dreq.params.id
    Show answer and explanation
    Correct answer: D

    Values named in a route path with a colon are placed on req.params, so req.params.id holds the string '42'. req.query holds values after the question mark, req.body holds parsed request payloads, and res.locals holds data for the response and its templates.

031 Software Development and Web Technologies (6 questions)

  1. Question 25

    An online store's checkout page sends a new order to the server. The team needs a request method that changes server-side state, is neither safe nor idempotent, and could create duplicate orders if a user submits the form twice. Which HTTP method fits this request?

    1. AGET
    2. BPOST
    3. CPUT
    4. DDELETE
    Show answer and explanation
    Correct answer: B

    POST is used to submit data that creates or changes server-side state, and it is neither safe nor idempotent, so repeating it can create duplicates. GET is safe and idempotent, while PUT and DELETE are idempotent, so repeating them leaves the same final state.

  2. Question 26

    Which HTTP status code tells a client that its request succeeded and that the server created a new resource as a result?

    1. A201 Created
    2. B200 OK
    3. C301 Moved Permanently
    4. D204 No Content
    Show answer and explanation
    Correct answer: A

    201 Created signals success and that a new resource now exists, often with a Location header pointing to it. 200 OK only reports success without naming creation, 204 No Content means success with no response body, and 301 means the resource has moved to another address.

  3. Question 27

    A retail company is redesigning its web system so that browser-facing pages, the business rules that calculate prices and taxes, and the database storing orders each run in a separate layer. Which architecture pattern does this describe?

    1. APeer-to-peer architecture
    2. BSingle-file script architecture
    3. CEvent-driven batch processing
    4. DThree-tier architecture
    Show answer and explanation
    Correct answer: D

    Three-tier architecture separates the presentation, application logic and data layers. Peer-to-peer networks have equal nodes rather than layers, a single-file script has no separation at all, and batch processing describes how work is scheduled rather than how the system is layered.

  4. Question 28

    Which two practices help a development team track changes to source code and restore an earlier version when a release breaks? (Choose two.)

    1. ARenaming the main source file every time a feature changes
    2. BCommitting small changes with clear messages to a version control system
    3. CKeeping only the most recent copy on a shared network drive
    4. DDeleting the commit history before each deployment
    5. ETagging each release so that it can be checked out again later
    Show answer and explanation
    Correct answer: B, E

    Small, well-described commits and release tags both preserve the history of changes, so earlier states can be inspected or restored. Renaming files and keeping only the latest copy lose the record of earlier versions, and deleting history removes the ability to roll back.

  5. Question 29

    A developer keeps a database password directly in the source code of a web application, and the code is pushed to a shared repository. What is the most appropriate change?

    1. AEncode the password with Base64 before placing it in the source file
    2. BMove the source file into a less obvious folder in the repository
    3. CRename the password variable so that it is harder to recognize
    4. DLoad the password from an environment variable or secrets store at runtime
    Show answer and explanation
    Correct answer: D

    Secrets should be supplied at runtime from the environment or a secrets store so they never sit in version control. Base64 is an encoding that anyone can reverse, and moving or renaming the code only hides the value from casual reading without protecting it.

  6. Question 30

    A shopping site must remember a visitor's cart between separate page requests, but HTTP on its own does not keep state from one request to the next. Which mechanism lets the server connect later requests to the same visitor?

    1. AA longer URL path on every page
    2. BCookies or session tokens sent with each request
    3. CA larger HTML document for each page
    4. DA faster network connection
    Show answer and explanation
    Correct answer: B

    Cookies or session identifiers sent with each request allow the server to associate later requests with the same visitor and stored cart. Longer paths, larger documents and faster connections do not give the server any way to identify a returning client.