Sample questions
Question 1Easy
Which statement about a domain constraint is correct?
- It forbids NULL in primary keys
- It restricts the values an attribute may take
- It links two tables through keys
- It controls who may read a table
Answer: B. It restricts the values an attribute may take
Explanation
Domain constraints include data types, ranges and CHECK conditions on a column.
Step-by-step solution
- A domain is the set of allowed values for an attribute.
- Domain constraints enforce type, range or format, such as age between 0 and 150.
- So they restrict the values an attribute may take.
Why the other options are wrong
- A. That is entity integrity.
- C. That is referential integrity.
- D. That is access control.
Tip: Domain = allowed values (type, range, CHECK).
Question 2Easy
A view in a relational database is best described as:
- A backup snapshot of the database
- A virtual table defined by a stored query
- A physical copy of a table
- An index on several columns
Answer: B. A virtual table defined by a stored query
Explanation
A view stores only its defining query; its rows are computed from the base tables when it is used (unless it is materialised).
Step-by-step solution
- A view is defined by a stored SELECT query.
- It stores no data of its own (unless materialised).
- Querying it runs the stored query on the base tables.
Why the other options are wrong
- A. A backup is a stored copy, not a query.
- C. A view is not a physical copy.
- D. An index speeds lookups; it is not a table.
Tip: View = saved query, not saved data.
Question 3Easy
Which is a key advantage of a DBMS over storing data in separate application files?
- Reduced redundancy and controlled concurrent access
- Programs no longer need any queries
- Every file is automatically encrypted
- Data never needs to be backed up
Answer: A. Reduced redundancy and controlled concurrent access
Explanation
A DBMS centralises data, enforces integrity constraints, supports concurrent users and provides recovery, all of which ad hoc files lack.
Step-by-step solution
- Separate files duplicate data and become inconsistent.
- A DBMS centralises data and reduces redundancy.
- It also handles concurrent access, security and recovery.
Why the other options are wrong
- B. Programs still query the DBMS.
- C. Encryption is optional, not automatic.
- D. Backups are still needed.
Tip: DBMS benefits: less redundancy, concurrency, integrity, security, recovery.
Question 4Easy
In a two-tier client-server database architecture, the application logic runs mainly on the:
- Database server
- Load balancer
- Web server
- Client
Answer: D. Client
Explanation
Two-tier clients talk directly to the database server; three-tier systems add an application server in the middle.
Step-by-step solution
- Two-tier: client application talks directly to the database server.
- Application and presentation logic run on the client.
- The server mainly runs the DBMS.
Why the other options are wrong
- A. The server mainly handles data storage and queries.
- B. Load balancers are not part of two-tier designs.
- C. A separate web or application server is the extra tier in three-tier designs.
Tip: Two-tier: client + DB. Three-tier: client + app server + DB.
Question 5Medium
In a data warehouse star schema, the central table holding measures such as sales amount is the:
- Dimension table
- Lookup index
- Fact table
- Staging table
Answer: C. Fact table
Explanation
The fact table holds numeric measures with foreign keys to dimension tables such as Date, Product and Store.
Step-by-step solution
- A star schema has one central table with dimension tables around it.
- The central table stores measurable facts, such as sales amount.
- It is the fact table, with foreign keys to each dimension.
Why the other options are wrong
- A. Dimension tables describe context, like date or product.
- B. Not a star-schema term.
- D. Staging tables hold raw data before loading.
Tip: Fact = numbers; dimensions = by what.
Question 6Medium
For a social network that frequently asks "friends of friends who like X", which kind of database fits best?
- Key-value store
- Column-family store
- Flat file
- Graph database
Answer: D. Graph database
Explanation
Graph databases store relationships directly as edges, so multi-hop traversals avoid repeated joins.
Step-by-step solution
- "Friends of friends" means following relationships several hops.
- Graph databases store relationships directly as edges.
- Multi-hop traversals are fast there, while relational databases need repeated joins.
Why the other options are wrong
- A. Key-value stores cannot follow relationships.
- B. Column-family stores suit wide, write-heavy data.
- C. Flat files have no query support for relationships.
Tip: Relationships and multi-hop queries = graph database.
Question 7Medium
Which kind of view is generally NOT updatable through standard SQL?
- A view with a simple WHERE filter on one table
- A view that renames columns of one table
- A view selecting some columns of one table including its key
- A view that uses GROUP BY with aggregates
Answer: D. A view that uses GROUP BY with aggregates
Explanation
An aggregated row does not correspond to one base row, so the DBMS cannot map an update back to the table.
Step-by-step solution
- A GROUP BY row summarises many base rows.
- An update to a total cannot be traced back to specific rows.
- So such views are not updatable.
Why the other options are wrong
- A. A simple filter on one table maps each view row to one base row.
- B. Renaming columns keeps the one-to-one mapping.
- C. Including the key makes each view row traceable.
Tip: Aggregates or DISTINCT in a view = not updatable.
Question 8Medium
- Code that runs automatically when a specified event occurs on a table
- A type of index on a foreign key
- A lock held until commit
- A scheduled job that runs at fixed times of day, such as a nightly backup
Answer: A. Code that runs automatically when a specified event occurs on a table
Explanation
Triggers fire on INSERT, UPDATE or DELETE events, before or after the change, and can enforce complex rules or audit changes.
Step-by-step solution
- A trigger is attached to a table and an event (INSERT, UPDATE, DELETE).
- When the event happens, the trigger runs automatically.
- Example: write an audit row whenever a salary changes.
Why the other options are wrong
- B. Triggers are code, not indexes.
- C. Locks are concurrency tools.
- D. Time-based jobs are scheduled jobs, not triggers.
Tip: Trigger = event-driven code on a table.
Question 9Medium
Horizontal partitioning (sharding) of a Customer table means:
- Different columns are stored on different servers
- Different rows are stored on different servers
- The table is split into a view and a base table
- Every server stores a full copy
Answer: B. Different rows are stored on different servers
Explanation
- Sharding splits rows by a shard key (e.g. region);
- vertical partitioning splits columns.
Step-by-step solution
- Horizontal partitioning splits by rows.
- For example, customers A to M on server 1 and N to Z on server 2.
- Each server holds the same columns for different rows.
Why the other options are wrong
- A. Splitting columns is vertical partitioning.
- C. Views are not partitions.
- D. Full copies are replication.
Tip: Horizontal = rows; vertical = columns.
Question 10Medium
BASE, often used to describe many NoSQL systems, stands for:
- Basically Available, Soft state, Eventually consistent
- Batch, Atomic, Serial, Exclusive
- Balanced, Atomic, Stable, Expandable
- Basic Availability, Strong Encryption
Answer: A. Basically Available, Soft state, Eventually consistent
Explanation
BASE relaxes ACID's immediate consistency in favour of availability; replicas converge over time.
Step-by-step solution
- B = Basically Available.
- S = Soft state (state may change without input as replicas sync).
- E = Eventually consistent.
Why the other options are wrong
- B. This is a made-up expansion.
- C. This is a made-up expansion.
- D. This is incomplete and incorrect.
Tip: BASE = Basically Available, Soft state, Eventually consistent.
Practise all 18 questions free
The full question bank with timed practice, progress tracking and Vidya, your AI tutor. Free, no ads.
Open this topic in the app →