Unit 2: Rendering Strategies and Data Fetching - Practice Quiz

INT257 — Modern Web Application Development 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What does Server-Side Rendering (SSR) mean?

Server-Side Rendering (SSR) Easy
A. HTML is generated only in the browser
B. HTML is generated once during development
C. HTML is stored only in a database
D. HTML is generated on the server for each request

2 What is the main characteristic of Static Site Generation (SSG)?

Static Site Generation (SSG) Easy
A. Pages are generated from live data per request
B. Pages are generated only by the browser
C. Pages are generated during the build process
D. Pages are generated after every user click

3 What does Incremental Static Regeneration (ISR) allow a website to do?

Incremental Static Regeneration (ISR) Easy
A. Render every page only in the browser
B. Prevent pages from ever changing
C. Remove all static pages after deployment
D. Update static pages after deployment

4 Where is most of the page content generated in Client-side Rendering?

Client-side Rendering Easy
A. In the database server
B. In the web server only
C. In the build system
D. In the user's browser

5 Which rendering strategy is generally suitable for content that changes rarely?

Rendering Strategy Selection Easy
A. Client-side Rendering
B. Server-side Rendering
C. Repeated server polling
D. Static Site Generation

6 Which factor is important when selecting a rendering strategy?

Rendering Strategy Selection Easy
A. The color of the page background
B. How often the data changes
C. The number of developer comments
D. The operating system of the database

7 Where do Server Components primarily render?

Server Components Easy
A. Only during CSS processing
B. Only inside the browser
C. Inside the user's database
D. On the server

8 Which feature commonly requires a Client Component?

Client Components Easy
A. Creating a server log
B. Handling a button click
C. Reading a static stylesheet
D. Generating a build manifest

9 What is one benefit of using Server Components?

Server Components Easy
A. No need for HTML responses
B. Automatic removal of all server code
C. Less JavaScript sent to the browser
D. More database access from the browser

10 Client Components are mainly used for which purpose?

Client Components Easy
A. Static file compression only
B. Server hardware configuration
C. Interactive user interface behavior
D. Database table creation

11 What is the Fetch API commonly used for?

Fetch API Easy
A. Making network requests
B. Compiling JavaScript files
C. Styling HTML elements
D. Creating database indexes

12 What does a successful HTTP response usually provide when using the Fetch API?

Fetch API Easy
A. A CSS selector
B. A database schema
C. A Response object
D. A browser extension

13 Which method is commonly used to read JSON from a Fetch API response?

Fetch API Easy
A. response.json()
B. response.sql()
C. response.style()
D. response.render()

14 When does client-side fetching usually occur?

Client-side Fetching Easy
A. Before the server receives a request
B. Only during database installation
C. Before the application is written
D. After JavaScript runs in the browser

15 Which is a common advantage of client-side fetching?

Client-side Fetching Easy
A. It removes the need for an internet connection
B. It can update data without a full page reload
C. It always improves the first page load
D. It prevents all network requests

16 Where does server-side data fetching take place?

Server-side Data Fetching Easy
A. Inside the browser's CSS engine
B. On the server before the response is sent
C. During the user's keyboard input
D. Only after the user closes the page

17 What is one benefit of fetching sensitive data on the server?

Server-side Data Fetching Easy
A. Server credentials can remain private
B. The database no longer needs authentication
C. The browser receives every database password
D. The user can bypass server authorization

18 What is caching?

Caching and Revalidation Easy
A. Converting HTML into a database
B. Storing data for possible reuse
C. Deleting data after every request
D. Blocking all repeated requests

19 What does revalidation usually mean?

Caching and Revalidation Easy
A. Checking whether cached data is still current
B. Converting a server into a browser
C. Changing a user's password automatically
D. Removing the application source code

20 What is a possible result of using a long cache duration?

Caching and Revalidation Easy
A. Automatic deletion of all page content
B. More database writes on every request
C. Faster responses with older data
D. Slower responses with no stored data

21 An e-commerce product page must display current inventory in its initial HTML and remain discoverable by search engines. Which rendering strategy best fits these requirements?

Server-Side Rendering (SSR) Medium
A. Render the page on the server for each request
B. Store the complete page only in browser storage
C. Render an empty shell and fetch inventory in the browser
D. Generate the page once during the application build

22 A server-rendered dashboard reads a user identifier from an authenticated request before loading account data. What is the main consequence for caching the complete HTML response?

Server-Side Rendering (SSR) Medium
A. The response no longer requires authorization checks
B. The response should be cached separately by user
C. The response can be shared publicly across all users
D. The response becomes static after its first request

23 A documentation website changes only when a new software version is released. Which approach generally provides the lowest request-time server workload?

Static Site Generation (SSG) Medium
A. Generate all documentation pages during the build
B. Render every documentation page for each request
C. Fetch every document after the browser loads
D. Regenerate every document on a fixed short interval

24 A statically generated catalog contains 100,000 product pages, and every build is becoming too slow. Which change most directly reduces build-time generation work?

Static Site Generation (SSG) Medium
A. Request every product twice during the same build
B. Hydrate every product page with additional client code
C. Prebuild every product with a shorter cache duration
D. Prebuild popular products and generate others on demand

25 A news article page uses ISR with a revalidation interval of 300 seconds. An editor publishes a correction 100 seconds after the latest generation. What should readers generally expect?

Incremental Static Regeneration (ISR) Medium
A. The correction appears instantly without regeneration
B. The page returns an error until the next full build
C. The browser rewrites the stored HTML automatically
D. The old page may remain until revalidation occurs

26 A product page uses time-based ISR, but an urgent price update must appear as soon as the pricing system changes. Which addition best addresses this requirement?

Incremental Static Regeneration (ISR) Medium
A. Trigger on-demand revalidation after the price update
B. Disable all server-side requests for the product
C. Store the new price only in local browser storage
D. Increase the time-based revalidation interval

27 A browser-rendered analytics page shows an empty container until a large JavaScript bundle executes and its API request completes. Which user-facing metric is most directly at risk?

Client-side Rendering Medium
A. Time required to issue a TLS certificate
B. Time until meaningful content becomes visible
C. Time required to resolve the server hostname
D. Time required to write source files to disk

28 A team is building an authenticated drawing tool with frequent pointer events, local state changes, and little need for search indexing. Why is client-side rendering suitable for its main workspace?

Client-side Rendering Medium
A. It generates every user drawing during the deployment build
B. It allows private API credentials to be embedded in code
C. It supports rich interactions without full-page navigation
D. It guarantees that JavaScript is unnecessary in the browser

29 A site has public marketing pages, frequently updated product prices, and a private interactive account area. Which combination is the most appropriate starting point?

Rendering Strategy Selection Medium
A. ISR for marketing, browser storage for prices, and SSR without scripts for accounts
B. SSR for marketing, SSG for prices, and build-time rendering for accounts
C. Client rendering for marketing, SSG for products, and SSG for accounts
D. SSG for marketing, SSR or ISR for products, and client rendering for accounts

30 A public transit page must show live arrival times, but its route descriptions change only monthly. Which design best balances freshness and performance?

Rendering Strategy Selection Medium
A. Statically render descriptions and fetch arrivals dynamically
B. Rebuild the entire application whenever a vehicle moves
C. Statically render both descriptions and arrival times monthly
D. Fetch descriptions repeatedly but embed fixed arrival times

31 A component reads records directly from a database and renders a non-interactive table. What is a key benefit of implementing it as a Server Component?

Server Components Medium
A. The table automatically supports browser click handlers
B. The database connection becomes available to every visitor
C. Database access code stays out of the browser bundle
D. The component can use browser local storage during rendering

32 A Server Component needs to include an interactive favorite button. Which component structure is most appropriate?

Server Components Medium
A. Keep data rendering on the server and nest a Client Component button
B. Move the database credentials into the favorite button's props
C. Convert the entire page into static HTML with no JavaScript
D. Add the browser click handler directly to the Server Component

33 A search filter uses useState, responds to input events, and reads localStorage. Why must it run as a Client Component?

Client Components Medium
A. It depends on browser APIs and interactive state
B. It needs direct access to private database credentials
C. It can execute only before HTML reaches the browser
D. It must generate all search pages during the build

34 A page currently marks its top-level layout as a Client Component only because one nested menu needs toggle state. What change is most likely to reduce client-side JavaScript?

Client Components Medium
A. Fetch the entire layout again after every toggle
B. Duplicate the menu state in every server component
C. Move the client boundary up to the application root
D. Move the client boundary down to the menu

35 The code fetch('/api/orders').then(response => response.json()) attempts to parse an HTTP 404 response as normal data. Which check should be added before parsing?

Fetch API Medium
A. Check response.ok and handle a false value
B. Check response.redirected and require a true value
C. Check response.bodyUsed and require a true value
D. Check response.type and require an opaque value

36 A user changes a search term quickly, and an older request sometimes finishes after a newer request and overwrites the results. Which Fetch API feature best prevents this?

Fetch API Medium
A. Clone the previous response before parsing it
B. Set the previous request method to HEAD
C. Cancel the previous request with AbortController
D. Convert the previous response with response.text()

37 A client-rendered component starts a data request inside an effect whenever productId changes. What should it do when the component unmounts or productId changes again?

Client-side Fetching Medium
A. Abort or ignore the obsolete request
B. Reload the browser before sending another request
C. Reuse the obsolete result for every product
D. Store the unfinished response in the document title

38 A page must call an internal service using a private API key and include the result in the initial HTML. Where should the request be made?

Server-side Data Fetching Medium
A. In the browser using a bundled environment variable
B. On the server using a protected environment variable
C. In the HTML using a visible metadata attribute
D. In local storage using a user-provided API key

39 A shared cache stores responses for /api/profile, but the endpoint returns data based on the current user's session cookie. Which cache policy is safest?

Caching and Revalidation Medium
A. Cache forever and remove session validation
B. Use the same public cache key for every session
C. Share one cached response among all authenticated users
D. Use a private cache or disable shared caching

40 An API response includes Cache-Control: max-age=60, stale-while-revalidate=300. What behavior does this permit after the first 60 seconds?

Caching and Revalidation Medium
A. Serve stale content temporarily while refreshing it
B. Send every request directly to the origin without caching
C. Treat the content as permanently fresh for six minutes
D. Delete the cached content and block for five minutes

41 A news page is rendered on every request. Its HTML contains current headlines, but the browser later reports a hydration mismatch because the server and client rendered different timestamps. Which change most directly preserves SSR while preventing the mismatch?

Server-Side Rendering (SSR) Hard
A. Render the server timestamp again from the client's current clock
B. Pass the server timestamp to the client and reuse it during hydration
C. Cache the entire server response until both clocks become synchronized
D. Remove the timestamp from HTML and obtain all headlines after hydration

42 An SSR product page performs three independent upstream requests taking ms, ms, and ms. Ignoring framework overhead, what is the best achievable data-fetching latency if all requests begin concurrently?

Server-Side Rendering (SSR) Hard
A. ms
B. ms
C. ms
D. ms

43 A documentation site has 500,000 versioned pages, but only 2% receive regular traffic. A full build has become prohibitively slow. Which design best preserves static delivery without generating every page during each deployment?

Static Site Generation (SSG) Hard
A. Server-render all pages on every request without response caching
B. Render every page in the browser from an empty HTML shell
C. Prebuild every page and increase the deployment timeout indefinitely
D. Prebuild popular pages and generate uncommon pages on first request

44 A statically generated pricing page reads prices from a database only during the production build. The database changes two hours later, and no regeneration mechanism is configured. What will users receive from the existing deployment?

Static Site Generation (SSG) Hard
A. The new prices after the browser cache expires
B. The old prices only for users with active sessions
C. The old prices until another build is deployed
D. The new prices when the CDN performs validation

45 An ISR page has a revalidation interval of 60 seconds. A cached version is 75 seconds old when a request arrives, and the platform uses stale-while-revalidate behavior. What response pattern should be expected?

Incremental Static Regeneration (ISR) Hard
A. The request receives stale content while regeneration starts in the background
B. The request bypasses regeneration and permanently extends the cached version
C. The request blocks until regeneration finishes and then receives new content
D. The request receives an error until a deployment replaces the stale page

46 A regenerated ISR page depends on a database that is temporarily unavailable. The previous generated page is valid but stale. Which failure policy usually provides the strongest availability without publishing an incomplete page?

Incremental Static Regeneration (ISR) Hard
A. Keep serving the previous page and retry regeneration later
B. Delete the cached page and return an error to every request
C. Replace the previous page with the partial regeneration output
D. Convert the page permanently to uncached client-side rendering

47 A client-rendered dashboard fetches /api/account after mounting. When a user signs out and another signs in within the same browser tab, the old request completes last and overwrites the new account state. Which solution addresses the underlying race?

Client-side Rendering Hard
A. Render the previous account until the next full browser navigation
B. Cancel obsolete requests or ignore responses whose request identity is stale
C. Move the fetch into a later timer so authentication settles beforehand
D. Increase the cache lifetime so both account responses remain available

48 A CSR application receives a minimal HTML shell and loads a large JavaScript bundle before requesting page data. On slow mobile devices, which change most directly improves first meaningful content without abandoning CSR for later interactions?

Client-side Rendering Hard
A. Add more client effects that fetch the same data independently
B. Store the JavaScript bundle in component state after execution
C. Disable HTTP compression to reduce browser decompression work
D. Embed route-critical data and prerender the initial content

49 A commerce application has public product descriptions updated hourly, user-specific inventory by region, and a cart that changes immediately in the browser. Which rendering composition best matches those requirements?

Rendering Strategy Selection Hard
A. Render product content, inventory, and cart entirely on every server request
B. Render an empty shell and fetch product content, inventory, and cart only after mounting
C. Regenerate product content, fetch regional inventory per request, and manage the cart client-side
D. Build all product, inventory, and cart states statically during each hourly deployment

50 A page must be indexed with complete content, uses request-time authorization, and displays confidential records that must never be stored in a shared cache. Which primary rendering strategy is most appropriate?

Rendering Strategy Selection Hard
A. CSR using an API credential embedded in the bundle
B. Public SSG with authorization performed during hydration
C. Shared ISR with a short regeneration interval
D. Uncached SSR after server-side authorization

51 A Server Component imports a database client, reads records, and passes selected fields to a nested Client Component. Which boundary rule is essential?

Server Components Hard
A. The database client must also be imported by the Client Component
B. The Client Component must execute its initial render in the database
C. The Server Component must attach browser event listeners directly
D. Props crossing the boundary must be serializable values

52 A component only formats fetched records into a table and has no state, effects, browser APIs, or event handlers. It currently ships a large formatting dependency to the browser. What is the strongest reason to make it a Server Component?

Server Components Hard
A. Its output will no longer require any server computation
B. Its database records will become permanently cached by default
C. Its table will automatically become editable without event handlers
D. Its formatting dependency can remain outside the client bundle

53 An interactive search Client Component receives an initial result list from a Server Component, then filters that list as the user types. Which implementation respects the component boundary while avoiding an unnecessary initial duplicate request?

Client Components Hard
A. Pass a live database cursor as a prop and iterate over it on input
B. Pass serializable initial results as props and store only interactive state on the client
C. Import the server database module and query it directly from the browser
D. Discard the initial results and always refetch them in a mount effect

54 A developer marks the application root as a Client Component merely because one deeply nested button uses onClick. What is the most significant architectural consequence?

Client Components Hard
A. A much larger subtree becomes part of the client JavaScript boundary
B. All nested components become statically generated without JavaScript
C. Every nested fetch automatically becomes private and uncached
D. Server-only modules become safe to expose through browser imports

55 A request made with fetch() receives HTTP status 404 and a valid JSON error body. No network failure occurs. Which statement describes the promise behavior?

Fetch API Hard
A. The promise resolves only if the request used the HEAD method
B. The promise rejects automatically because every 4xx status is an exception
C. The promise resolves, so code must inspect response.ok or response.status
D. The promise remains pending until the JSON error body is discarded

56 The same Response object's body is parsed with await response.json() and then read with await response.text(). What should the code expect under standard Fetch API body semantics?

Fetch API Hard
A. The second read starts a new HTTP request using the same response headers
B. The second read returns the original JSON with normalized indentation
C. The second read succeeds because parsed bodies are automatically rewound
D. The second read fails because the body stream has already been consumed

57 A search field requests results for each query. Responses may arrive out of order, and cached results should be reused when the user returns to an earlier query. Which cache key design is necessary for correctness?

Client-side Fetching Hard
A. A random key generated after each response has completed
B. A stable key containing every input that changes the result
C. A timestamp key based only on when the component mounted
D. A constant key shared by every query and authenticated user

58 A server-rendered page fetches an internal API that merely forwards the request to a database available to the same server process. Under what condition is querying the database directly usually preferable?

Server-side Data Fetching Hard
A. When the query must run again in a client effect after every hydration
B. When the API adds no required policy boundary and the direct module is server-only
C. When the API response must cross an additional network hop for consistency
D. When database credentials must be serialized into the generated browser bundle

59 A shared cache stores /profile responses, but the server chooses the profile from an authentication cookie. Which caching change is required to prevent one user's profile from being served to another?

Caching and Revalidation Hard
A. Remove cookie variation while retaining the shared cached response
B. Use one public cache key because the URL is identical for all users
C. Use a private cache or bypass shared caching for the personalized response
D. Increase the shared cache lifetime so each profile remains stable

60 A product mutation succeeds, and the application invalidates only the cache entry for /products/42. The product also appears in /products, /featured, and a category page. Which strategy most reliably prevents stale derived views?

Caching and Revalidation Hard
A. Tag related cache entries by product and invalidate that tag
B. Invalidate the detail URL and assume list caches detect the mutation
C. Shorten only the browser cache lifetime for /products/42
D. Change the mutation to GET so intermediary caches observe it