BTCE | 5th Sem
No-SQL SubjectUnit 1

No-SQL Unit 1: Question and Answers

Unit 1: NoSQL Fundamentals -> Generated and Prepared By Thiruselvan (ThiruXD)

Part A – Multiple Choice Questions (1 Mark Each)

Q1. The term “NoSQL” is commonly interpreted as:

a) No Structured Query Language

b) Not Only SQL

c) No Software Query Layer

d) New Object SQL

Answer: (b) Not Only SQL

Q2. Which database is usually the best choice for strict ACID transactions such as bank transfers?

a) Key-value store

b) Graph database

c) Relational database

d) Document database

Answer: (c) Relational database

Q3. The Impedance Mismatch problem mainly occurs between:

a) Programming objects and relational tables

b) CPU and RAM

c) Indexes and queries

d) Cloud and local storage

Answer: (a) Programming objects and relational tables

Q4. In the CAP theorem, ‘P’ stands for:

a) Performance

b) Partition Tolerance

c) Persistence

d) Parallelism

Answer: (b) Partition Tolerance

Q5. Which CAP behaviour prioritises Consistency during a network partition?

a) AP

b) CP

c) CA

d) BASE

Answer: (b) CP

Q6. BASE stands for:

a) Basic Access, Safe Execution

b) Basically Available, Soft state, Eventual consistency

c) Binary Allocation Storage Engine

d) Balanced Availability and Strong Execution

Answer: (b) Basically Available, Soft state, Eventual consistency

Q7. Which NoSQL type stores data as JSON-like records?

a) Document database

b) Graph database

c) Column database

d) Key-only database

Answer: (a) Document database

Q8. Which database type is most suitable for friend-of-friend queries?

a) Key-value store

b) Graph database

c) Relational spreadsheet

d) File system

Answer: (b) Graph database

Q9. In CAP theorem, which combination is realistic only when there is no network partition?

a) CP

b) AP

c) CA

d) BASE

Answer: (c) CA

Q10. Instagram “likes” count that may temporarily differ across servers is an example of:

a) Strong consistency

b) Eventual consistency

c) ACID property

d) Vertical scaling

Answer: (b) Eventual consistency

Q11. Which of the following is a classic CP system example?

a) Social media feed

b) Bank ATM during network failure

c) Weather app

d) Product recommendations

Answer: (b) Bank ATM during network failure

Q12. Redis is an example of which type of NoSQL database?

a) Document

b) Key-Value

c) Wide-Column

d) Graph

Answer: (b) Key-Value

Q13. Cassandra is primarily a:

a) Document database

b) Graph database

c) Wide-Column / Column-oriented database

d) Key-Value only database

Answer: (c) Wide-Column / Column-oriented database

Q14. Neo4j is an example of:

a) Document database

b) Key-Value store

c) Wide-Column database

d) Graph database

Answer: (d) Graph database

Q15. The practice of using multiple database technologies in the same application is called:

a) Database replication

b) Polyglot Persistence

c) Horizontal scaling

d) Schema evolution

Answer: (b) Polyglot Persistence


Part B – Short Answer Questions (5 Marks Each)

Q16. Explain why NoSQL databases became important for modern web-scale applications.

Answer:

Modern applications (social media, e-commerce, IoT, mobile apps) generate data at very high speed, volume and variety. Traditional single-server relational databases struggle with rapid schema changes, geo-distributed users, very high write volume and low-latency requirements. NoSQL databases were developed to provide flexible schemas, horizontal scaling across many servers, high availability and better performance for semi-structured and distributed data.

Q17. Compare Relational databases and NoSQL databases on any five dimensions.

Answer:

  1. Data Model: Relational → Tables; NoSQL → Documents / Key-Value / Wide-Column / Graphs
  2. Schema: Relational → Fixed; NoSQL → Flexible
  3. Transactions: Relational → Strong ACID; NoSQL → Often BASE or tunable
  4. Scalability: Relational → Mostly vertical; NoSQL → Designed for horizontal scaling
  5. Consistency: Relational → Strong by default; NoSQL → Strong / Eventual / Tunable

Q18. What is the Impedance Mismatch problem? Explain with a simple e-commerce order example.

Answer:

Impedance Mismatch is the difficulty of mapping object-oriented application data (nested objects and lists) into flat relational tables.

In an e-commerce application, an Order object contains nested Customer, Shipping Address and a list of Items. In a relational database, this must be split across multiple tables (Orders, Customers, Addresses, OrderItems, Payments) linked by foreign keys. Joins or ORM tools are needed to reconstruct the original object. Document databases reduce this mismatch by storing the entire order as one nested JSON document.

Q19. Define the three components of the CAP theorem and explain why all three cannot be fully guaranteed during a network partition.

Answer:

  • Consistency (C): Every read returns the most recent write.
  • Availability (A): Every request receives a non-error response.
  • Partition Tolerance (P): System continues operating despite network failures.

During a network partition, a distributed system cannot simultaneously guarantee both strong Consistency and full Availability. It must choose either CP (prefer consistency, may reject requests) or AP (prefer availability, may return stale data).

Q20. Explain BASE properties and compare them with ACID properties.

Answer:

BASE:

  • Basically Available → System tries to respond even if some nodes are down.
  • Soft State → State can change due to background replication.
  • Eventual Consistency → Replicas will eventually become consistent.

Comparison:

ACID focuses on immediate correctness and reliability (good for banking).

BASE focuses on high availability and scalability, accepting temporary inconsistency (good for social feeds, recommendations).

Q21. Write short notes on Document databases and Key-Value stores with suitable examples.

Answer:

Document Databases: Store data as flexible JSON/BSON documents. Ideal for nested data (product catalogues, user profiles). Example: MongoDB.

Key-Value Stores: Simplest form – unique key mapped to a value. Extremely fast for lookup. Ideal for sessions, caches, shopping carts. Example: Redis.

Q22. Differentiate between Column-oriented (Wide-Column) NoSQL databases and Graph databases.

Answer:

Wide-Column: Data organised by row key + column families. Excellent for massive write workloads, IoT, time-series data (Cassandra, HBase).

Graph: Data stored as nodes, edges and properties. Excellent for relationship traversal, social networks, fraud detection, recommendations (Neo4j).

Q23. What is Polyglot Persistence? Give an example.

Answer:

Polyglot Persistence is the practice of using multiple database technologies in the same application, each chosen for the specific needs of a component.

Example (E-commerce):

  • Payments → Relational
  • Product Catalogue → Document
  • Sessions → Key-Value
  • Recommendations → Graph
  • Clickstream logs → Wide-Column

Part C – Long Answer / Essay Questions (10 Marks Each)

Q24. Discuss the need for NoSQL databases. Explain the limitations of relational databases in large-scale distributed applications and the advantages offered by NoSQL systems.

Answer:

(Structure your answer with these points)

  • Growth of web, cloud, mobile, IoT and big data.
  • Limitations of RDBMS: fixed schema, vertical scaling difficulty, expensive joins at scale, impedance mismatch.
  • Advantages of NoSQL: flexible schema, horizontal scaling, high availability, better handling of semi-structured and distributed data, different data models for different access patterns.
  • Conclusion: Relational and NoSQL are complementary; choose based on workload.

Q25. Explain the CAP theorem in detail. Use examples to show the difference between CP and AP systems. Why is Partition Tolerance important?

Answer:

  • State the CAP theorem.
  • Explain C, A and P clearly.
  • CP Example: Bank ATM – prefers correctness, may refuse transactions during partition.
  • AP Example: Instagram likes – stays available, may show temporarily outdated counts.
  • CA is only realistic without partitions (single server).
  • Partition Tolerance is mandatory in real distributed systems because network failures are inevitable.

Q26. Describe the four major types of NoSQL databases. For each type, explain its data model, strengths, limitations and suitable real-world use cases.

Answer:

Cover Document, Key-Value, Wide-Column and Graph with:

  • Data model
  • Strengths
  • Limitations
  • Examples
  • Use cases (catalogues, sessions, IoT, social networks/fraud)

Q27. Explain strategic database selection. What factors should be considered before choosing a database for a software project? Support your answer with examples.

Answer:

List the 10–12 factors (Data Structure, Query Pattern, Transaction needs, Scalability, Consistency, Latency, Availability, Schema flexibility, Security, Team skill, Cost, Integration).

Explain the principle: “Start from the queries, not the database brand.”

Give mapping examples (financial → Relational, sessions → Key-Value, sensors → Wide-Column, fraud → Graph, mixed → Polyglot).


Part D – Analytical / Case-Based Questions

Q28. Case Study – Online Learning Platform

A start-up is building an online learning platform. It must store student profiles, course videos, login sessions, course recommendations, and activity logs from thousands of learners. The team expects rapid growth and wants low response time.

  1. Which database type would you choose for student profiles and why?
  2. Which database type for login sessions and why?
  3. Which database type for activity logs and why?
  4. Which database type for recommending courses based on relationships among learners, skills and courses?
  5. Would you recommend a single database or Polyglot Persistence? Justify.

Answers:

  1. Document – Flexible nested structure (skills, address, projects, progress).
  2. Key-Value – Extremely fast lookup by session ID + easy expiry.
  3. Wide-Column – High write volume, time-series nature of logs.
  4. Graph – Relationships (learner–skill–course) are central.
  5. Polyglot Persistence – Different components have different requirements; single database would force compromises.

Q29. Construct a detailed table comparing Relational databases, Document, Key-Value, Wide-Column and Graph databases across at least eight dimensions. Then write a short paragraph explaining when a business should choose each model.

Answer:

Create a table with dimensions such as: Data Model, Schema, Scalability, Consistency, Joins/Traversals, Transaction Support, Best Use Cases, Query Style, Examples, etc.

Paragraph:

  • Relational → Structured transactional data needing strong consistency.
  • Document → Flexible nested data (catalogues, profiles).
  • Key-Value → Simple ultra-fast lookups (sessions, cache).
  • Wide-Column → Massive write-heavy time-series / logs.
  • Graph → Relationship-heavy problems (social, fraud, recommendations).

Extra High-Value Questions from PDF Content

Q30. Explain “Eventual Consistency” with a real-world example from social media.

Answer: When a user likes a photo, different servers may temporarily show different like counts. After a few seconds/minutes of background synchronisation, all servers show the same final count. This is acceptable for likes but not for bank balances.

Q31. Differentiate between Soft State and Eventual Consistency with examples.

Answer:

Soft State → System state can change without new user input (because of background replication). Example: WhatsApp profile picture updating automatically on another friend’s phone.

Eventual Consistency → All replicas will converge to the same value if no new updates occur. Example: Instagram likes finally becoming the same everywhere.

Q32. Why is CA not practical for truly distributed systems?

Answer: CA assumes no network partitions. In real distributed systems running across regions or multiple data centres, network partitions are inevitable. Hence systems must choose between CP and AP.


On this page