Blog
Introduction to Database Management Past Paper 2015 – BS IT 3rd Term UOS (CMP-210)
University of Sargodha BS IT 3rd term Introduction to Database Management (CMP-210) paper, 2015 exam (80 marks, 2:30 hours). The paper has been retyped, and solved answers are given below for all 16 short questions and all six long questions, including SQL views, hash indexes, client/server and three-tier architectures, database security and the benefits of the database approach.
Solved answers
Q1 – Short answers (16 × 2)
I. Conditions for a weak entity: (1) It is existence-dependent – it cannot exist without its owner (parent) entity; (2) its primary key is partially or totally derived from the owner’s primary key (it has no sufficient key of its own).
II. Strong (identifying) relationship: A relationship in which the primary key of the related (child) entity contains the primary key of the parent entity – it links a weak entity to its owner. In Crow’s Foot ERD it is drawn with a solid line (in Chen notation with a double diamond).
III. “An employee may have many degrees”: Degree cannot be a single attribute of EMPLOYEE; it becomes a multivalued attribute that is converted into a new entity DEGREE (often a weak entity) with a 1:M relationship EMPLOYEE has DEGREE, and attributes such as degree type, institution and year.
IV. Composite entity: An associative (bridge) entity used to implement a M:N relationship as two 1:M relationships; its primary key is made of the primary keys of the entities it connects, e.g. ENROLL between STUDENT and CLASS.
V. Partial dependency: When a non-key attribute depends on only part of a composite primary key, e.g. in (StudentID, CourseID) → StudentName depends only on StudentID. It is removed in second normal form (2NF).
VI. Three data anomalies: Insertion, update (modification) and deletion anomalies. They are eliminated by normalisation (decomposing tables to 2NF/3NF/BCNF) so each fact is stored once.
VII. Transitive dependency: A non-key attribute depends on another non-key attribute: A → B and B → C, so A → C, e.g. EmpID → DeptNo → DeptName. It is removed in third normal form by putting DeptNo, DeptName in a separate table.
VIII. Surrogate key: A system-generated artificial primary key with no business meaning (e.g. auto-increment ID). Use it when the natural key is composite, long, changeable or not unique.
IX. Single-attribute key and 2NF: A partial dependency can occur only when the primary key is composite. With a single-attribute key, no attribute can depend on “part” of the key, so a 1NF table is automatically in 2NF.
X. Database authorisation: Granting or restricting users’ rights to access database objects and perform operations (SELECT, INSERT, UPDATE, DELETE), e.g. with GRANT and REVOKE and roles.
XI. Decomposition: Splitting a relation into two or more smaller relations to remove redundancy and anomalies during normalisation; it should be lossless-join and dependency-preserving.
XII. Backup strategies (names): Full backup strategy, incremental strategy, differential strategy, mirrored/replicated backup, online (hot) and offline (cold) backup, local and off-site/cloud backup.
XIII. Backup types (names): Full, incremental, differential, transaction-log (concurrent), and snapshot/mirror backups.
XIV. Replication: Storing copies (replicas) of data or fragments at more than one site in a distributed database to improve availability, reliability and performance; changes are propagated synchronously or asynchronously.
XV. Distributed catalogue management: Managing the data dictionary (metadata about fragments, replicas, locations and users) in a distributed DBMS – it can be centralised, fully replicated at every site, or partitioned/partially replicated – so queries can be located and processed efficiently.
XVI. Tuning schema: Changing the logical/physical design (denormalising, splitting or merging tables, adding indexes or materialised views, partitioning) to improve database performance for the actual workload.
Q2 – Views in SQL
A view is a virtual table based on the result of a SELECT query. It stores only the definition, not the data; when it is queried, the DBMS runs the underlying query on the base tables.
CREATE VIEW cs_students AS
SELECT StudentID, Name, CGPA
FROM STUDENT
WHERE Program = 'BSCS';
SELECT * FROM cs_students WHERE CGPA >= 3.5; -- use like a table
CREATE OR REPLACE VIEW ...; -- modify
DROP VIEW cs_students; -- removeAdvantages: security – users see only allowed columns/rows; simplicity – complex joins and calculations are hidden behind a simple name; logical data independence – base tables can change while views stay the same; consistency – everyone uses the same query logic; customised presentation for different users.
Disadvantages: performance overhead because the query is executed each time (unless materialised); restrictions on updating – views with joins, GROUP BY, DISTINCT or aggregates are usually not updatable; dependence on base tables – dropping or changing a table can break the view; nested views can become complex to maintain.
Q3 – Hash index and clustering
Benefits of a hash index: a hash function maps the search key directly to a bucket, so equality searches (WHERE id = 105) need about one block access – constant average time O(1), faster than tree indexes; it is simple and good for large tables with exact-match lookups and joins (hash joins). It is not useful for range queries or sorting.
Purpose of clustering data: storing related records physically close together on disk – records with the same or adjacent key values, or related records from different tables (e.g. a department with its employees) in the same block. This reduces the number of block reads for range queries, ordered retrieval and joins, and improves cache use.
Q4 – Advantages of client/server architecture
- Better use of resources – processing is divided between client (interface) and server (data management).
- Centralised data and control – easier backup, security and integrity.
- Scalability – more clients or more powerful servers can be added.
- Reduced network traffic – only queries and results are sent, not whole files.
- Platform independence and openness – different client machines and operating systems can access the same server via standard protocols (SQL, TCP/IP).
- Improved user interfaces (GUI) on client machines.
- Concurrent access by many users with locking and transaction control.
- Lower cost than mainframes, using PCs and commodity servers.
- Easier maintenance and upgrades of server software without changing clients.
Q5 – Database security
Database security is the protection of the database against unauthorised access, misuse, modification or destruction, maintaining confidentiality, integrity and availability.
- Authentication: user IDs and passwords, multi-factor authentication.
- Authorisation / access control: discretionary access control with GRANT/REVOKE and privileges; role-based access control; mandatory access control with security labels.
- Views: show users only the data they are allowed to see.
- Encryption: of stored data and of data in transit (SSL/TLS).
- Auditing: audit trails/logs of who accessed or changed what.
- Integrity constraints and validation; prevention of SQL injection.
- Backup and recovery to protect availability.
- Physical security of servers and network firewalls.
Q6 – Three-tier architecture
Three tiers: presentation (client/browser), application/business logic (application or web server) and data (database server).
Advantages: separation of concerns – each tier can be developed, changed and scaled independently; better security – clients never access the database directly; scalability and load balancing at the middle tier; reusability of business logic for many clients (web, mobile); thin clients and easier deployment; improved data integrity because all updates pass through business rules.
Disadvantages: more complex to design, build, test and maintain; higher cost (more servers and software); extra network communication can add latency; the middle tier can become a bottleneck or single point of failure without redundancy; more configuration and security management.
Q7 – Ten benefits of the database approach
- Control of data redundancy – data stored once.
- Data consistency – fewer conflicting copies.
- Data sharing among many users and applications.
- Improved data integrity through constraints.
- Improved security with central access control.
- Enforcement of standards for names, formats and documentation.
- Program–data independence – changes in structure do not require program changes.
- Improved data accessibility and responsiveness through query languages (SQL).
- Better backup and recovery services.
- Concurrency control for multi-user access.
- (Also: reduced program maintenance, economy of scale, more information from the same data, better decision making.)
