Revision approach
- Connected web-programming model
- HTML; CSS; JavaScript; server; persistent data
- Literal code before tracing
- Default JavaScript: modern browser ECMAScript
- Default PHP: PHP 8.x
- MySQLi/PDO: configured MySQL connection
- Explicit legacy-syntax exceptions
👁 Full explanation
Build a connected model of browser markup, CSS, JavaScript, server processing and persistent data. Read code literally before tracing it. Unless a section explicitly discusses legacy syntax, JavaScript means modern ECMAScript in a browser and PHP means PHP 8.x; database examples use MySQLi or PDO with a configured MySQL connection. - End-to-end request trace
- Input→request→server validation→database→response→DOM
- Failures and permissions included
👁 Full explanation
Trace input → request → server validation → database → response → DOM update, including failures and permissions. - CSS and code tracing
- Cascade winner and box calculations
- Small JavaScript/PHP traces
- Values and types after each statement
👁 Full explanation
Practise CSS winner/box calculations and small JS/PHP traces; record values and types after every statement. - Exam comparison strategy
- GET versus POST
- Browser versus server state
- Callbacks versus concurrency
- Parameterization versus output encoding
- Repair malformed tasks before trusting keys
👁 Full explanation
Compare GET/POST, browser/server state, callbacks/concurrency and parameterization/output encoding. Check task assumptions and code validity before selecting an answer.
WEB01
Browser, server and technology roles
[Exam Focus]- Internet, Web and service roles
- Internet: connected networks
- Web: resource system, commonly HTTP
- Browser/user agent: requests and HTML/CSS rendering
- Permitted JavaScript execution
- HTTP server: requests→representations
- Server may invoke application code
- Client/server roles can share one machine
👁 Full explanation
The Internet connects networks; the Web is a resource system commonly using HTTP. A browser/user agent requests resources and renders HTML/CSS, then runs permitted JavaScript. A web/HTTP server receives requests and returns representations, sometimes invoking application code. Client and server are roles and can run on the same machine. - Technology responsibilities
- HTML: structure/meaning; CSS: presentation
- JavaScript: programmable interactivity
- PHP; Python; JSP/Java; ASP.NET
- Server responses and database access
- C#: commonly ASP.NET
- Node.js: JavaScript runtime, not language
- JavaScript on client or server
- Browser sandbox; permission-based file/device APIs
- Nontrivial programs possible
- No unrestricted arbitrary client-hardware access
👁 Full explanation
HTML supplies structure/meaning; CSS controls presentation; JavaScript supplies programmable interactivity. PHP, Python, JSP/Java and ASP.NET applications generate server responses and access databases; C# is commonly used with ASP.NET. Node.js is a JavaScript runtime, not a separate language. JavaScript can run on either side. Browser scripts are sandboxed, but may access selected files/devices through permission-based APIs. They are not inherently limited to trivial programs, nor can they freely access arbitrary client hardware.
35 related practice questions
Blueprint: WEB1 · Note references: WEB-M, WEB-N
- Internet, Web and service roles
WEB02
Hosting, URLs and static versus dynamic content
[Exam Focus]- Hosting, addressing and URLs
- Hosting: serving environment
- Domain registration: reserved name
- DNS: names→network records
- ISP: connectivity
- URL: scheme, host, optional port
- Path; query; fragment
- Host: machine/service name
- Fragment: local document location
👁 Full explanation
Hosting supplies an environment where a site is served; domain registration reserves a name, and DNS maps names to network records. An ISP provides connectivity. A URL identifies scheme, host, optional port, path, query and fragment; the host identifies the machine/service name, while a fragment selects a local document location. - Static versus dynamic content
- Static server: stored files
- Dynamic: logic/request/data-built representations
- Static pages may run interactive scripts
- Dynamic content need not visibly change
- Website: resource group; page: document/resource
- Open standards ≠ identical browser support
- FrontPage; Macromedia HomeSite5: historical editors
- Editors ≠ languages or modern requirements
👁 Full explanation
A basic static server returns stored files; dynamic processing constructs a representation from logic, requests or data. Static pages can still run interactive browser scripts, and dynamic generation need not change visible text every time. A website groups resources; a page is one document/resource. Open standards do not guarantee identical support for every feature in every browser. Historical editor-name items refer to Microsoft FrontPage and Macromedia HomeSite5, not languages or required modern tools.
7 related practice questions
Blueprint: WEB1 · Note references: WEB-M, WEB-N, WEB-HOMESITE, WEB-FRONTPAGE
- Hosting, addressing and URLs
WEB03
Read an HTTP/1.1 exchange
[Exam Focus]- HTTP/1.1 message anatomy
- Request: method, request-target, version
- Headers→blank line→optional body
- GET /courses?id=7 HTTP/1.1
- Host: example.edu; terminating blank line
- Body may be absent
- Response: version, status, optional reason
- Headers→blank line→permitted content
- Request line ≠ response status line
👁 Full explanation
An HTTP/1.1 request begins with method, request-target and version, followed by header fields, a blank line, and an optional body. For example, GET /courses?id=7 HTTP/1.1 followed by Host: example.edu and a terminating blank line can have no body. A response begins with version, status code and optional reason phrase, then headers, blank line and permitted content. Request lines are not response status lines. - HTTP representation, framing and state
- Content-Type: representation format
- Content-Length/transfer framing: message boundaries
- Stateless request semantics
- Sessions/databases maintain application state
- HTTP2/3 encode differently
- Request-line universality requires HTTP/1.x scope
- Asynchronous client use still receives responses
👁 Full explanation
Content-Type describes representation format; Content-Length or transfer framing establishes message boundaries when applicable. HTTP is stateless in its request semantics, but applications maintain state through sessions/databases. HTTP2/3 encode messages differently; a textual request-line description applies to HTTP/1.x. Asynchronous use is a client programming choice, not proof that HTTP has no responses.
4 related practice questions
Blueprint: WEB1, WEB4 · Note references: WEB-N, WEB-H1
- HTTP/1.1 message anatomy
WEB04
Methods, status and GET/POST reasoning
[Exam Focus]- HTTP methods and intended effects
- GET: safe representation retrieval
- Intentional state changes: avoid GET links
- POST: process supplied content
- PUT: create/replace identified representation
- DELETE: remove resource association
- Safe: intended state effects
- Idempotent: repeated same intended effect
- Same response not required
- GET/PUT/DELETE idempotent; arbitrary POST not
👁 Full explanation
GET retrieves a representation with safe semantics; do not implement an intentional state-changing action as a GET link. POST asks the target to process supplied content. PUT creates/replaces the identified resource representation; DELETE requests removal of its association. Safe describes intended state effects; idempotent means repeating the same request has the same intended effect, not necessarily the same response. GET/PUT/DELETE are idempotent; arbitrary POST is not. - Status codes and form transport
- 200 success; 201 creation; 204 no-content
- 301 permanent redirect; 400 malformed request
- 401 missing/invalid authentication; 403 refusal
- 404 unavailable/not found; 500 unexpected failure
- GET forms: URL query name/value pairs
- POST forms: body name/value pairs
- Neither method encrypts
- POST body visible in developer tools
- Server/configuration imposes size limits
👁 Full explanation
200 indicates success, 201 creation, 204 success without content, 301 permanent redirection, 400 malformed request, 401 missing/invalid authentication, 403 refusal, 404 unavailable/not found, and 500 an unexpected server failure. GET forms usually put name/value pairs in the URL query; POST forms put them in the body. Neither method encrypts data. POST bodies are visible to developer tools and subject to server/configured size limits.
8 related practice questions
Blueprint: WEB1, WEB4 · Note references: WEB-N, WEB-HTTP
- HTTP methods and intended effects
WEB05
HTTPS and resource-oriented APIs
[Exam Focus]- HTTPS and REST constraints
- HTTP over TLS
- Channel confidentiality/integrity; certificate-based server authentication
- No input-safety or merchant-trust guarantee
- REST: client/server separation
- Stateless requests; cacheability; uniform resource interface
- Resources: identifiers and representations
- JSON common, not required
- JSON output alone ≠ REST
👁 Full explanation
HTTPS uses HTTP over TLS, protecting channel confidentiality/integrity and authenticating the server under certificate checks. It does not make unvalidated input safe or guarantee a trustworthy merchant. A RESTful API follows constraints such as client/server separation, stateless requests, cacheability and a uniform resource interface. Resources have identifiers and representations; JSON is common but not required. Merely returning JSON does not prove REST. - Resource API reasoning
- /students/7: GET read, PUT replace
- DELETE requests removal
- Authentication; authorization; validation
- Consistent error representations
- Retry safety before repeating requests
- Durable facts stored server-side
- Stateless requests can use persistent databases
👁 Full explanation
For a resource /students/7, GET reads it, PUT can replace it, and DELETE requests removal, subject to authentication/authorization and validation. Represent errors consistently and evaluate retry safety before repeating a request. Store durable application facts server-side; stateless API requests can still operate on persistent database state.
4 related practice questions
Blueprint: WEB1, WEB4 · Note references: WEB-M, WEB-N
- HTTPS and REST constraints
WEB06
HTML document, text and metadata
[Exam Focus]- HTML document structure and metadata
- HyperText Markup Language
- <!DOCTYPE html>: modern standards mode
- html root; head metadata; body content
- title: page/tab title
- Meta charset: encoding
- Description: summary; viewport: mobile viewport behavior
- h1–h6: heading hierarchy
- h6 conventionally smallest default
- CSS size not mandated
👁 Full explanation
HTML means HyperText Markup Language. <!DOCTYPE html> selects modern standards mode; <html> is the document root, <head> holds metadata, and <body> contains document content. <title> supplies the page/tab title. Meta charset declares encoding; description summarizes the page; viewport controls mobile viewport behavior. Heading levels h1–h6 express hierarchy, with h6 conventionally smallest in default styling, not a mandatory CSS size. - Text semantics and element anatomy
- p: paragraph; br: line break
- hr: thematic break
- pre: preserved whitespace; code: code
- strong: importance; em: stress
- b/i semantics ≠ importance/emphasis
- sub/sup: subscript/superscript
- <!-- comment -->: hidden display, visible source
- Entities: © < > &
- Tags: boundaries; element: content/attributes
- Void element example: img
👁 Full explanation
<p> marks paragraphs; <br> is a line break and <hr> a thematic break. <pre> preserves source whitespace; <code> marks code. <strong> indicates importance and <em> stress; <b>/<i> have other text semantics and are not identical to importance/emphasis. <sub>/<sup> mark sub/superscripts. <!-- comment --> is not displayed but remains visible in source. Entities include ©, <, > and &. Tags mark boundaries; an element includes content and attributes, or is a void element such as img.
18 related practice questions
Blueprint: WEB3 · Note references: WEB-M, WEB-N
- HTML document structure and metadata
WEB07
Links, images and accessible meaning
[Exam Focus]- Links and browsing targets
- <a href="page.html">Read</a>
- href: destination, not url/link
- href="#details"→id="details"
- _self: current; _blank: new context
- _parent: parent; _top: top-level
- Browser preference: tab versus window
👁 Full explanation
Use <a href="page.html">Read</a> for a link; href is the destination, not url/link. A fragment such as href="#details" links to an element with id="details". target="_self" uses the current context, _blank a new context, _parent its parent and _top the top-level context. Browser preferences determine tab versus window. - Images and accessibility
- img src: source; alt: alternative
- Informative images: meaningful alternative text
- Decorative images: empty alt
- Width/height reserve dimensions
- title ≠ replacement for alt
- Anchor may wrap image
- Programmatic labels; clear links; keyboard access
- Visual styling alone ≠ accessibility
- Attributes in opening tags
- Unique document-identifying IDs
👁 Full explanation
<img src="photo.jpg" alt="Students in a lab"> supplies source and alternative text. Use empty alt for purely decorative images; informative images need meaningful alternatives. Width/height reserve dimensions; title is not a replacement for alt. An anchor may wrap an image. Give controls programmatic labels, clear link text and keyboard access; visual styling alone does not establish accessibility. Attributes belong in opening tags, with unique IDs when used for document identification.
7 related practice questions
Blueprint: WEB3 · Note references: WEB-M, WEB-N
- Links and browsing targets
WEB08
Lists, tables and navigation
[Exam Focus]- Lists and navigation
- ul: unordered; ol: ordered
- li: list items
- Ordered list: start and numbering type
- CSS list-style-type: presentation
- dl: definition list
- dt: term; dd: description
- Semantic nav: list of links
👁 Full explanation
Unordered <ul> and ordered <ol> contain <li> items. Ordered lists can specify start and numbering type; use CSS list-style-type for presentation. A definition list uses <dl>, <dt> terms and <dd> descriptions. Navigation can be a semantic <nav> containing a list of links. - Tables and navigation reset
- table→tr rows→th/td cells
- th: header; td: data, not table
- colspan: columns; rowspan: rows
- Account for previously occupied cells
- Accessible header associations
- CSS borders, background, padding, border-collapse
- Legacy bgcolor/bordercolor not preferred
- nav ul: list-style-type:none;margin:0;padding:0
- Reset removes bullets/default spacing only
- Reset ≠ horizontal links/dropdown
👁 Full explanation
<table> contains rows <tr>, header cells <th> and data cells <td>; a td is not the table itself. colspan spans columns; rowspan spans rows. Account for occupied cells before placing the next cell, and use header associations for accessible data. CSS handles borders, background, cell padding and collapsed borders; legacy bgcolor/bordercolor are not preferred styling. Resetting nav ul with list-style-type:none; margin:0; padding:0 removes bullets and default spacing only; it does not itself arrange links horizontally or create a dropdown.
8 related practice questions
Blueprint: WEB3 · Note references: WEB-M, WEB-N
- Lists and navigation
WEB09
Form controls and successful submission
[Exam Focus]- Form submission and controls
- action: processing URL
- method: submission; enctype: encoding
- Default method: GET
- Named enabled successful controls contribute values
- Unchecked checkbox/radio usually absent
- label for→control id
- name: submitted field identifier
- Same-name radios: single choice
- Checkboxes: independent selections
- select→option; textarea: multiline
👁 Full explanation
A form’s action identifies its processing URL, method its submission method, and enctype its encoding. The default method is GET. Named enabled successful controls contribute values: unchecked checkboxes/radios are usually absent. A label’s for matches the control’s id; name identifies its submitted field. Same-name radio buttons form a single-choice group; checkboxes permit independent selections. <select> contains <option>; textarea accepts multiple lines. - Input behavior and validation limits
- size: approximate visible text width
- maxlength: entered-text length limit
- Neither establishes server security bound
- Password input masks, never encrypts
- submit: submission; button: no intrinsic submission
- email/required: browser validation feedback
- Arbitrary clients bypass validation
- GET/POST ≠ universal per-element parsing
👁 Full explanation
For a text input, size indicates approximate visible width, whereas maxlength limits entered text length. Neither means a server security bound. type="password" masks display but does not encrypt. submit submits; button has no submission action by itself. type=email/required give browser validation feedback; arbitrary clients can bypass it. No GET/POST method universally means “parse one element at a time.”
12 related practice questions
Blueprint: WEB1, WEB3 · Note references: WEB-M, WEB-N, WEB-INPUT
- Form submission and controls
WEB10
Frames, media and graphics
- Legacy frames and iframe
- frameset/frame: separate window documents
- Old frameset replaces body
- Named targets select changed frame
- Independent scrolling leaves other frames stationary
- Frameset/frame obsolete in modern HTML
- iframe embeds document within ordinary page
- Untrusted iframe: appropriate permissions/sandboxing
👁 Full explanation
Legacy frameset/frame divides a window into separate documents; frameset replaced body in old frameset documents. Named targets controlled which frame changed; independent scrolling could leave other frames stationary. These elements are obsolete in modern HTML. An iframe embeds a document within an ordinary page and needs appropriate permissions/sandboxing for untrusted content. - Media and graphics
- audio/video: supported media, controls, fallback
- embed/object may embed supported resources
- Generic video-tag question may be nonexclusive
- bgsound/Flash history ≠ current support
- Canvas: scripted bitmap drawing context
- SVG: scalable DOM shapes
- Canvas getContext("2d")→fillRect(x,y,w,h)
- Paths: beginPath/moveTo/lineTo/stroke
- Informative graphics require text alternatives
👁 Full explanation
Modern audio/video elements embed supported media, often with controls and fallback content; embed/object can also embed supported resources. Several tags can embed supported video resources; distinguish their semantics and browser support. Old bgsound or Flash examples do not imply current browser support. Canvas provides script-driven bitmap drawing via a context; SVG describes scalable shapes in the DOM. For a simple canvas task, obtain getContext("2d"), then use fillRect(x,y,w,h); line/path methods require beginPath/moveTo/lineTo/stroke. Preserve a text alternative where graphics convey information.
3 related practice questions
Note references: WEB-M, WEB-N
- Legacy frames and iframe
WEB11
CSS attachment and selector meaning
- CSS attachment and syntax
- External: link rel="stylesheet" href="styles.css"
- External link in head
- Internal: style; inline: style attribute
- External reuse, consistency, caching
- No universal smaller-page/accessibility guarantee
- selector { property: value; }
- CSS comments: /* ... */
👁 Full explanation
An external sheet uses <link rel="stylesheet" href="styles.css"> in head; an internal sheet uses style; an inline declaration uses an element’s style attribute. External CSS promotes reuse, consistent design and caching; it does not guarantee that every page becomes smaller or accessible. A rule is selector { property: value; }. Comments use /* ... */. - Selector meanings
- p: type; .notice: class; #logo: ID
- h1,h2: grouped selectors
- nav ul: descendants; nav>ul: direct children
- [type="email"]: attribute match
- :hover/:focus: pseudo-class states
- ::before: pseudo-element part
- Selector chooses declaration targets
- Selector ≠ color-setting property
👁 Full explanation
Type p selects paragraph elements, .notice selects a class, #logo an ID, h1,h2 groups selectors, nav ul selects descendants and nav>ul direct children. Attribute selectors match properties such as [type="email"], pseudo-classes states such as :hover/:focus, and pseudo-elements parts such as ::before. A selector chooses where declarations apply; it is not itself the property that sets a color.
11 related practice questions
Note references: WEB-M, WEB-N
- CSS attachment and syntax
WEB12
Resolve cascade, specificity and inheritance
[Exam Focus]- Cascade winner procedure
- Origin, importance, layer context first
- Then specificity and source order
- Same-origin/layer author context assumed
- ID>class/attribute/pseudo-class>type/pseudo-element
- Counts compared lexicographically
- Not unlimited base-ten total
- Equal specificity: later applicable rule
- Important beats normal within relevant context
👁 Full explanation
First compare applicable declarations in their cascade origin, importance and layer context; then compare specificity and order within the relevant context. In an ordinary same-origin/same-layer author example, an ID outweighs class/attribute/pseudo-class selectors, which outweigh type/pseudo-element selectors. Compare counts lexicographically, not as an unlimited base-ten total. Equally specific applicable rules use later source order. An important declaration outranks a competing normal declaration in that context. - Specificity, importance and inheritance
- p#intro.note example
- #intro blue beats .note red
- p green!important beats both normal rules
- Inherited color/fonts: no stronger specified value
- Margin/padding/border normally not inherited
- :not(): argument specificity
- Module universal-zero simplification incorrect
👁 Full explanation
For <p id="intro" class="note">, #intro{color:blue} beats .note{color:red}. A competing p{color:green!important} beats those normal declarations. Inherited color/fonts apply when the element lacks a stronger specified value; margin/padding/borders do not normally inherit. :not() contributes the specificity of its argument rather than universally zero.
Blueprint: WEB1, WEB3 · Note references: WEB-M, WEB-N, WEB-CSS
- Cascade winner procedure
WEB13
Style properties and box calculations
[Exam Focus]- CSS properties and box parts
- color: text; background-color: background
- font-size: size; font-family: face
- font-style: italic; font-weight: weight
- text-align: inline-content alignment
- text-decoration: underline effects
- Margin outside border
- Padding inside border
- Border surrounds content/padding
👁 Full explanation
color sets text color; background-color sets background; font-size size, font-family face, font-style italic, font-weight weight, text-align inline-content alignment, and text-decoration effects such as underline. Margin lies outside the border; padding lies inside; border surrounds content/padding. - Box-model calculations and relative units
- Content-box: width200,padding10,border2→224px
- Border-box width200→content176px
- Margins excluded from border-box width
- Shorthand: top/right/bottom/left
- One: all; two: vertical/horizontal
- Three: top/horizontal/bottom; four: each side
- Adjacent vertical block margins may collapse
- Padding never collapses
- Non-replaced inline width/height differs from blocks
- rem: root font size
- font-size em: parent font size
- Many other em lengths: element computed-font-size
👁 Full explanation
With content-box width200px, horizontal padding10px and borders2px, border-box width is224px, excluding margins. With border-box width200px, content width is176px. Shorthand values follow top/right/bottom/left: one applies everywhere, two vertical/horizontal, three top/horizontal/bottom, four each side. Adjacent vertical block margins can collapse rather than add; padding does not collapse. Non-replaced inline elements do not obey width/height like blocks. A 1rem length uses root font size; font-size in em uses parent font size, whereas many other em lengths use the element’s computed font size. - Historical body color attributes
- text: default text color
- bgcolor: background
- Modern CSS: color and background-color
👁 Full explanation
In historical markup, the body text attribute controlled default text color, while bgcolor controlled background. Current CSS uses color and background-color instead.
10 related practice questions
Blueprint: WEB3 · Note references: WEB-M, WEB-N
- CSS properties and box parts
WEB14
Layout, alignment and responsive design
[Exam Focus]- Flow, flex, grid and alignment
- Normal flow: blocks/inlines
- Flexbox: direct children, main axis
- justify-content: main; align-items: cross
- Horizontal row: vertical cross-axis alignment
- Grid: explicit rows and columns
- grid-template-columns:1fr 2fr
- vertical-align: inline/table-cell contexts
- vertical-align ≠ universal block centering
- align-content: extra-space track/line distribution
- align-content ≠ arbitrary single-child centering
👁 Full explanation
Normal flow lays out blocks/inlines. Flexbox arranges direct children on a main axis; justify-content follows that axis, align-items the cross axis. With row direction in ordinary horizontal writing, cross-axis alignment is vertical. Grid organizes rows and columns with explicit tracks, such as grid-template-columns:1fr 2fr. vertical-align applies to inline/table-cell contexts and does not center every block. align-content distributes tracks/lines when there is applicable extra space, not arbitrary single-child centering. - Positioning and responsive design
- Relative: offset, retained flow space
- Absolute: removed from flow, containing block
- Positioned ancestor often establishes containing block
- Fixed: commonly viewport
- Flexible layout/images; viewport metadata; media queries
- @media(max-width:600px){.cards{grid-template-columns:1fr}}
- min-width768px: wider viewports, not mobile-only
- Compatibility: feature tests and fallbacks
- Compatibility ≠ responsive size handling
👁 Full explanation
Relative positioning offsets a box while retaining its flow space; absolute removes it and uses its containing block, often established by a positioned ancestor; fixed commonly uses the viewport. Responsive design combines flexible layout, images, viewport metadata and media queries, for example @media(max-width:600px){.cards{grid-template-columns:1fr}}. A min-width768px query targets wider viewports, not mobile alone. Browser compatibility requires feature testing and fallbacks; responsive size handling is a different issue.
7 related practice questions
Blueprint: WEB1, WEB3 · Note references: WEB-M, WEB-N
- Flow, flex, grid and alignment
WEB15
JavaScript syntax, inclusion and declarations
- JavaScript inclusion and language identity
- External .js: <script src="app.js"></script>
- JavaScript source: no HTML closing-tag syntax
- defer: after parsing, before DOMContentLoaded
- Originated at Netscape; distinct from Java
- Prototype-based objects; first-class functions
- Sophisticated applications supported
👁 Full explanation
Use <script src="app.js"></script> for an external .js file; script content has no HTML closing-tag syntax inside its JavaScript source. A deferred script runs after parsing and before DOMContentLoaded. JavaScript originated at Netscape; it is distinct from Java and supports sophisticated applications through prototype-based objects and first-class functions. - JavaScript lexical and declaration rules
- Case-sensitive identifiers
- Initial letter/underscore/$; no digits/spaces
- var: function/global scope
- let/const: block scope
- const: no rebinding, object mutation allowed
- // line comments; /* */ blocks
- Semicolons and automatic insertion
- Newlines can affect parsing after return
- "use strict": directive string, not keyword
- Parse syntax before output computation
👁 Full explanation
Identifiers are case-sensitive and may start with letters, underscore or $, not digits or spaces. var has function/global scope; let/const are block-scoped. const prevents rebinding but not mutation of an object’s contents. // comments end at line end; /* */ span a block. Semicolons delimit statements, although automatic insertion exists. Whitespace usually separates tokens but newlines can affect parsing, especially after return. “use strict” is a directive string, not a reserved statement keyword. Parse syntax before computing outputs.
14 related practice questions
Note references: WEB-M, WEB-N
- JavaScript inclusion and language identity
WEB16
Types, conversions and missing values
- JavaScript value categories
- Primitives: undefined,null,Boolean,Number,BigInt,String,Symbol
- Objects: arrays, functions, dates
- Float not separate Number primitive
- Arrays technically objects
- typeof new Date()→"object"
- typeof null→"object": historical behavior
👁 Full explanation
JavaScript primitives are undefined, null, Boolean, Number, BigInt, String and Symbol; objects include arrays, functions and dates. Float is not a separate Number primitive type. Arrays are objects, even though informal texts call them an array data type. typeof new Date() is "object"; typeof null is historically "object". - Missing values and conversion
- Declared unassigned/missing ordinary property→undefined
- Undeclared direct read→usually ReferenceError
- Either string quote style; appropriate escapes
- String-involved + may concatenate
- Arithmetic / converts numeric strings
- "abc"/"def"→NaN
- Nonzero Number/0→signed Infinity; 0/0→NaN
- parseInt("12.8",10)→12, stops at dot
- Parsing ≠ rounding
- Global isNaN converts first
- Number.isNaN does not coerce
👁 Full explanation
An unassigned declared variable or missing ordinary object property evaluates to undefined; directly reading an undeclared variable usually throws ReferenceError. Strings use either quote style, with appropriate escaping. + can concatenate when a string is involved; arithmetic / converts ordinary numeric strings. "abc"/"def" produces NaN; nonzero Number divided by zero produces signed Infinity, while 0/0 produces NaN. parseInt("12.8",10) reads12, stopping at the dot; this is parsing, not rounding. Global isNaN converts first; Number.isNaN does not.
11 related practice questions
Note references: WEB-M, WEB-N, WEB-TYPES
- JavaScript value categories
WEB17
Trace assignments, comparisons and postfix updates
[Exam Focus]- Operator tracing
- Record value and type
- Specified evaluation order
- ==/!=: coercion
- ===/!==: no coercion
- Strict operators coexist with loose operators
- condition?x:y selects one branch
👁 Full explanation
Evaluate operators in their specified order and write down both value and type. JavaScript has ==/!= with coercion and ===/!== without coercion; strict operators do not replace or remove the loose ones. A condition ? x : y chooses one branch. - Assignment, concatenation and postfix microtraces
- var a="20";var b=a=30
- Both Number30; a+b=60
- Supplied key50 incorrect
- "1 plus 1 is "+1+1
- Left-to-right result: "1 plus 1 is 11"
- Postfix a++ yields old value
- Increment follows yielded value
- a=10;a==a++→10==10;body sees11
- a=1;print a-- then a→10
- JS sequencing not portable to C/C++
- C/C++ unsequenced modifications trap
👁 Full explanation
var a="20"; var b=a=30; assigns Number 30 to both, so a+b is 60, not 50. "1 plus 1 is "+1+1 concatenates left to right to "1 plus 1 is 11". Postfix a++ yields the old value and then increments a. If a=10, a==a++ compares10 with10, then the body sees11. With a=1, printing a-- then a prints10. These JS evaluation rules are not portable to C/C++ expressions with unsequenced modifications.
8 related practice questions
Blueprint: WEB2 · Note references: WEB-M, WEB-N, WEB-EQ, WEB-INC
- Operator tracing
WEB18
Math, string and array API microtraces
- Math and substring traces
- Math.abs(-9)=9
- Math.floor(5.9)=5
- Math.sqrt(36)=6
- Zero-based indexes
- substring(start,end): start inclusive, end exclusive
- "exitexam".substring(2,6)→"itex"
👁 Full explanation
Math.abs(-9)=9, Math.floor(5.9)=5, and Math.sqrt(36)=6. A JS string’s substring(start,end) includes start and excludes end: "exitexam".substring(2,6) is "itex". Indexes start at zero. - Array operations and reduction
- push/pop: end; unshift/shift: beginning
- slice: selected shallow copy
- splice(start,deleteCount,...items): mutating removal/insertion
- reverse: in-place reversal
- reduce: sequential left-to-right accumulator
- reduceRight: sequential right-to-left, not parallel
- [1,2,3].reduceRight((a,v)=>a-v,0)
- Accumulators: −3,−5,−6
- No initial value: last present item
- Empty without initial value: throws
- Exact method spelling and case
👁 Full explanation
Array push/pop add/remove at the end; unshift/shift act at the beginning. slice returns a selected shallow copy; splice(start,deleteCount,...items) mutates by removal/insertion. reverse reverses in place. reduce combines sequentially from left to right; reduceRight combines sequentially from right to left with an accumulator, not simultaneous parallel execution. For [1,2,3].reduceRight((a,v)=>a-v,0), accumulator values are -3,-5,-6. An absent initial value uses the last present item first; an empty array without one throws. Method spelling and case matter.
6 related practice questions
Note references: WEB-M, WEB-N, WEB-ARR, WEB-MATH, WEB-SUBSTR
- Math and substring traces
WEB19
Control flow, functions and errors
[Exam Focus]- Loop execution order
- for: initialize once→test→body→update
- while: pretest
- do...while: at least one execution
- break exits; continue advances iteration
- n=1;n<7;n++ with n%5==0
- Message only at n=5
👁 Full explanation
for(initialization;test;update) initializes once, checks before each iteration, then updates after each body. while checks before its body; do...while executes at least once. break exits and continue advances to the next iteration. A loop from n=1 while n<7 prints a message only at n=5 when testing n%5==0. - Functions and error handling
- function f(x){return x*2;}
- Parameter; return value; stored/passed functions
- Arrow: compact, different this/constructor behavior
- Runtime argument limits reject absolute unlimited claim
- try/catch: thrown runtime errors
- throw: signal; finally: cleanup
- Syntax versus runtime versus logical errors
- bool ans=true invalid; let ans=true valid
- Literal "type of" ≠ typeof operator
👁 Full explanation
function f(x){return x*2;} has a parameter and returns a value; functions can be passed/stored like other values. Arrow syntax is compact but differs in this/constructor behavior. Runtime argument limits mean “no limit whatsoever” is too absolute. try/catch handles thrown errors during execution; throw signals one; finally runs cleanup. Parse-time syntax errors and logical errors are different. bool ans=true is not JavaScript declaration syntax; use let ans=true. A literal type of expression is not the typeof operator.
8 related practice questions
Blueprint: WEB2 · Note references: WEB-M, WEB-N
- Loop execution order
WEB20
DOM selection, creation and safe updates
[Exam Focus]- DOM selection and timing
- DOM: hierarchical document nodes
- getElementById("x"): element or null
- querySelector(".item"): first match
- querySelectorAll: static NodeList
- Other plural lookups may be live
- Guard missing elements
- Run after relevant markup exists
👁 Full explanation
The DOM is a hierarchy of nodes representing the document. document.getElementById("x") returns the matching element or null; querySelector(".item") returns the first match, and querySelectorAll returns a static NodeList. Other plural lookup methods can return live collections. Guard missing elements and run code after the relevant markup exists. - DOM creation, attachment and safe mutation
- createElement("div")→textContent="Hello"→appendChild(el)
- Creation alone does not insert
- createTextNode: text; appendChild: attachment
- innerHTML parses/replaces descendants
- innerHTML+= reparses/replaces previous descendants
- Listener/state destruction possible
- Untrusted plain text: textContent
- style.backgroundColor: style property
- classList.add: class mutation
- getElementByld: lowercase-l misspelling, nonexistent method
👁 Full explanation
To add a div: const el=document.createElement("div"); el.textContent="Hello"; document.body.appendChild(el);. Creation alone does not insert it. createTextNode makes text; appendChild attaches an existing node. innerHTML parses/replaces descendants, so += reparses/replaces the prior descendant content too and can destroy listeners/state. Use textContent for untrusted plain text. element.style.backgroundColor sets a style property; classList.add changes a class. getElementByld with a lowercase l replacing I is a different, nonexistent method.
6 related practice questions
Blueprint: WEB2 · Note references: WEB-M, WEB-N
- DOM selection and timing
WEB21
Events and validated submission
[Exam Focus]- Events and listener options
- Events: click,input,keydown,mouseover,submit,load
- addEventListener("click",handler): register, not call
- Multiple listeners coexist
- once: remove after use
- capture: earlier propagation phase
- passive: promise no default cancellation
- Event bubbling ≠ browser default action
👁 Full explanation
An event handler runs when an event occurs: click, input, keydown, mouseover, submit and load are examples. addEventListener("click",handler) registers a function without calling it immediately. Multiple listeners may coexist; once removes one after use, capture selects an earlier propagation phase and passive promises no default cancellation. Event bubbling is distinct from the browser’s default action. - Submission validation and cancellation
- submit listener checks valid()
- Failure only: e.preventDefault()
- addEventListener return false does not cancel
- Inline/onsubmit return false: caller-dependent cancellation
- Cancelable keyboard default: preventDefault
- Different key event need not disappear
- Browser checks: feedback
- Repeat validation/authorization server-side
👁 Full explanation
For submission, form.addEventListener("submit",e=>{if(!valid()){e.preventDefault();}}) stops the default only on failure. Returning false from an addEventListener callback does not cancel it; return false works in an appropriate inline/onsubmit property handler whose caller uses that return. For cancelable keyboard defaults, call preventDefault rather than assuming a different key event itself disappears. Browser checks improve feedback; repeat validation and authorization on the server.
5 related practice questions
Blueprint: WEB2, WEB4 · Note references: WEB-M, WEB-N, WEB-EVENT
- Events and listener options
WEB22
Window, dialogs and browser properties
- Window, dialogs and browser properties
- window: browsing context; document: document property
- alert: information; confirm: Boolean
- prompt: text or cancellation null
- console.log: diagnostics
- location.reload(): current-page reload
- screen.availHeight; screen.availWidth; screen.colorDepth
- Exact camelCase; ColorsDepth invalid
👁 Full explanation
In a normal browser page, window exposes the browsing context and document is its document property. alert displays information, confirm returns a Boolean, and prompt requests text or returns null on cancellation. console.log logs diagnostics. location.reload() reloads the current page. screen.availHeight, screen.availWidth and screen.colorDepth have exact camelCase spelling; ColorsDepth is not the property. - Globals, load and document hazards
- window.onload: load-handler property
- Load typically waits dependent resources
- Global let/const not window properties
- Classic top-level var bindings differ
- document.write: method/function property
- Post-load write may replace document
- document.bgColor: legacy property
- Document.bgcolor: wrong object/case
- Modern: document.body.style.backgroundColor
- Workers: concurrent computation
- DOM normally page main thread
👁 Full explanation
window.onload is a handler property for the load event, typically after dependent resources finish. Global let/const are not window properties like classic top-level var bindings. document.write is a method/function property; writing after document load can replace the document. document.bgColor is a legacy property; Document.bgcolor has wrong object/case. Use document.body.style.backgroundColor for current styling. Browser workers support concurrent computation, but DOM access normally remains on the page’s main thread.
10 related practice questions
Note references: WEB-M, WEB-N, WEB-SCREEN
- Window, dialogs and browser properties
WEB23
PHP syntax, names and types
- PHP syntax and legacy delimiters
- PHP: Hypertext Preprocessor
- .php file; <?php ... ?>
- Final closing tag optional
- Emits ordinary text and HTML
- PHP8 rejects <script language="PHP"> delimiters
- Short <? configuration-dependent
- Prefer full opening form
- Stray >> not closing tag
👁 Full explanation
PHP means PHP: Hypertext Preprocessor. Use <?php ... ?> in a .php file; a closing tag can be omitted at file end. It can emit ordinary text and HTML. PHP8 no longer accepts historical <script language="PHP"> delimiters; short <? depends on configuration, so use the full form. A stray >> is not a closing PHP tag. - PHP variables, types and constants
- $ then letter/underscore
- Subsequent letters/digits/underscores
- $AGE18 valid; $18AGE invalid
- Case-sensitive variable names
- Dynamic typing; optional type constraints
- Scalars: int,float,string,bool
- Structured: arrays/objects; null: no value
- var_dump: type and value
- Constants normally not redefined during execution
👁 Full explanation
Variables begin with $, then a letter/underscore and subsequent letters/digits/underscores; $AGE18 works but $18AGE does not. Names are case-sensitive. Dynamic typing permits values of different types without a preceding type declaration, though optional declarations can constrain them. Scalars include int,float,string,bool; arrays/objects are structured values and null means no value. var_dump displays type and value. Constants cannot normally be redefined during execution.
14 related practice questions
Note references: WEB-M, WEB-N
- PHP syntax and legacy delimiters
WEB24
PHP output, strings and comparisons
- PHP output and concatenation
- echo: language construct, no return
- echo: comma-separated expressions
- print: one expression, returns1
- printf/print_r: other output mechanisms
- Neither inserts spaces/newlines automatically
- print5 twice→55
- "I"."am"→Iam
- Dot concatenates; + arithmetic
👁 Full explanation
echo is a language construct with no return value and can emit comma-separated expressions. print takes one expression and returns1. They are two basic output constructs, not the only output mechanisms; printf, print_r and others exist. Neither automatically inserts spaces/newlines. Two prints of5 emit55; "I"."am" emitsIam. Dot concatenates; + is arithmetic. - PHP string and comparison traces
- Double quotes: variables and escapes
- Single quotes: dollar names normally literal
- Literal $lfc: single quotes/escaped dollar
- Zero-based offset: "maroon"[2]→r
- Surrounding PHP must be valid
- strlen: bytes
- strpos: integer0 or false
- Failure test: ===false
- strrev: reverse bytes; str_replace: replace matches
- 8==8.0 true; 8===8.0 false
- echo false→empty; echo true→1
👁 Full explanation
Double-quoted strings interpolate variables and escapes such as \n; single quotes normally preserve dollar names literally. To emit literal $lfc use echo '$lfc'; or escape the dollar in double quotes. String offsets start at zero: "maroon"[2] is r when the surrounding PHP is valid. strlen counts bytes; strpos can return integer0 or false, requiring ===false for failure. strrev reverses bytes and str_replace replaces matching content. PHP 8==8.0 is true, but 8===8.0 is false because types differ; echo false emits an empty string, echo true emits1. - Raw versus rendered PHP output
- PHP sends markup characters
- Browser interprets response
- echo "A<br>B": raw tag, displayed lines
- Malformed </br>: HTML error recovery
- Specify raw versus rendered trace
👁 Full explanation
PHP sends markup as response characters; a browser then interprets it. echo "A<br>B" emits a tag in raw output but normally displays two text lines. The invalid </br> markup depends on HTML error recovery, so specify raw versus rendered output.
15 related practice questions
Note references: WEB-M, WEB-N, WEB-PHPS, WEB-PHPO
- PHP output and concatenation
WEB25
PHP scope, parameters and persistent locals
[Exam Focus]- PHP scope and static storage
- Outside variable: global scope
- Function locals/by-value parameters: separate bindings
- Explicit global $x or $GLOBALS["x"]
- Superglobals available across scopes
- Static local persists across lifecycle calls
- Static storage ≠ merely visibility scope
- Uninitialized static local: null
- Echo uninitialized static: no characters
👁 Full explanation
A variable outside a function has global scope. A function’s locals and by-value parameters are separate bindings; use global $x or $GLOBALS["x"] to refer to a global explicitly. Superglobals are available across scopes. A static local retains its value across calls during the execution lifecycle; static storage is not simply another visibility scope. An uninitialized static local begins as null, so echo emits no characters. - Parameter and static-counter traces
- Global $i=10; sample($i) by value
- Function increments/prints local parameter
- Caller remains10
- Before,during,after→10,11,10
- Commas only when source writes them
- External global declaration ≠ reference parameter
- Teaching taxonomy: local,global,static
- Static counter0; successive increments→1,2
👁 Full explanation
If global $i=10 and sample($i) increments/prints its by-value parameter, the caller’s $i stays10. Printing before, during and after gives10,11,10 when commas are written by the source. A global statement outside the function does not turn its value parameter into a reference. Common “three scopes” teaching counts local, global and static, but state the taxonomy. A static counter initialized0 then incremented on each call emits1 then2.
7 related practice questions
Blueprint: WEB2 · Note references: WEB-M, WEB-N, WEB-PHPSC
- PHP scope and static storage
WEB26
PHP arrays, loops and callable behavior
[Exam Focus]- PHP array keys and syntax
- Integer/string keys map to values
- Unspecified numeric indexes start0
- [20,12,23,19,18]: index3→19
- ["top"=>"black"]: top→black
- Contiguous => required
- Split = >: parse error
👁 Full explanation
PHP arrays map integer/string keys to values. Numeric arrays start at index0 unless keys are supplied: [20,12,23,19,18] has19 at index3. Associative syntax uses a contiguous => operator: ["top"=>"black"] stores black under key"top". Splitting it as = > is a parse error, not valid array syntax. - PHP loops and dynamic behavior
- foreach($items as $key=>$value): entries
- for/while: tests and updates
- $sub-=$sub means $sub=$sub-$sub
- Self-subtraction ≠ decrement
- $sum=0;foreach([2,4]) accumulation→6
- Functions: arguments, return, output
- Classes/objects/variables also support server processing
- No single mechanism defines dynamic PHP
- Explicit braces clarify nesting
👁 Full explanation
foreach($items as $key=>$value) iterates entries; for and while use tests/updates much like the corresponding JS forms. $sub-=$sub is $sub=$sub-$sub, not decrement. For $sum=0; foreach([2,4] as $v){$sum+=$v;} the result is6. A function can receive arguments, return a value, or produce output; classes/objects/variables also support server processing, so no single one of these mechanisms alone defines “dynamic PHP.” Use braces to make nesting explicit.
4 related practice questions
Blueprint: WEB2 · Note references: WEB-M, WEB-N
- PHP array keys and syntax
WEB27
Request data, server validation and injection
[Exam Focus]- PHP request sources and existence
- $_GET: query; $_POST: supported form POST
- $_FILES: upload metadata
- $_SERVER: request/environment
- $_COOKIE: received cookies
- $_SESSION: session data after startup
- $GLOBALS: global-symbol array
- $_GLOBAL: not built-in
- $_REQUEST: configured GET/POST/cookie combination
- Ambiguous precedence; prefer intended source
- $_REQUEST ≠ database interface
- isset: exists and non-null
- isset ≠ truth or valid syntax
👁 Full explanation
$_GET contains query parameters; $_POST contains supported form POST data; $_FILES upload metadata; $_SERVER request/environment details; $_COOKIE cookie values; $_SESSION session data after startup. $GLOBALS is the actual global-symbol array; $_GLOBAL is not the built-in name. $_REQUEST may combine GET/POST/cookie data according to configuration; it is not a database interface and has ambiguous precedence, so prefer the intended source. isset tests existence and non-null, not truth or valid syntax. - Secure request-processing sequence
- Read→required/type/length/range checks
- Authenticate→authorize→process
- SQL binding separates values from commands
- Contextual HTML/attribute/JS output encoding
- textContent for browser plain text
- Injection/XSS testing detects, never itself fixes
- Client validation/encryption/connection cannot replace controls
👁 Full explanation
Read input, check required fields/type/length/range, authenticate and authorize, then process. Bind SQL parameters to keep values separate from commands. Encode output for HTML/attribute/JS context; textContent handles plain browser text. A security test can detect SQL injection or XSS but does not itself fix either. Client validation, encryption and a database connection do not replace these controls.
10 related practice questions
Blueprint: WEB2, WEB4 · Note references: WEB-M, WEB-N
- PHP request sources and existence
WEB28
Cookies and browser storage
[Exam Focus]- Cookies and PHP headers
- Browser-held name/value data
- Automatic attachment only to matching requests
- Domain; path; expiry; Secure; SameSite
- HttpOnly: restricted script access
- Secure: secure transport required
- Cookies not indiscriminately sent everywhere
- setcookie sends response header
- Before output unless buffering defers output
- $_COOKIE: received values
👁 Full explanation
Cookies are browser-held name/value data automatically attached to matching requests subject to domain, path, expiry, Secure and SameSite rules. HttpOnly restricts script access; Secure requires secure transport. They are not attached to every site indiscriminately. PHP setcookie sends a response header, so set it before output unless buffering correctly defers output; $_COOKIE reflects received cookies. - Browser storage and session interpretation
- localStorage: origin-specific strings, persistent until cleared
- sessionStorage: page session/tab scope
- Neither automatically transmitted like cookies
- Scripts can explicitly send stored values
- IndexedDB: structured local storage
- Cookies/localStorage/sessionStorage/IndexedDB: client storage
- localStorage tokens: script-access risk
- Storage limits vary
- Reopen login: persistent/remember token or restoration
- Stored data alone ≠ server acceptance
👁 Full explanation
localStorage persists origin-specific string values across sessions until removed/cleared; sessionStorage is scoped to a page session/tab. Neither is automatically transmitted like matching cookies, but JavaScript can send stored data explicitly. IndexedDB supplies structured local storage. Thus all four are client storage techniques, and localStorage can participate in token-based session designs, with script-access risks. Storage size limits vary. Being logged in after reopening may use a persistent session/remember token or browser restoration; storage alone does not prove server acceptance.
5 related practice questions
Blueprint: WEB3 · Note references: WEB-M, WEB-N, WEB-STORE
- Cookies and PHP headers
WEB29
Server sessions and the authorization trust path
[Exam Focus]- PHP server-session lifecycle
- session_start(): start/resume, enable $_SESSION
- Browser: opaque session identifier
- Session data: server-controlled storage
- Missing views→1; later requests increment
- unset: one entry
- Destroyed session data ≠ cleared browser cookie
- Current variables separately cleared
- Logout handles complete lifecycle
👁 Full explanation
session_start() starts/resumes PHP session handling and makes $_SESSION available. Normally the browser holds an opaque session identifier while data resides in server-controlled storage. A counter initializes missing $_SESSION["views"] to1 and increments on later requests. unset removes one entry; destroying stored session data is distinct from clearing the browser cookie/current variables, so logout must handle the full lifecycle. - Session authorization trust path
- Client logged_in=1 cookie: attacker-controlled
- Flag-only trust permits authorization bypass
- Valid session ID plus server user/role
- Check every protected action
- Unrelated flag edit grants no rights
- HTTPS ≠ trustworthy client claims
- Omitted server check: scenario indeterminate
- Protect IDs; regenerate after login
- Appropriate expiration; no sensitive URL tokens
👁 Full explanation
A client cookie logged_in=1 is attacker-controlled. If the server trusts it alone, authorization can be bypassed. If the server checks a valid session ID and its server-side user/role on every protected action, editing that unrelated flag does not grant rights. HTTPS does not make client-generated claims trustworthy. Determine which server-side check is performed before judging whether a session-handling design is secure or vulnerable. Protect session IDs, regenerate after login, expire appropriately and avoid putting sensitive tokens in URLs.
7 related practice questions
Blueprint: WEB2, WEB3, WEB4 · Note references: WEB-M, WEB-N
- PHP server-session lifecycle
WEB30
Uploads, files and storage safety
[Exam Focus]- Secure upload workflow
- POST; multipart/form-data; named file input
- accept: browser hint, not server enforcement
- Validate server-side size/content
- Inspect upload errors
- Use temporary upload path
- Safe generated destination; move_uploaded_file
- Avoid executable storage
- Distrust client filenames/extensions
👁 Full explanation
Uploads ordinarily use method="post", enctype="multipart/form-data" and a named file input. accept hints to the browser which file types to offer; it does not enforce the server’s policy. Validate server-side size/content, inspect upload errors, use the temporary upload path, choose a safe generated destination and use move_uploaded_file. Avoid executable storage and trusting a client filename/extension. - File APIs and mode traces
- file_exists: file or directory
- is_file: regular file
- fopen: stream or false
- r: existing read; r+: read/write, untruncated
- w: truncate/create write; w+: also read
- a: append/create; x: exclusive creation
- fclose: release stream
- readfile: emit content, return byte count
- echo readfile(...): also prints count
- Check failures before access
- Constrain paths to permitted locations
👁 Full explanation
file_exists tests files or directories; is_file narrows to regular files. fopen returns a stream or false: r reads an existing file, r+ reads/writes without truncation, w truncates/creates for writing, w+ adds reading, a appends/creates, and x exclusively creates. fclose releases it. readfile emits content and returns a byte count, so echo readfile(...) also prints that count. Check failures before reading/writing and constrain paths to permitted locations.
2 related practice questions
Blueprint: WEB2, WEB3 · Note references: WEB-M, WEB-N, WEB-INPUT
- Secure upload workflow
WEB31
Database connections, TLS and actual APIs
[Exam Focus]- PHP database connections
- MySQL: relational DBMS
- Persistent structured data; concurrent clients
- PHP8: MySQLi or PDO
- Removed mysql_* extension requires migration
- mysqli_connect(host,user,password,database,port,socket)
- Database selection may be deferred
- Defaults make multiple arguments technically optional
- Exactly-one-optional-field claim incorrect
👁 Full explanation
MySQL is a relational DBMS; a database persists structured application data and supports concurrent clients. PHP8 uses MySQLi or PDO; the old mysql_* extension was removed, so migrate older snippets to a supported API. mysqli_connect(host,user,password,database,port,socket) opens a connection; selecting a database can be deferred, and defaults make several arguments technically optional. Do not reduce the full signature to exactly one optional field. - Database TLS and API signatures
- MySQLi: mysqli_init()→mysqli_ssl_set(...)→mysqli_real_connect(...)
- Required verification configuration
- Nonstandard: mysqli_ssl_connect(); pdo_connect_ssl()
- Nonstandard: mysql_ssl_connect(); secure_connect()
- PDO: driver DSN/options
- Procedural MySQLi, object methods, PDO differ
- affected_rows() alone not generic PHP function
👁 Full explanation
Configure MySQLi TLS options through mysqli_init(), mysqli_ssl_set(...) and mysqli_real_connect(...) with the required verification configuration. mysqli_ssl_connect(), pdo_connect_ssl(), mysql_ssl_connect() and secure_connect() are not substitutes for the MySQLi TLS configuration sequence above. PDO uses an appropriate driver DSN/options instead. MySQLi procedural functions, object methods and PDO methods have distinct signatures; affected_rows() alone is not a generic PHP function.
5 related practice questions
Blueprint: WEB2, WEB4 · Note references: WEB-M, WEB-N, WEB-SSL, WEB-AFFECT
- PHP database connections
WEB32
SQL operations, result rows and safe rendering
[Exam Focus]- SQL operations and identifier generation
- SELECT retrieves; INSERT adds
- UPDATE ... SET modifies; DELETE removes
- WHERE limits matching/affected rows
- DELETE without WHERE: ordinarily all rows
- Constraints, permissions, errors still apply
- CREATE DATABASE/TABLE: storage definitions
- Primary key identifies rows
- AUTO_INCREMENT: numeric values, gaps/explicit values possible
- Not gapless business numbering
👁 Full explanation
SELECT retrieves rows; INSERT adds; UPDATE ... SET changes values; DELETE removes rows. WHERE limits affected/matching records; omitting it from DELETE ordinarily targets every row, subject to constraints, permissions and errors. CREATE DATABASE/TABLE defines storage; a primary key identifies rows. AUTO_INCREMENT generates numeric values but gaps and explicit values are possible; do not promise gapless consecutive business numbering. - MySQLi results and safe rendering
- mysqli_query: result object for result queries
- Other successful statements: true
- Failure/exception depends on settings
- mysqli_fetch_assoc: associative rows
- mysqli_fetch_row: positional; mysqli_fetch_object: objects
- mysqli_num_rows: result-row count
- mysqli_affected_rows($conn): changed/inserted/deleted, options-dependent
- mysqli_insert_id($conn): generated AUTO_INCREMENT value
- Escape rendered cells; prepare submitted values
- mysqli_close: connection close
👁 Full explanation
mysqli_query returns a result object for successful result-producing queries, true for other successful statements, or failure/exception depending on settings. Fetch associative rows with mysqli_fetch_assoc, positional rows with mysqli_fetch_row, or objects with mysqli_fetch_object. mysqli_num_rows counts a result’s rows; mysqli_affected_rows($conn) counts changed/inserted/deleted rows under its options; mysqli_insert_id($conn) reports a generated AUTO_INCREMENT value from the connection. Escape rendered cell text; use prepared statements for submitted values; mysqli_close closes the connection.
9 related practice questions
Blueprint: WEB2, WEB3, WEB4 · Note references: WEB-M, WEB-N, WEB-AFFECT
- SQL operations and identifier generation
WEB33
PHP includes, objects and dates
[Exam Focus]- PHP includes and version-dependent failure
- include: current-scope evaluation; failure warning
- require: critical failure
- PHP8 failed require raises catchable Error
- Uncaught Error stops normal execution
- E_COMPILE_ERROR description: older PHP
- include_once/require_once: no repeated inclusion
- No arbitrary user-selected include path
👁 Full explanation
include evaluates another file in the current scope and warns on failure; require fails critically. In PHP8 a failed require raises Error, which can be caught; uncaught it stops normal execution. The source’s E_COMPILE_ERROR description belongs to older PHP. include_once/require_once avoid repeated inclusion. Do not include a user-selected arbitrary path. - Objects and explicit time assumptions
- Class: properties/methods; new: instance
- $obj->field: property; $obj->method(): call
- public: external; private: class-restricted
- Constructor initializes instance
- $this: instance-method context
- DateTime/DateTimeZone: time and zone
- diff→DateInterval; DatePeriod iterates intervals
- Explicit zones and calendar assumptions
- Do not assume server-local timezone
👁 Full explanation
A class defines properties/methods; new creates an object, $obj->field accesses a property, and $obj->method() calls a method. public is externally accessible, private is class-restricted, and a constructor initializes an instance. Use $this inside instance methods. DateTime/DateTimeZone represent time and zone; diff returns a DateInterval and DatePeriod iterates intervals. Time calculations require explicit zones and calendar assumptions, not an assumed server-local timezone.
1 related practice question
Blueprint: WEB2 · Note references: WEB-M, WEB-N, WEB-PHPR
- PHP includes and version-dependent failure
WEB34
AJAX and response handling
[Exam Focus]- AJAX and XHR workflow
- Asynchronous JavaScript and XML
- Responses: JSON,text,HTML,XML
- Technique, not language/standalone framework
- XML not mandatory
- open("GET",url,true)→register handlers→send()
- Response and error handlers
- onreadystatechange may fire repeatedly
- readyState4: completed
- Then check status and data
👁 Full explanation
AJAX means Asynchronous JavaScript and XML, but responses can be JSON, text, HTML or XML. It is a technique, not a language, standalone framework or mandatory XML protocol. Configure an XHR with open("GET",url,true), register response/error handlers and call send(). onreadystatechange may run several times; readyState4 means completion, after which status and data must be checked. - Callbacks, fetch and response ordering
- Callback: runtime/API-invoked later function
- Browser invokes available-response handler
- Remote server never directly executes browser code
- await fetch(url)→response
- Check response.ok; await response.json()
- Handle network and parse errors
- Asynchronous result unavailable to immediate next statement
- Older late response must not overwrite newer
👁 Full explanation
A callback is a function invoked later by the runtime/API. The browser invokes its response handler when the response is available; the remote server does not directly execute browser code. With fetch, await fetch(url) obtains a response, then check response.ok and parse await response.json(). Handle network/parse errors. Starting an asynchronous operation does not make its result synchronously available to the next statement. Avoid overwriting a newer search result with an older response that arrives late.
4 related practice questions
Blueprint: WEB2, WEB4 · Note references: WEB-M, WEB-N
- AJAX and XHR workflow
WEB35
Polling, WebSockets and data formats
[Exam Focus]- Polling versus WebSocket
- Short polling: repeated update requests
- Long polling: hold request until event/timeout
- Respond, finish, then client reconnects
- Long polling ≠ same-response continuous unsolicited stream
- WebSocket: handshake then persistent bidirectional messages
- AJAX/WebSocket both allow nonblocking interaction
- Both carry JSON; broad stems nonexclusive
👁 Full explanation
Short polling repeatedly requests updates. Long polling holds one client request until an event or timeout, returns a response, then the client reconnects; it is not continuous unsolicited streaming on that same finished response. WebSocket establishes a persistent bidirectional message channel after its handshake. Either HTTP-based AJAX or WebSockets can support nonblocking user interaction and carry JSON, so generic questions may be nonexclusive. - Formats and transport decisions
- JSON: objects,arrays,strings,numbers,Booleans,null
- Double-quoted keys/strings
- Functions/undefined not JSON values
- XML: valid interchange alternative
- REST can return JSON or XML
- Select latency, direction, connection cost, recovery
- Asynchronous alone insufficient transport criterion
- Validate messages; authorize each operation
👁 Full explanation
JSON represents objects, arrays, strings, numbers, Booleans and null; keys/strings use double quotes, and functions/undefined are not JSON values. XML is another valid interchange format. A REST API can return either. Select transport by latency, direction, connection cost and recovery requirements, not merely the occurrence of “asynchronous.” Validate incoming messages and enforce authorization per operation.
6 related practice questions
Blueprint: WEB4 · Note references: WEB-M, WEB-N
- Polling versus WebSocket
WEB36
Node server, event loop and scaling
[Exam Focus]- Minimal CommonJS Node HTTP server
- const http=require("node:http")
- http.createServer((req,res)=>{...}).listen(8000)
- Incoming requests invoke listener
- res.writeHead(200,{"Content-Type":"text/plain"})
- res.end("Hello"): complete response
- Define startup-log variables
- Module hostname otherwise undefined
👁 Full explanation
A minimal CommonJS Node server can use const http=require("node:http"); http.createServer((req,res)=>{res.writeHead(200,{"Content-Type":"text/plain"});res.end("Hello");}).listen(8000);. The request listener runs for incoming requests; end completes the response. Define every variable used in startup logging, including hostname, before using it. - Event-loop concurrency and scaling
- Event loop schedules JavaScript callbacks
- OS/worker facilities: asynchronous work
- Concurrency: overlapping progress
- Parallelism: same-instant execution
- One loop thread handles waiting requests
- Long CPU loops/synchronous I/O block callbacks
- Workers/processes/load balancer distribute work
- Shared data/session coordination not automatic
- Multiple clients or overlapping single-client requests
👁 Full explanation
Node schedules JavaScript callbacks through an event loop and uses OS/worker facilities for asynchronous work. Concurrency means overlapping progress; parallelism means execution at the same instant. One event-loop thread can handle many waiting requests, but long CPU loops or synchronous I/O block its callbacks. Workers/processes and a load balancer distribute work across server instances; they do not automatically coordinate shared data or session state. Multiple clients, or one client with overlapping requests, can both create concurrency.
2 related practice questions
Blueprint: WEB4 · Note references: WEB-M, WEB-N, WEB-NODE
- Minimal CommonJS Node HTTP server
WEB37
Races, locks and transaction invariants
[Exam Focus]- Race conditions and synchronization
- Two requests read stock1
- Both accept sale and write0
- Two sales consume one item
- Interleaving-dependent correctness despite short synchronous callbacks
- Mutex: critical-section protection
- Semaphore: bounded access
- Spinlock: busy-wait
- Spinlocks unsuitable for browser/event-loop blocking
- Several mechanisms synchronize; mutex not unique
👁 Full explanation
Suppose two requests read a stock count1, both decide it is available and both write0: two sales consumed one item. Correctness depends on interleaving, even if each callback has only a short synchronous body. A mutex protects one critical section; semaphores can coordinate bounded access; spinlocks busy-wait and are unsuitable for blocking a browser/event-loop thread. Several listed mechanisms can synchronize, so mutex is not the only possible answer. - Database invariants and retry safety
- Atomic conditional stock decrement
- UPDATE stock SET qty=qty-1
- WHERE id=? AND qty>0
- Check affected rows
- Related writes in appropriate transaction
- Row lock/serializable transaction for multistep logic
- Conflict rollback/retry
- Process-local lock misses other balanced servers
- Idempotency tokens plus unique storage constraints
- Retried payment must not duplicate transaction
👁 Full explanation
In a relational database use an atomic conditional UPDATE stock SET qty=qty-1 WHERE id=? AND qty>0, check affected rows, and combine related writes in an appropriate transaction. A row lock or serializable transaction can protect multi-step logic; handle rollback/retry on conflicts. A process-local lock does not cover all load-balanced servers. Idempotency tokens with unique storage constraints prevent a retried payment from becoming a duplicate transaction.
2 related practice questions
Blueprint: WEB4 · Note references: WEB-N, WEB-ISO
- Race conditions and synchronization
WEB38
Frameworks and version-aware setup
[Exam Focus]- Frameworks, libraries and components
- Framework: conventions/reusable structure
- Library: callable capabilities
- jQuery: DOM simplification
- React: component interfaces
- Angular: component platform, distinct from AngularJS
- Vue: interactive interfaces
- Responsive-interface description not uniquely identifying
- React props: inputs; state: changing data
- JSX requires transformation
- JSX ≠ ordinary browser JavaScript syntax
👁 Full explanation
A framework supplies conventions and reusable structure; a library supplies callable capabilities. jQuery simplifies DOM operations; React builds component interfaces; Angular is a component platform, distinct from older AngularJS; Vue also builds interactive interfaces. Each can contribute to a responsive interface, so those generic descriptions do not identify one unique framework. React props pass inputs; state records changing component data; JSX needs transformation rather than being ordinary browser JavaScript syntax. - Version-aware framework setup
- Bootstrap: layout/components
- jQuery→Popper→Bootstrap: version4-era order
- Bootstrap5 drops required jQuery
- Angular CLI: ng new,ng serve,ng build
- ng generate; ng test
- e2e support configuration-dependent
- ng serve starts the development server
- Create React App: deprecated historical tooling
- Historical module tooling ≠ universal current recommendation
👁 Full explanation
Bootstrap supplies layout/components. The jQuery→Popper→Bootstrap dependency order is version4-era guidance; Bootstrap5 drops required jQuery. Angular CLI commands include ng new, ng serve, ng build, ng generate and ng test, with e2e support depending on configuration. Use ng serve to start the development server. Create React App is deprecated; recognize it as historical tooling rather than a universal current recommendation.
4 related practice questions
Blueprint: WEB3 · Note references: WEB-M, WEB-N, WEB-BOOT, WEB-REACT, WEB-PROPS
- Frameworks, libraries and components
WEB39
Manage content, performance and revisions
[Exam Focus]- Content, persistence, history and deployment
- CMS: editing, publishing, roles, media
- No per-file source edits required
- Database: persistent facts
- Database ≠ entire server application
- VCS: history, branches, merges
- Review and collaboration
- Deployment: publish chosen build
- Deployment separate from version control
👁 Full explanation
A CMS gives editors content creation, publishing, roles and media management without editing every source file. A database stores persistent facts; it is not itself the whole server application. A VCS records source history, branches and merges to support review/collaboration; deployment publishes a chosen build and is a separate operation. - SEO and performance mechanisms
- SEO: meaningful content, headings, metadata
- Accessible links; crawlable structure
- Keyword metadata alone ≠ ranking guarantee
- Caching: reused representation/result, validity/invalidation rules
- Server cache: rendered pages/query results
- Unsafe shared key can expose private content
- Minification: remove source characters
- Bundling: combine; compression: transfer encoding
- Preloading: anticipated early fetch
- Excess bundling/preloading may compete with critical-work
- Measure performance
- Responsive and cross-browser testing separately
👁 Full explanation
SEO improves discoverability through meaningful content, headings, metadata, accessible links and crawlable structure; keyword metadata alone does not guarantee ranking. Caching reuses a representation/result and requires validity/invalidation rules. Server caching can hold rendered pages or expensive query results; never share private user content under an unsafe common key. Minification removes unnecessary source characters; bundling combines files; compression changes transfer encoding; preloading fetches anticipated resources early. Measure performance because excess preloading/bundling may compete with critical work. Responsive design and cross-browser compatibility need separate testing.
8 related practice questions
Blueprint: WEB3 · Note references: WEB-M, WEB-N, WEB-CMS, WEB-SEO, WEB-VCS
- Content, persistence, history and deployment
WEB40
Assemble and evaluate an end-to-end feature
[Exam Focus]- Course-search browser feature
- Semantic headings/navigation; labeled search form
- Responsive grid; single-column fallback
- Submit registration after parsing
- Prevent default for asynchronous implementation only
- Encode query values
- GET /courses?q=...
- Loading state and useful errors
- No untrusted HTML insertion
👁 Full explanation
For a course-search page, write semantic headings/navigation and a labeled search form. Use a responsive grid with a single-column fallback, then register a submit handler after parsing. Prevent default only when implementing asynchronous submission; encode search values in the query and send GET /courses?q=.... Show loading and useful error feedback without inserting untrusted HTML. - Search/enrollment end-to-end verification
- Validate query length/type; authenticate when required
- Parameterized SELECT; bounded results
- JSON with appropriate status/content type
- Client: status→parse→textContent nodes
- Enrollment: POST, CSRF, server authorization
- Capacity checks; transaction; success after commit
- Test empty/bad input and access denial
- Network failure; delayed responses; repeated clicks
- Simultaneous enrollment; narrow screens; keyboard use
- All four blueprint outcomes integrated
👁 Full explanation
The server validates query length/type, authenticates where required, runs a parameterized SELECT with a bounded result size, and returns JSON with an appropriate status/content type. The client checks status, parses data and builds nodes with textContent. For an enrollment action use POST with CSRF controls, server authorization, capacity checks and a transaction; show success only after commit. Evaluate empty/bad input, access denied, network failure, delayed responses, repeated clicks, simultaneous enrollments, narrow screens and keyboard use. This integrates all four blueprint outcomes beyond tag recall.
Blueprint: WEB2, WEB3, WEB4 · Note references: WEB-M, WEB-N
- Course-search browser feature
WEB41
Validate syntax, context and output
- Literal source and trace preconditions
- Valid syntax; known initial values
- Execution context; raw/rendered representation
- x=4+"4"5: missing-operator syntax error
- bool ans=true: invalid declaration
- type of new Date(): syntax error
- PHP >> instead of ?>: parsing defect
- Trace output only for valid syntax
- Split = > invalid without authorized repair
👁 Full explanation
A trace requires syntactically valid source, known initial values, execution context and output representation. x=4+"4"5 is a syntax error because an operator is missing; bool ans=true and type of new Date() are syntax errors too. PHP with >> instead of ?> may fail parsing; analyze output only after checking the closing syntax. The PHP array operator is =>; splitting it as = > is invalid syntax. - Answerability and output interpretation
- Response text ≠ browser rendering
- Emitted markup changes displayed output
- Visual breaks may vanish in plain-text choices
- Missing correct60 leaves no correct option
- Storage/interface libraries/script languages/channels overlap
- Broad descriptions need narrower distinction
- Record the question number
- Check assumptions before choosing
👁 Full explanation
Distinguish response text from browser rendering: PHP may emit markup that the browser interprets, and visual line breaks need not appear in a plain-text choice. For the assignment example above, the correct output is 60 even if it is absent from the choices. Multiple storage techniques, interface libraries, script-capable languages and cryptographic channels often satisfy broad descriptions. State the missing distinction before selecting an answer when the question admits several interpretations. - Check exact code and punctuation
- JavaScript coercion: x=4+"4"
- Original output44, answer A
- Extracted extra5: different invalid program
- PHP closing delimiter: ?>
- Original output r, answer D
- Extracted >> falsely creates syntax error
- Read the code exactly as shown
- Trace strings and numeric conversions
- Current extracted text: identify conflict
👁 Full explanation
With x=4+"4";, JavaScript produces 44; x=4+"4"5 is invalid because an operator is missing. The PHP string-offset example closes with ?> and prints r; using >> instead introduces a syntax error. Check the complete code and closing delimiters before tracing output. Apply each output prediction to the exact program being analyzed.
64 related practice questions
Note references: WEB-M, WEB-N
- Literal source and trace preconditions
No matching topics. Clear the search or change the filter.
Blueprint learning outcomes
- WEB1 · Understand concepts, principles and methods in programming for web and Internet environment
WEB01, WEB02, WEB03, WEB04, WEB05, WEB09, WEB12, WEB14 - WEB2 · Apply Server Side scripting Languages and Implement client-side interactivity
WEB17, WEB19, WEB20, WEB21, WEB25, WEB26, WEB27, WEB29, WEB30, WEB31, WEB32, WEB33, WEB34, WEB40 - WEB3 · Specify, build and manage form and content of information-rich web sites
WEB06, WEB07, WEB08, WEB09, WEB12, WEB13, WEB14, WEB28, WEB29, WEB30, WEB32, WEB38, WEB39, WEB40 - WEB4 · Design, implement and evaluate client-server systems following specific protocol specifications, taking into account concurrency issue
WEB03, WEB04, WEB05, WEB21, WEB27, WEB29, WEB31, WEB32, WEB34, WEB35, WEB36, WEB37, WEB40