[{"id":"webperformanceintermediate-001","courseId":"web-performance-intermediate","domain":"measurement","topic":"Total Blocking Time","prompt":"A long task runs for 120 ms on the main thread after first contentful paint. How much of that task adds to the page's total blocking time?","hint":"Blocking time is not the same as how long a task runs.","explain":"Blocking is about how long the page cannot answer input. A busy stretch matters only when it runs long enough, and then only its excess over a fixed cutoff is added up across the page.","source":"https://web.dev/articles/tbt","interaction":{"type":"single"},"options":[{"id":"a","text":"70 ms","why":"Only the part of the task beyond the 50 ms long-task cutoff counts: 120 minus 50."},{"id":"b","text":"120 ms","whyNot":"The whole duration is not counted; blocking time keeps only the portion above the cutoff."},{"id":"c","text":"50 ms","whyNot":"The cutoff only decides what counts as a long task; it is not the amount that adds up."},{"id":"d","text":"0 ms","whyNot":"Blocking time comes from long tasks themselves, not from input events; input is what gets delayed."}],"answer":"a","explanation":"Total blocking time sums, for each long task after first contentful paint, the part of its duration above 50 ms.","concept":"Total blocking time sums, for each long task after first contentful paint, the part of its duration above 50 ms.","rev":1,"updatedAt":"2026-10-27","kind":"scenario","takeaways":["A long task's blocking time is its duration above 50 ms, not its full length."]},{"id":"webperformanceintermediate-002","courseId":"web-performance-intermediate","domain":"measurement","topic":"Long Tasks API","prompt":"Long task entries become available only after the page has finished loading, so a monitoring script cannot receive them earlier.","hint":"Think about when the browser records a task, compared with when your script subscribes.","explain":"The browser writes performance entries into a timeline while the page runs. An observer can receive them as they are recorded, or ask for ones recorded before it was created.","source":"https://developer.mozilla.org/en-US/docs/Web/API/PerformanceLongTaskTiming","interaction":{"type":"true-false"},"options":[{"id":"a","text":"True","whyNot":"Observers receive long task entries as they are recorded, and buffered: true also returns those recorded earlier."},{"id":"b","text":"False","why":"Long tasks are reported as they happen; the buffered option only adds those recorded before the observer existed."}],"answer":"b","explanation":"Long task entries are recorded while the page runs; an observer gets them as they occur, and buffered: true also returns those recorded earlier.","concept":"Long task entries are recorded while the page runs; an observer gets them as they occur, and buffered: true also returns those recorded earlier.","rev":1,"updatedAt":"2026-10-27","kind":"scenario","takeaways":["Set buffered: true when you observe long tasks so you don't miss those recorded during load."]},{"id":"webperformanceintermediate-003","courseId":"web-performance-intermediate","domain":"measurement","topic":"PerformanceObserver entries","prompt":"A script wants to check, before it subscribes, which kinds of performance entries the current browser can record. Which property provides that list?","hint":"Look for something you read from the constructor itself, not a method you call on an instance.","explain":"An observer is told which kinds of records it wants and then receives matching records as they arrive. Browsers differ in which kinds they can record, so a script may check that first.","source":"https://developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver","interaction":{"type":"single"},"options":[{"id":"a","text":"PerformanceObserver.supportedEntryTypes","why":"This static read-only property returns an array of the entry type names the browser supports."},{"id":"b","text":"PerformanceObserver.takeRecords()","whyNot":"It returns the entries already queued in an observer and empties that queue; it does not list what is supported."},{"id":"c","text":"PerformanceObserver.disconnect()","whyNot":"It stops an observer from receiving entries; it does not report what the browser can record."},{"id":"d","text":"PerformanceObserver.observe()","whyNot":"It sets which entry types an observer watches; it does not report what the browser supports."}],"answer":"a","explanation":"PerformanceObserver.supportedEntryTypes is a static property that returns the entry types the user agent supports.","concept":"PerformanceObserver.supportedEntryTypes is a static property that returns the entry types the user agent supports.","rev":1,"updatedAt":"2026-10-27","kind":"scenario","takeaways":["Check PerformanceObserver.supportedEntryTypes before observing a type that some browsers may lack."]},{"id":"webperformanceintermediate-004","courseId":"web-performance-intermediate","domain":"measurement","topic":"Navigation Timing","prompt":"Put these Navigation Timing milestones of a single page load in the order the browser reaches them.","hint":"A milestone that waits for more of the page cannot come before one that waits for less.","explain":"Some milestones only show that the page structure is ready, some mark a handler starting or ending, and one waits for every sub-resource. All are recorded as timestamps on one timeline.","source":"https://developer.mozilla.org/en-US/docs/Web/API/Performance_API/Navigation_timing","interaction":{"type":"sort","items":[{"text":"domInteractive","why":"The DOM is finished and scripts can use it; this is reached before the handlers that follow."},{"text":"domContentLoadedEventStart","why":"The DOMContentLoaded handler is about to start, once the DOM is ready."},{"text":"domContentLoadedEventEnd","why":"The DOMContentLoaded handler has finished running."},{"text":"domComplete","why":"The document and all its sub-resources have finished loading, so it waits for more than the handlers do."},{"text":"loadEventStart","why":"The load handler is about to start, after the document and its sub-resources are done."}]},"options":[],"answer":"o:abcde","explanation":"Navigation Timing records load milestones in order: domInteractive, then the DOMContentLoaded handler's start and end, then domComplete, then loadEventStart.","concept":"Navigation Timing records load milestones in order: domInteractive, then the DOMContentLoaded handler's start and end, then domComplete, then loadEventStart.","rev":1,"updatedAt":"2026-10-27","kind":"scenario","takeaways":["Navigation timestamps mark milestones of one page load, from DOM ready through the load handler."]},{"id":"webperformanceintermediate-005","courseId":"web-performance-intermediate","domain":"measurement","topic":"Resource Timing","prompt":"A page loads an image and a script from the same site and fetches JSON with fetch(). Which TWO statements about the Resource Timing entries for these loads are correct?","hint":"Consider what each entry covers and how the size properties differ from each other.","explain":"Resource Timing describes the network stages of each load, with timestamps and sizes. Sizes come in several forms, and they differ in whether they include headers and whether encoding has been undone.","source":"https://developer.mozilla.org/en-US/docs/Web/API/Performance_API/Resource_timing","interaction":{"type":"multiple","tellCount":true},"options":[{"id":"a","text":"Each fetched resource gets its own PerformanceResourceTiming entry, with the entryType resource","why":"Every resource on a document is represented by a resource entry in the timeline."},{"id":"b","text":"transferSize counts the response headers as well as the body","why":"transferSize is the fetched size including the response header fields plus the payload body."},{"id":"c","text":"fetch() calls are left out, so only page resources such as images and scripts are recorded","whyNot":"Resources fetched from JavaScript with fetch() are recorded too."},{"id":"d","text":"decodedBodySize counts the body before any content-coding is removed","whyNot":"decodedBodySize is measured after content-codings are removed; the encoded size is the one before."},{"id":"e","text":"The resource timing buffer holds 500 entries by default","whyNot":"The default buffer holds 250 entries; a larger buffer must be set explicitly."},{"id":"f","text":"Timing fields for a cross-origin script are always full values, even without any header","whyNot":"Cross-origin timing fields read as zero unless Timing-Allow-Origin is set."}],"answer":"ab","explanation":"Every resource gets a PerformanceResourceTiming entry; transferSize covers headers plus body, while decodedBodySize is measured after content-encoding is removed.","concept":"Every resource gets a PerformanceResourceTiming entry; transferSize covers headers plus body, while decodedBodySize is measured after content-encoding is removed.","rev":1,"updatedAt":"2026-10-27","kind":"scenario","takeaways":["Choose the size property by what you need: transfer size, encoded body, or decoded body."]}]