HomeSubjectsUniversityBlogAbout

Databases for Web Applications

Topic in Web Development

210 total MCQsShowing 30 with explanations10 Easy10 Medium10 Hard

About This Topic

A web application database is the persistent relational or NoSQL store that a web server reads and writes to serve changing, user-specific content. SQL questions cover SELECT, INSERT, UPDATE and DELETE, joins, primary and foreign keys, and normalisation. Know when to choose MySQL or PostgreSQL over document stores like MongoDB, how ORMs and ODMs such as Sequelize, Prisma and Mongoose map objects to tables or documents, and why indexes speed reads but slow writes. Advanced items address ACID transactions, connection pooling, preventing SQL injection with parameterised queries, Redis caching, replication, sharding, and eventual versus strong consistency.

Below are 30 practice questions from a pool of 210 Databases for Web Applications MCQs, one of 17 topics in Web Development. Each shows the correct answer with an explanation; when you are ready, take a timed quiz to test recall under exam conditions.

Practice Questions

Each question below shows the correct answer with a full explanation. Use these to build conceptual understanding before attempting a timed quiz.

Databases for Web ApplicationsEasy

Q1. What is MySQL?

  1. A.A CSS framework for responsive web page layouts
  2. B.A web server for hosting application endpoints
  3. C.An open-source relational database management system✓ Correct
  4. D.A JavaScript library for building web interfaces

Explanation

MySQL is a popular open-source RDBMS that uses SQL.

Report an error in this question

Databases for Web ApplicationsEasy

Q2. What is MongoDB?

  1. A.A NoSQL document database storing JSON-like data✓ Correct
  2. B.A CSS framework for building styled components
  3. C.A web server for serving static content files
  4. D.A SQL relational database using table schemas

Explanation

MongoDB stores data in flexible, JSON-like BSON documents.

Report an error in this question

Databases for Web ApplicationsEasy

Q3. What does SQL stand for?

  1. A.Simple Query Language
  2. B.Structured Query Language✓ Correct
  3. C.Server Query Logic
  4. D.Standard Question Language

Explanation

SQL stands for Structured Query Language.

Report an error in this question

Databases for Web ApplicationsEasy

Q4. Which SQL command retrieves data?

  1. A.RETRIEVE
  2. B.FETCH
  3. C.GET
  4. D.SELECT✓ Correct

Explanation

The SELECT statement retrieves data from database tables.

Report an error in this question

Databases for Web ApplicationsEasy

Q5. What is a primary key?

  1. A.The first column created in a database table
  2. B.A password used for database authentication
  3. C.A unique identifier for each record in a table✓ Correct
  4. D.A foreign key linking to another related table

Explanation

A primary key uniquely identifies each record in a table.

Report an error in this question

Databases for Web ApplicationsEasy

Q6. What SQL command inserts new data?

  1. A.CREATE INTO
  2. B.ADD INTO
  3. C.INSERT INTO✓ Correct
  4. D.PUT INTO

Explanation

INSERT INTO adds new records to a database table.

Report an error in this question

Databases for Web ApplicationsEasy

Q7. What is a table in a relational database?

  1. A.A JavaScript object for storing key-value pairs
  2. B.A CSS grid for laying out page components
  3. C.An HTML table element for displaying data
  4. D.A structured collection of rows and columns✓ Correct

Explanation

A database table organizes data into rows and columns with a defined schema.

Report an error in this question

Databases for Web ApplicationsEasy

Q8. What is PostgreSQL?

  1. A.A CSS preprocessor for advanced style features
  2. B.An advanced open-source relational database system✓ Correct
  3. C.A JavaScript framework for building web apps
  4. D.A web browser for viewing internet content

Explanation

PostgreSQL is a powerful, open-source object-relational database.

Report an error in this question

Databases for Web ApplicationsEasy

Q9. What SQL command deletes data?

  1. A.DESTROY
  2. B.DELETE✓ Correct
  3. C.DROP DATA
  4. D.REMOVE

Explanation

The DELETE command removes records from a database table.

Report an error in this question

Databases for Web ApplicationsEasy

Q10. What is a database schema?

  1. A.The structure defining data organization and relations✓ Correct
  2. B.An HTML template for rendering dynamic page content
  3. C.A JavaScript object for storing config data
  4. D.A CSS layout blueprint for page structure

Explanation

A schema defines the database structure: tables, columns, data types, and relationships.

Report an error in this question

Databases for Web ApplicationsMedium

Q11. What is a foreign key?

  1. A.A column linking two tables via another primary key✓ Correct
  2. B.A key imported from another country or locale
  3. C.An encrypted key used for securing data at rest
  4. D.A backup key for recovering lost database records

Explanation

A foreign key establishes a relationship between tables.

Report an error in this question

Databases for Web ApplicationsMedium

Q12. What is database indexing?

  1. A.Creating structures that speed up data retrieval✓ Correct
  2. B.Numbering database rows in sequential order
  3. C.Organizing files on disk for better storage
  4. D.A CSS technique for ordering layout elements

Explanation

An index creates a data structure that allows the database to find rows faster.

Report an error in this question

Databases for Web ApplicationsMedium

Q13. What is a JOIN in SQL?

  1. A.A JavaScript method for merging arrays together
  2. B.Combining multiple CSS files into a single bundle
  3. C.A string concatenation operator for joining text
  4. D.A clause combining rows from tables based on columns✓ Correct

Explanation

JOIN combines rows from multiple tables based on a related column.

Report an error in this question

Databases for Web ApplicationsMedium

Q14. What is the difference between INNER JOIN and LEFT JOIN?

  1. A.LEFT JOIN returns only the matching rows from both sources
  2. B.They are identical in their result sets
  3. C.INNER JOIN includes NULL values from non-matching entries
  4. D.INNER returns matches only; LEFT returns all left rows plus matches✓ Correct

Explanation

INNER JOIN returns only matching rows, while LEFT JOIN returns all left table rows.

Report an error in this question

Databases for Web ApplicationsMedium

Q15. What is database normalization?

  1. A.Normalizing CSS values for cross-browser consistency
  2. B.Formatting JSON data for human-readable pretty output
  3. C.Making data look normal in the display output
  4. D.Organizing data to reduce redundancy via normal forms✓ Correct

Explanation

Normalization organizes tables to minimize data redundancy.

Report an error in this question

Databases for Web ApplicationsMedium

Q16. What is an ODM?

  1. A.A JavaScript operator for object comparison
  2. B.A CSS framework for responsive layout design
  3. C.A type of relational database engine
  4. D.Object-Document Mapper for objects and NoSQL docs✓ Correct

Explanation

An ODM like Mongoose maps application objects to database documents.

Report an error in this question

Databases for Web ApplicationsMedium

Q17. What is a transaction in databases?

  1. A.A CSS transition for animating property changes
  2. B.A data transfer between server and client machines
  3. C.A sequence of operations treated as a single unit✓ Correct
  4. D.A financial payment between two bank accounts

Explanation

A transaction groups operations into an atomic unit.

Report an error in this question

Databases for Web ApplicationsMedium

Q18. What are ACID properties?

  1. A.A type of document-oriented database engine system for storing data
  2. B.A security protocol for encrypting network traffic between services
  3. C.Atomicity, Consistency, Isolation, Durability for reliable transactions✓ Correct
  4. D.A chemistry concept related to pH levels

Explanation

ACID ensures transactions are Atomic, Consistent, Isolated, and Durable.

Report an error in this question

Databases for Web ApplicationsMedium

Q19. What is Redis commonly used for?

  1. A.As a primary database for all application data
  2. B.As an in-memory store for caching and sessions✓ Correct
  3. C.As a CSS preprocessor for compiling styles
  4. D.As a web server for hosting static content

Explanation

Redis is an in-memory store used for caching, sessions, and rate limiting.

Report an error in this question

Databases for Web ApplicationsMedium

Q20. What is SQL injection?

  1. A.A vulnerability where malicious SQL is inserted into queries✓ Correct
  2. B.A database optimization technique for faster lookups
  3. C.A JavaScript technique for dynamically building queries
  4. D.Injecting CSS styles into SQL query statements

Explanation

SQL injection exploits unsanitized user input to inject malicious SQL.

Report an error in this question

Databases for Web ApplicationsHard

Q21. What is database sharding?

  1. A.Encrypting data for security and privacy compliance
  2. B.Compressing tables to reduce disk storage space
  3. C.Splitting a database into smaller distributed pieces✓ Correct
  4. D.Breaking a database beyond repair permanently

Explanation

Sharding horizontally partitions data across multiple servers.

Report an error in this question

Databases for Web ApplicationsHard

Q22. What is the difference between horizontal and vertical partitioning?

  1. A.Horizontal splits columns; vertical splits rows across servers
  2. B.Neither approach has any effect on query performance
  3. C.Horizontal splits rows across servers; vertical splits columns✓ Correct
  4. D.They are identical in partitioning strategy

Explanation

Horizontal partitioning distributes rows, while vertical partitioning separates columns.

Report an error in this question

Databases for Web ApplicationsHard

Q23. What is eventual consistency?

  1. A.A CSS consistency model for cross-browser rendering
  2. B.Data is always immediately consistent everywhere
  3. C.All replicas converge to the same value given enough time✓ Correct
  4. D.Data is never consistent across any of the replicas

Explanation

Eventual consistency guarantees all replicas will eventually converge to the same value.

Report an error in this question

Databases for Web ApplicationsHard

Q24. What is a database migration?

  1. A.A data backup process for disaster recovery planning
  2. B.A CSS migration from one framework to another tool
  3. C.Version-controlled changes to schema that can be rolled back✓ Correct
  4. D.Moving a database to a new physical data center

Explanation

Migrations modify the schema in a version-controlled way.

Report an error in this question

Databases for Web ApplicationsHard

Q25. What is the N+1 query problem and how is it solved?

  1. A.A JavaScript error caused by off-by-one array access
  2. B.A CSS specificity issue with deeply nested selectors
  3. C.A mathematical formula for calculating query cost
  4. D.N extra queries for related data; solved by eager loading✓ Correct

Explanation

The N+1 problem is solved using eager loading, JOINs, or batching queries.

Report an error in this question

Databases for Web ApplicationsHard

Q26. What is a materialized view?

  1. A.A database object storing query results physically✓ Correct
  2. B.A CSS view for presenting styled HTML content
  3. C.A template engine view for generating dynamic pages
  4. D.A JavaScript view for rendering reactive UI components

Explanation

A materialized view pre-computes and stores query results as a physical table.

Report an error in this question

Databases for Web ApplicationsHard

Q27. What is connection pooling in database management?

  1. A.A swimming pool database for aquatic records
  2. B.A CSS pooling technique for shared style rule resources
  3. C.A JavaScript object pool for reusing DOM element references
  4. D.Maintaining reusable connections to avoid per-request overhead✓ Correct

Explanation

Connection pooling reuses established database connections from a pool.

Report an error in this question

Databases for Web ApplicationsHard

Q28. What is a write-ahead log (WAL)?

  1. A.A CSS log file for tracking style computation results
  2. B.A blogging technique for writing web content
  3. C.Changes are written to a log before applying to the DB✓ Correct
  4. D.A JavaScript console log for outputting debug messages

Explanation

WAL records modifications to a log file before applying them to the database.

Report an error in this question

Databases for Web ApplicationsHard

Q29. What is database replication?

  1. A.A backup tool for creating periodic data archive snapshots
  2. B.A version control system for tracking file change history
  3. C.Copying and maintaining data across servers for redundancy✓ Correct
  4. D.Copying CSS files across multiple project directories

Explanation

Replication copies data across servers for fault tolerance and high availability.

Report an error in this question

Databases for Web ApplicationsHard

Q30. What is the difference between optimistic and pessimistic locking?

  1. A.They only apply to NoSQL databases not relational ones
  2. B.They are identical in concurrency control approach
  3. C.Optimistic always locks; pessimistic never locks anything
  4. D.Optimistic checks at commit; pessimistic locks immediately✓ Correct

Explanation

Optimistic checks conflicts at write time, while pessimistic acquires locks before reading.

Report an error in this question

Ready to test yourself on Databases for Web Applications?

Take a timed quiz drawn from 210+ questions on this topic. No signup required — your progress saves in your browser.

Start Databases for Web Applications Quiz