BACK-END BASICS. Basic of a RESTful API in Node.js, a… Quiz

Explore foundational concepts of building RESTful APIs in Node.js with PostgreSQL and deploying to AWS EC2. Get familiar with HTTP, API principles, and deployment strategies for scalable back-end solutions.

  1. Definition and Role of a RESTful API

    What is the primary role of a RESTful API in a back-end application?

    1. To design user interfaces for front-end applications
    2. To provide an interface for communication between different systems
    3. To encrypt all data stored in the database
    4. To generate network traffic logs for developers

    Explanation: A RESTful API creates a standardized interface that allows various clients and systems to interact with core application processes or data. It is not responsible for designing user interfaces (which is a front-end concern), encrypting database data (handled by security features or database configuration), or generating network logs (which is managed by separate logging tools or middleware).

  2. HTTP Methods and Operations

    Which HTTP method is typically used to update an existing resource in a RESTful API?

    1. PUT
    2. OPTIONS
    3. HEAD
    4. GET

    Explanation: PUT is commonly used to update an existing resource by replacing its current representation. GET is used to retrieve data, OPTIONS provides information about allowed methods, and HEAD retrieves headers without the response body. Only PUT is used for updating resources.

  3. Purpose of HTTP Status Codes

    What does an HTTP status code of 403 signify in a RESTful API response?

    1. The request was redirected to another resource
    2. The server forbids access due to lack of client authorization
    3. The request was successful and data is returned
    4. The requested resource was not found

    Explanation: A 403 status code means the server understood the request but is refusing to fulfill it, often due to invalid or missing authorization. A 404 indicates a missing resource, 200 indicates success, and 3xx codes (such as 301 or 302) indicate redirection—not forbidden access.

  4. Database Integration in Node.js APIs

    Why is PostgreSQL often used with Node.js APIs in back-end development?

    1. It only supports unstructured, NoSQL data models
    2. It is a robust, open-source relational database with advanced features
    3. It compiles directly to machine code for performance
    4. It is a front-end framework for building user interfaces

    Explanation: PostgreSQL is valued for its reliability, open-source licensing, and advanced support for relational data and complex queries. It is not a front-end framework, does not compile to machine code, and is not limited to NoSQL or unstructured data models.

  5. Deploying a RESTful API to AWS EC2

    What is a typical benefit of deploying a Node.js RESTful API to an AWS EC2 instance?

    1. Automatically migrates the API to all cloud services
    2. Enables scalable and flexible cloud-based hosting
    3. Removes the need for any operating system setup
    4. Ensures zero network latency for global users

    Explanation: AWS EC2 provides scalable computing resources that can be configured and managed for back-end hosting needs. It does not automatically migrate applications to all cloud services, still requires OS and security setup, and cannot guarantee zero network latency for all users worldwide.