Unit 6
Unit 6
Topic 1: DBMS vs. Traditional File System & Architecture with detailed explanations:
1. Which of the following is not an advantage of using a DBMS over a file-based system?
A) Better storage
B) Data abstraction
C) Faster input
D) Enhanced encryption
A) Query processor
B) Transaction manager
C) Compiler
D) File manager
Answer: C) Compiler
Explanation: Compiler is part of programming environments, not DBMS components.
A) Data encryption
B) User interface
C) Physical storage of data
D) Conceptual relationships
A) Centralized control
B) Difficulty in enforcing security
C) Easy data sharing
D) Minimal redundancy
A) Removing data
B) Data encryption
C) Hiding low-level details
D) Providing user interface
A) Backup
B) Data conversion
C) Consistency
D) Data independence
10. Which term describes changing data format in DBMS architecture without affecting
application programs?
A) Data control
B) Data integrity
C) Logical data independence
D) Data redundancy
Answer: C) Logical data independence
Explanation: Logical data independence allows changes in the logical schema without altering
applications.
A) Internal level
B) Abstract level
C) Conceptual level
D) External level
A) Codd
B) ANSI/SPARC
C) Oracle
D) Microsoft
Answer: B) ANSI/SPARC
Explanation: ANSI/SPARC proposed the 3-schema architecture model for DBMS systems.
15. Which of the following does not contribute to the complexity of a traditional file-based
system?
A) Data redundancy
B) File formats differ
C) Lack of concurrency control
D) Logical abstraction
A) Data redundancy
B) Use of SQL
C) Use of RDBMS
D) Use of foreign keys
17. Which term refers to ability to change the storage structure without affecting application
programs?
A) Data consistency
B) Program-data dependence
C) Concurrent access
D) Centralized control
A) Separate files
B) Data dictionaries and constraints
C) Use of BIOS
D) More storage
Key Takeaways:
Topic 2: Relational Model & Keys (including ER Model) with detailed explanations:
A) Schema
B) Attribute
C) Record or tuple
D) Domain
A) Entities
B) Attributes
C) Tuples
D) Keys
Answer: B) Attributes
Explanation: Each column in a table is called an attribute.
A) Attribute
B) Foreign key
C) Relationship
D) Tuple
Answer: C) Relationship
Explanation: Relationships define associations among entities in ER models.
8. Which of the following is not a type of relationship in an ER model?
A) One-to-one
B) One-to-many
C) Many-to-many
D) Many-to-one-to-one
Answer: D) Many-to-one-to-one
Explanation: Only 1:1, 1:N, and M:N relationships exist.
A) Atomicity
B) Normalization
C) Integrity
D) Key constraint
Answer: A) Atomicity
Explanation: Attributes should be atomic (indivisible) in the relational model.
A) A set of relationships
B) A set of tuples
C) A set of entities of the same type
D) A primary key
A) Foreign key
B) Candidate key
C) Super key
D) Primary key
A) Primary key
B) Foreign key
C) Candidate key
D) Super key
A) Dotted line
B) Arrowhead
C) Double rectangle
D) Double line
A) Rectangle
B) Double ellipse
C) Dotted ellipse
D) Diamond
Answer: C) Dotted ellipse
Explanation: Derived attributes (e.g., age from DOB) are shown using dotted ellipse.
A) Ellipse
B) Rectangle
C) Diamond
D) Line
Answer: C) Diamond
Explanation: Relationships are represented by diamonds.
A) Number of rows
B) Number of columns
C) Number of relationships
D) Number of entity instances that can be related
A) Redundant field
B) Field that must have unique and non-null values
C) Field with duplicated values
D) Foreign key
19. Which key is derived from the ER model and implemented in the relational model?
A) Surrogate key
B) Alternate key
C) Foreign key
D) Composite key
A) Adding redundancy
B) Eliminating relationships
C) Mapping entities and relationships to tables
D) Encrypting data
Key Takeaways:
A) 1NF
B) 2NF
C) 3NF
D) BCNF
Answer: C) 3NF
Explanation: 3NF removes transitive dependencies to ensure non-key attributes are only
dependent on primary key.
8. What type of dependency does BCNF eliminate that 3NF may not?
A) Functional dependency
B) Partial dependency
C) Transitive dependency
D) Anomalous dependency
A) Deadlock
B) Redundancy
C) Transaction failure
D) Indexing
Answer: B) Redundancy
Explanation: Normalization reduces data redundancy and anomalies like insertion, deletion,
and update issues.
A) Donald Chamberlin
B) Edgar F. Codd
C) Charles Babbage
D) Chris Date
A) Integrity rule
B) Logical data independence
C) Systematic treatment of null values
D) Guaranteed access rule
A) Faster access
B) Data consistency
C) Insertion anomaly
D) Greater integrity
Answer: C) Insertion anomaly
Explanation: Anomalies (insertion, deletion, update) occur in unnormalized tables.
A) 1NF
B) 2NF
C) 3NF
D) BCNF
Answer: A) 1NF
Explanation: 1NF requires all attributes to be atomic.
A) Tables
B) Attributes
C) Rows
D) Keys
Answer: B) Attributes
Explanation: A functional dependency exists when one attribute determines another.
20. What is the correct order of normal forms from lowest to highest?
Key Takeaways:
A) Atomicity
B) Consistency
C) Isolation
D) Durability
E) Redundancy
Answer: E) Redundancy
Explanation: ACID stands for Atomicity, Consistency, Isolation, Durability.
3. The isolation property of a transaction ensures:
4. Atomicity means:
A) Deadlock
B) Lost update
C) Dirty read
D) All of the above
A) Encryption
B) Locking
C) Backup
D) Redundancy
Answer: B) Locking
Explanation: Locking is the most common method to control concurrent access to data.
A) Shadow paging
B) Timestamp ordering
C) Logging
D) Redundancy
Answer: B) When two or more transactions wait indefinitely for each other’s locks
Explanation: Deadlock is a common concurrency issue that must be handled.
14. Which property of a transaction ensures the database remains in a valid state?
A) Atomicity
B) Isolation
C) Consistency
D) Durability
Answer: C) Consistency
Explanation: Consistency ensures that a transaction transforms the database from one valid
state to another.
A) A backup plan
B) The order in which transactions are executed
C) The number of queries run
D) A system restart method
A) Cascading schedule
B) Strict schedule
C) Serializable schedule
D) Serial schedule
A) Fast execution
B) Consistent results
C) Anomalies like dirty read or lost update
D) Lower CPU usage
Answer: C) Anomalies like dirty read or lost update
Explanation: Isolation prevents concurrent anomalies.
18. Which concurrency problem occurs when a transaction overwrites another transaction’s
changes?
A) Dirty read
B) Lost update
C) Phantom read
D) Deadlock
A) Backup data
B) Recover from crashes
C) Ensure atomic commit in distributed systems
D) Increase redundancy
Key Takeaways:
ACID properties define transaction correctness.
Concurrency control prevents anomalies like lost update, dirty read, and deadlock.
A) GET
B) OPEN
C) SELECT
D) EXTRACT
Answer: C) SELECT
Explanation: SELECT is used to retrieve data from a table.
3. What is the correct SQL syntax to retrieve all columns from a table named Employees?
A) UNIQUE
B) NO DUPLICATE
C) DISTINCT
D) REMOVE
Answer: C) DISTINCT
Explanation: DISTINCT eliminates duplicate values.
A) To insert data
B) To update data
C) To delete data
D) To sort the result
A) APPEND
B) INSERT INTO
C) ADD RECORD
D) PUT
A) MODIFY
B) CHANGE
C) ALTER
D) UPDATE
Answer: D) UPDATE
Explanation: UPDATE changes existing records in a table.
8. Which of the following SQL statements will delete all rows in a table without deleting the
table?
9. What is the correct syntax of the SQL JOIN to combine rows from two or more tables?
10. Which JOIN returns all records from both tables when there is a match or not?
A) INNER JOIN
B) LEFT JOIN
C) RIGHT JOIN
D) FULL OUTER JOIN
A) SUM()
B) TOTAL()
C) COUNT()
D) LENGTH()
Answer: C) COUNT(*)
Explanation: COUNT(*) returns total number of rows.
12. Which SQL clause is used with aggregate functions to group results?
A) GROUP BY
B) ORDER BY
C) WHERE
D) UNION
Answer: A) GROUP BY
Explanation: Used to group data based on one or more columns.
A) SELECT
B) WHERE
C) SUM
D) JOIN
Answer: C) SUM
Explanation: SUM, AVG, MAX, MIN, and COUNT are aggregate functions.
A) Minimum salary
B) Maximum salary
C) Total salary
D) Average salary
A) A secondary database
B) A comment
C) A query inside another query
D) A join query
A) WHERE
B) FILTER
C) HAVING
D) GROUP
Answer: C) HAVING
Explanation: HAVING filters group results (unlike WHERE).
A) Exact match
B) Wildcard search
C) Sorting
D) Deleting
19. Which operator is used to combine the results of two SELECT queries?
A) AND
B) INTERSECT
C) UNION
D) JOIN
Answer: C) UNION
Explanation: UNION merges results and removes duplicates.
20. What will happen if a subquery returns more than one row in a context that expects only
one?
A) Executes normally
B) Raises error
C) Returns null
D) Skips subquery
Key Takeaways:
Practice the usage of SELECT, WHERE, JOIN, GROUP BY, HAVING, subqueries, and
aggregate functions.
1.
Table: Employees
sql
CopyEdit
A) 32500
B) 30000
C) 35000
D) 27500
Answer: A) 32500
Explanation: Average of 30000 and 35000 = (30000+35000)/2 = 32500
2.
sql
CopyEdit
Answer: 2
Explanation: Ram (30000) and Ravi (35000) > 28000
3.
sql
CopyEdit
A) 85000
B) 90000
C) 95000
D) 80000
Answer: B) 90000
Explanation: 30000 + 25000 + 35000 = 90000
4.
CopyEdit
Answer: B) 6
Explanation: 10 – 4 = 6
5.
sql
CopyEdit
Answer: 35000
Explanation: Highest salary is 35000
6.
sql
CopyEdit
Answer: 25000
Explanation: Lowest salary is 25000
7.
sql
CopyEdit
SELECT COUNT(DISTINCT DeptID) FROM Employees;
Answer: 2
Explanation: DeptID values = 1 and 2
8.
Date Amount
2024-05-01 500
2024-05-02 600
2024-05-03 700
sql
CopyEdit
Answer: 600
Explanation: (500+600+700)/3 = 1800/3 = 600
9.
sql
CopyEdit
SELECT SUM(Amount) FROM Sales WHERE Date BETWEEN '2024-05-01' AND '2024-05-02';
Answer: 1100
Explanation: 500 + 600
10.
A 80
B 75
C 90
sql
CopyEdit
Answer: 1
Explanation: Only C has marks > 80
11.
sql
CopyEdit
Answer: 82
Explanation: (80+75+90)/3 = 81.66 ≈ 82
12.
Assume:
sql
CopyEdit
Answer: 245 % 3 = 2
Explanation: 80+75+90 = 245 → 245 % 3 = 2
13.
If:
sql
CopyEdit
Answer: 3
Explanation: All students in range 75–90
14.
sql
CopyEdit
Answer: 1
Explanation: Only one name starts with A
15.
sql
CopyEdit
16.
sql
CopyEdit
17.
If we update Price = Price * 2 where Price < 200, what will be the new price of 150?
Answer: 300
18.
sql
CopyEdit
19.
Given:
1 30000 5000
2 25000 4000
sql
CopyEdit
Answer:
1 → 35000
2 → 29000
20.
sql
CopyEdit
A) 14
B) 15
C) 16
D) 17
Answer: D) 17
Explanation: 8 (Computer) + 9 (Science) = 17