Pie Logo
Quiz: Storage
by Tomas Trescak

QuizTest your understanding of the section content.

ContentDetailed description of the section content.

Full Stack Development
Introduction
Generative AI
🍰 Player
💼 Editor
Setup
React Fundamentals
Next.js
Advanced React
Databases
React Hooks
Authentication and Authorisation
Cookies
Storage
Quiz: Storage
Authentication Approaches
Assignment 2.3: Blog - Backend
APIs
CI/CD and DevOps
Testing React
Advanced Topics
    Pie Logo
    Quiz: Storage
    by Tomas Trescak

    QuizTest your understanding of the section content.

    ContentDetailed description of the section content.

    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    Cookies
    Storage
    Quiz: Storage
    Authentication Approaches
    Assignment 2.3: Blog - Backend
    APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics
    QUESTION 1

    A user sets a post filter preference in the Blog application using this code:

    localStorage.setItem('prefs', 'tag:tech');
    

    They close their browser and return three days later. What happens when the app tries to read localStorage.getItem('prefs')?


    QUESTION 2

    An admin starts writing a post in the Blog app and saves it as a temporary draft:

    sessionStorage.setItem('draft', 'My awesome post...');
    

    What happens to this draft in these scenarios? (Select all that apply.)


    QUESTION 3

    The Blog app uses IndexedDB to store multiple drafts with this setup:

    const dbPromise = indexedDB.open('BlogDrafts', 1);
    dbPromise.onupgradeneeded = (event) => {
      event.target.result.createObjectStore('drafts', { keyPath: 'id' });
    };
    dbPromise.onsuccess = (event) => {
      const db = event.target.result;
      const tx = db.transaction('drafts', 'readwrite');
      tx.objectStore('drafts').add({ id: 1, text: 'Draft 1...' });
    };
    

    An admin saves a draft with id: 1. What’s true about this storage? (Select all that apply.)


    QUESTION 4

    In the Blog app, a developer considers storing a user’s password in local storage with:

    localStorage.setItem('password', 'secret123');
    

    Why might this be risky? (Select all that apply.)


    QUESTION 5

    Compare these storage options in the Blog app:

    • Cookies: session_id=abc789xyz for admin login.
    • Local Storage: prefs=tag:tech for post filters.
    • Session Storage: draft=My awesome post... for a tab’s draft.
      Which of these statements is true?


    QUESTION 6

    An admin wants to save multiple drafts offline in the Blog app. The developer chooses IndexedDB over cookies. Why is this a better choice? (Select all that apply.)

    This content is only available to registered users.
    Please register at the the home page.

    QUESTION 1

    A user sets a post filter preference in the Blog application using this code:

    localStorage.setItem('prefs', 'tag:tech');
    

    They close their browser and return three days later. What happens when the app tries to read localStorage.getItem('prefs')?


    QUESTION 2

    An admin starts writing a post in the Blog app and saves it as a temporary draft:

    sessionStorage.setItem('draft', 'My awesome post...');
    

    What happens to this draft in these scenarios? (Select all that apply.)


    QUESTION 3

    The Blog app uses IndexedDB to store multiple drafts with this setup:

    const dbPromise = indexedDB.open('BlogDrafts', 1);
    dbPromise.onupgradeneeded = (event) => {
      event.target.result.createObjectStore('drafts', { keyPath: 'id' });
    };
    dbPromise.onsuccess = (event) => {
      const db = event.target.result;
      const tx = db.transaction('drafts', 'readwrite');
      tx.objectStore('drafts').add({ id: 1, text: 'Draft 1...' });
    };
    

    An admin saves a draft with id: 1. What’s true about this storage? (Select all that apply.)


    QUESTION 4

    In the Blog app, a developer considers storing a user’s password in local storage with:

    localStorage.setItem('password', 'secret123');
    

    Why might this be risky? (Select all that apply.)


    QUESTION 5

    Compare these storage options in the Blog app:

    • Cookies: session_id=abc789xyz for admin login.
    • Local Storage: prefs=tag:tech for post filters.
    • Session Storage: draft=My awesome post... for a tab’s draft.
      Which of these statements is true?


    QUESTION 6

    An admin wants to save multiple drafts offline in the Blog app. The developer chooses IndexedDB over cookies. Why is this a better choice? (Select all that apply.)

    This content is only available to registered users.
    Please register at the the home page.

    Pie Logo
    Quiz: Storage
    by Tomas Trescak
    Pie Logo
    Quiz: Storage
    by Tomas Trescak
    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    Cookies
    Storage
    Quiz: Storage
    Authentication Approaches
    Assignment 2.3: Blog - Backend
    APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics
    Full Stack Development
    Introduction
    Generative AI
    🍰 Player
    💼 Editor
    Setup
    React Fundamentals
    Next.js
    Advanced React
    Databases
    React Hooks
    Authentication and Authorisation
    Cookies
    Storage
    Quiz: Storage
    Authentication Approaches
    Assignment 2.3: Blog - Backend
    APIs
    CI/CD and DevOps
    Testing React
    Advanced Topics