HomeCode HereJavaScript async and data quiz JavaScript async and data quiz Admin 1 min read Updated November 16, 2026 Nine questions on JSON, fetch, promises, async/await and localStorage. JavaScript JavaScript async and data quiz 9 questions, instant feedback Question 1 of 9 Which call turns a JSON string into an object? A JSON.stringify(text) B JSON.parse(text) C JSON.toObject(text) D Object.fromJSON(text) parse reads JSON text into a value. stringify does the reverse. Question 2 of 9 What does fetch return? A The response body B A promise that resolves to a Response C A JSON object D undefined fetch resolves once headers are available. You still call response.json() or response.text() to read the body. Question 3 of 9 What does await do inside an async function? A Blocks the whole browser B Pauses that function until the promise settles C Converts a promise to a callback D Runs code in parallel await pauses the async function only. Other work in the page continues. Question 4 of 9 How do you handle a rejected promise with async/await? A try...catch B if...else C switch D A callback parameter A rejection inside an awaited call throws, so try...catch handles it like a synchronous error. Question 5 of 9 Which check catches an HTTP error status from fetch? A if (response.ok) B if (response.status === 'error') C if (response.error) D fetch throws automatically fetch rejects only on network failures. A 404 still resolves, so check response.ok or the status. Question 6 of 9 What does localStorage.setItem require for its value? A Any object B A string C A number D A promise Storage holds strings, so objects and arrays must be serialised with JSON.stringify. Question 7 of 9 Which method waits for several promises and returns all results? A Promise.race B Promise.all C Promise.any D Promise.wait Promise.all resolves when every promise resolves, and rejects if any rejects. Question 8 of 9 What does an async function always return? A undefined B A promise C The awaited value D A callback Returning a value from an async function resolves its promise with that value. Question 9 of 9 Which pattern avoids a flash of empty content while data loads? A Hiding the whole page forever B Showing a loading state, then the content or an error C Using alert() D Reloading the page A visible loading state and an error state make slow or failed requests understandable instead of looking broken. Check my answers Try again Your answers stay in this browser. Nothing is sent to a server. More quizzes Modern JavaScript quiz 9 questions JavaScript final quiz 10 questions JavaScript DOM quiz Coming soon All quizzes