Independent Preparation Bank for Pakistani Computing Graduates • 100% Free • No Signup
NSCTTest.
Simulator
Home/Subjects/Databases & SQL/Relational Algebra & Calculus
Databases & SQLTopic #3 of 446 MCQs Available

Relational Algebra & Calculus

Comprehensive question bank, step-by-step rationales, and dedicated timed quiz for Relational Algebra & Calculus.

Launch Quiz Mode ↗

Relational Algebra & Calculus Question Bank

Showing 46 questions of 46 with verified answers

14Multiple Choice

(Conceptual) What is a Non-Equijoin?

15Multiple Choice

(Scenario-Based) You have a table with millions of duplicate rows due to a bug. You want to delete duplicates but keep exactly one instance of each record. Which approach is most efficient?

16Multiple Choice

(Code-Tracing) What is the result of the HAVING clause in this query?

17Multiple Choice

(Calculation) If Relation R(A, B,

18Multiple Choice

(Conceptual) What is a Scalar Subquery?

19Multiple Choice

(Scenario-Based) An e-commerce company wants to keep an audit trail. Every time a price is updated in the Products table, the old price and the time of change must be saved into a Price_History table automatically. Which SQL object is designed for this?

20Multiple Choice

(Code-Tracing) Trace the logic of this three-table join. Which customers will appear in the output?

1Multiple Choice

(Scenario-Based) A school database has a table Student_Courses(student_id, student_name, course_id, course_fee). If the school increases the fee for 'CS101', the admin must update every single row where a student is enrolled in 'CS101'. Failing to update one row creates a data conflict. What is this problem called?

2Multiple Choice

(Code-Tracing) Examine the following SQL table definition. Why does this table violate 1NF (First Normal Form)?

3Multiple Choice

(Calculation) A relation R(A, B, C,

4Multiple Choice

(Conceptual) In a table with a composite primary key (OrderID, ProductID), a non-prime attribute OrderDate depends only on OrderID. Which normal form is being violated?

5Multiple Choice

(Scenario-Based) You have a Staff table: (staff_id, name, dept_id, dept_manager_id). The Primary Key is staff_id. The dependencies are: staff_id → dept_id and dept_id → dept_manager_id. What is the highest normal form this table satisfies?

6Multiple Choice

(Code-Tracing) A senior architect suggests "Denormalizing" a high-traffic analytics table. What is the most likely reason for this recommendation?

7Multiple Choice

(Comparison) What is the key difference between 3NF and BCNF?

8Multiple Choice

(Calculation) Given the relation R(A, B,

9Multiple Choice

(Conceptual) A decomposition of a relation R into R1 and R2 is said to be Lossless- Join if:

10Multiple Choice

(Scenario-Based) In an Orders table, if deleting a single customer's last order also results in the database losing all of that customer's contact information (because it was only stored in the order record), what anomaly has occurred?

11Multiple Choice

(Calculation) A relation R(P, Q, R, S, T) has FDs: {P → Q, RS → T, Q → S}. What is the closure {P, R}+?

12Multiple Choice

(Code-Tracing) You are auditing a database and find the following schema. Which normal form does it currently violate?

13Multiple Choice

(Comparison) Why is Dependency Preservation an important goal during normalization?

14Multiple Choice

(Scenario-Based) A database currently in 3NF has two candidate keys: (StudentID, CourseI

15Multiple Choice

(Calculation) How many candidate keys exist for R(A, B,

16Multiple Choice

(Conceptual) What is a Multi-valued Dependency (MVD), which is the focus of 4NF?

17Multiple Choice

(Scenario-Based) A developer refuses to normalize a table because they claim "the data is small and JOINs are slow." Which risk are they primarily ignoring?

18Multiple Choice

(Calculation) If a relation is in BCNF, which of the following is also guaranteed to be TRUE?

19Multiple Choice

(Conceptual) In database normalization theory, what is the "Minimal Cover" (or Canonical Cover)?

20Multiple Choice

(Code-Tracing) You are tasked with fixing a 2NF violation in a schema. What is the standard SQL procedure to achieve this?

1Multiple Choice

(Scenario-Based) During a high-volume sale, a customer completes a purchase. The inventory is decremented, and the payment is processed. However, before the shipping label is generated, the database server loses power. Upon reboot, the system reverts the inventory and payment records to their state before the purchase began. Which ACID property is being enforced?

2Multiple Choice

(Code-Tracing) Analyze the following transaction block. What will be the final value of balance in the database for id = 1?

3Multiple Choice

(Conceptual) In the standard transaction state diagram, what is the critical difference between the Partially Committed state and the Committed state?

4Multiple Choice

(Scenario-Based) A developer writes a transaction that transfers 500 from Account A to Account B. If the developer accidentally writes code that adds 500 to Account B but only subtracts 400 from Account A, the database will finish in an invalid state. This is a violation of which property?

5Multiple Choice

(Code-Tracing) What is the result of the following psql session?

6Multiple Choice

(Comparison) How does Durability typically handle data that is currently in the DB's RAM buffer but has not yet been written to the data file when a crash occurs?

7Multiple Choice

(Conceptual) A transaction that cannot be completed successfully due to an internal error (like a deadlock or a hardware read failure) enters which state?

8Multiple Choice

(Scenario-Based) In a multi-user environment, User A is calculating the sum of all account balances. Simultaneously, User B transfers 100 from one account to another. User A's report must not see User B's partial work (e.g., seeing one account deducted but not yet the other credited). This is a requirement for:

9Multiple Choice

(Calculation/Comparison) Consider the "Log Sequence" below for an "Undo/Redo" recovery strategy. If a Checkpoint occurred at Time T, and the system crashed at T+1, which transactions must be Redone?

10Multiple Choice

(Code-Tracing) In most RDBMS (like MySQL/PostgreSQL), what is the default behavior of a single SQL statement (e.g., UPDATE x SET y=1;) not wrapped in an explicit transaction block?

11Multiple Choice

(Conceptual) Which database component is primarily responsible for ensuring the Atomicity and Durability of transactions?

12Multiple Choice

(Comparison) What is the advantage of using Shadow Paging over Log-based recovery?

13Multiple Choice

(Scenario-Based) An application requires that if a transaction is committed on a database in the USA, a synchronized backup database in Singapore must also have that data permanently stored before the transaction is acknowledged as "Success" to the user. This is an example of:

14Multiple Choice

(Calculation/Comparison) Given the following transaction sequence, which statement describes the Durability requirement?

15Multiple Choice

(Conceptual) If a database is in a state where it satisfies all defined Integrity Constraints (Primary Keys, Foreign Keys, Check Constraints), it is said to have:

1Multiple Choice

(Scenario-Based) User A and User B are both trying to buy the last ticket for a concert. 1. User A reads the ticket count (Count = 1). 2. User B reads the ticket count (Count = 1). 3. User A decrements the count and writes (Count = 0). 4. User B decrements the count and writes (Count = 0). Both users receive a "Success" message, but only one physical ticket exists. Which concurrency problem occurred?

2Multiple Choice

(Code-Tracing) Analyze the following SQL execution sequence between two sessions. What will Transaction 1 see at Time T3?

3Multiple Choice

(Conceptual) A schedule is considered Conflict Serializable if:

22Multiple Choice

A table is in Second Normal Form (2NF) if it is in 1NF and contains no: