Independent Preparation Bank for Pakistani Computing Graduates • 100% Free • No Signup
NSCTPrep.
Home/Subjects/Databases & SQL/Database System Architecture
Databases & SQLTopic #2 of 446 MCQs Available

Database System Architecture

Comprehensive question bank, step-by-step rationales, and dedicated timed quiz for Database System Architecture.

Launch Quiz Mode ↗

Database System Architecture Question Bank

Showing 46 questions of 46 with verified answers

1Multiple Choice

(Conceptual) Which of the following best describes the fundamental difference between Relational Algebra and Relational Calculus?

2Multiple Choice

(Calculation) Relation R has 10 tuples and Relation S has 20 tuples. If we perform the operation R ∪ S, what is the minimum and maximum possible number of tuples in the result? (Assume R and S are union-compatible).

3Multiple Choice

(Notation-Tracing) A developer writes the following algebraic expression to retrieve data from a Products table: πname, price ( σcategory = 'Electronics' (Products) ) In plain English, what does this expression do?

4Multiple Choice

(Conceptual) For the Set Difference (R - S) operation to be valid, which of the following conditions must be met?

5Multiple Choice

(Scenario-Based) A marketing team wants a list of all Customers who have never placed an Order. Which relational algebra operator is best suited for this task?

6Multiple Choice

(Code-Tracing) Trace the logic of the following Tuple Relational Calculus expression: { t | t ∈ Employees ∧ t.salary > 5000 } calculus-engine // Relation: Employees // id | name | salary // 1 | John | 4000 // 2 | Sarah | 6000 // 3 | Mike | 5500

7Multiple Choice

(Calculation) Relation R has degree 3 (A, B,

8Multiple Choice

(Conceptual) Why is the Rename (ρ) operator considered essential in Relational Algebra, particularly during a Self-Join scenario?

9Multiple Choice

(Scenario-Based) A query in Relational Calculus is said to be "Unsafe" if it can potentially return an infinite number of tuples. Which of the following is an example of an unsafe expression?

10Multiple Choice

(Notation-Tracing) In Relational Algebra, which operator is mathematically equivalent to a Cartesian Product followed by a Selection based on a join condition?

11Multiple Choice

(Comparison) What is the primary difference between Tuple Relational Calculus (TR

12Multiple Choice

(Calculation) Relation R(A,

1Multiple Choice

(Code-Tracing) A developer executes the following query on a Products table. What will be the final calculated value in the discounted_price column for a product with a price of 100 and a tax of 10? • • • •

2Multiple Choice

(Conceptual) Which of the following SQL keywords is strictly required to remove duplicate rows from the result set of a SELECT query?

3Multiple Choice

(Scenario-Based) A marketing database contains a Customers table. You need to find all customers whose names start with 'S' and end with 'n' (e.g., 'Steven', 'Susan'). Which WHERE clause is correct?

4Multiple Choice

(Calculation) A table Survey has a column feedback. There are 10 rows total: 7 rows have text comments, and 3 rows have NULL values. What will be the result of SELECT COUNT(feedback) FROM Survey;?

5Multiple Choice

(Code-Tracing) Observe the following logical conditions in a WHERE clause. Which rows will be returned?

6Multiple Choice

(Scenario-Based) A database administrator needs to change the data type of the phone_number column from INT to VARCHAR(20) in an existing Contacts table. Which SQL command should be used? sql-logic-test - Table Data: (id, category, stock) - 1, 'A', 10 - 2, 'B', 50 - 3, 'A', 100 SELECT * FROM inventory WHERE category = 'A' OR category = 'B' AND stock > 60;

7Multiple Choice

(Conceptual) Why is the TRUNCATE command generally much faster than the DELETE command for removing all rows from a large table?

8Multiple Choice

(Code-Tracing) What is the result of the following query if the salary column contains a NULL for the employee 'Bob'?

9Multiple Choice

(Calculation) You need to sort a list of students by grade (highest first) and then by last_name alphabetically for students with the same grade. Which clause is correct?

10Multiple Choice

(Scenario-Based) A banking application needs to find all accounts that do not have a secondary_owner assigned. Which SQL condition is mathematically correct?

11Multiple Choice

(Conceptual) In SQL, which of the following is true about the BETWEEN operator (e.g., WHERE price BETWEEN 10 AND 20)?

12Multiple Choice

(Code-Tracing) Trace the output of this update operation. How many rows are affected? postgres - update_test - Table: score(id, val) - (1, 10), (2, 20), (3, 30), (4, 40)

13Multiple Choice

(Scenario-Based) You need to add a new employee to the database, but you only know their name and department. The salary should be left for later. Which SQL syntax is correct?

14Multiple Choice

(Calculation) What is the result of SELECT AVG(val) FROM T; if table T has values: 10, 20, NULL, 30?

15Multiple Choice

(Conceptual) The AS keyword in SQL is primarily used for:

16Multiple Choice

(Code-Tracing) Which query returns exactly the same result as: SELECT * FROM Items WHERE id IN (1, 2, 3);?

17Multiple Choice

(Scenario-Based) An HR database needs to delete all employees who belong to the 'Temporary' department. Which statement is correct?

18Multiple Choice

(Calculation) If a table has 100 rows and you execute SELECT DISTINCT country FROM Users;, and 40 users are from 'USA', 40 are from 'UK', and 20 are from 'Germany', how many rows are in the result?

19Multiple Choice

(Code-Tracing) What does the following command achieve?

20Multiple Choice

(Conceptual) Which of the following is a key requirement for the UNION operator to work between two SELECT statements?

1Multiple Choice

(Code-Tracing) Analyze the following tables and the query below. What will be the result of the query?

2Multiple Choice

(Scenario-Based) You have an Employees table with columns emp_id, name, and manager_id. Which SQL technique is required to generate a list of all employees alongside the name of their direct manager in a single result set?

3Multiple Choice

(Conceptual) What defines a Correlated Subquery in SQL?

4Multiple Choice

(Code-Tracing) What is the purpose of the WITH clause in the following SQL snippet?

5Multiple Choice

(Calculation) Table A has 5 rows and Table B has 10 rows. If you perform a CROSS JOIN between A and B, but the WHERE clause contains a condition that is always false (e.g., WHERE 1=0), how many rows will be returned?

6Multiple Choice

(Scenario-Based) A bank wants a list of customers who have a "Savings Account" but do not have a "Credit Card". Both accounts are stored in the Accounts(cust_id, type) table. Which set operator is most appropriate?

7Multiple Choice

(Code-Tracing) Examine the window function below. If three employees have the exact same salary and are tied for the highest pay, what will the RANK() function return for them?

8Multiple Choice

(Comparison) What is the primary operational difference between a standard VIEW and a MATERIALIZED VIEW?

9Multiple Choice

(Calculation) Table T1 has 3 rows with values {1, 2, NULL}. Table T2 has 3 rows with {1, NULL, NULL}. How many rows are returned by an INNER JOIN on these tables using T1.val = T2.val?

10Multiple Choice

(Code-Tracing) What does the EXISTS keyword do in the following query? mysql - subquery_test SELECT name FROM Departments d WHERE EXISTS ( SELECT 1 FROM Employees e WHERE e.dept_id = d.id AND e.salary > 10000

11Multiple Choice

(Scenario-Based) Which of the following is the most standard SQL approach to find the second highest salary in an Employees table without using window functions?

12Multiple Choice

(Comparison) When should a developer prefer UNION ALL over UNION?

13Multiple Choice

(Code-Tracing) Analyze the use of the CASE expression. What is returned for a product with stock = 0?

23Multiple Choice

In transaction management, what does the 'D' (Durability) in ACID guarantee?