Skip to main content

Chapter 9

Database Management System (old course)

TU BIM past exam questions

Past questions and answers

215 questions set from this chapter, 6 of them more than once; 2 are most repeated (set, or a close variant set, in 3 or more exams). Most repeated first.

  • Most repeated · 3 of 15 exams
  • Asked 2 times
  • 2010 AD · 1 mark
  • 2011 AD · 1 mark

What do you mean by embedded SQL?

Similar questions: What do you mean by embedded sql? (2012 AD)

Answer

Embedded SQL means placing SQL statements inside a host programming language such as C, Java or COBOL. A precompiler translates the SQL statements (usually marked with EXEC SQL) into calls of the host language. It lets the program use database facilities while the host language provides control structures and user interface.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Most repeated · 3 of 15 exams
  • 2012 AD · 1 mark

What do you mean by embedded sql?

Similar questions: What do you mean by embedded SQL? (2011 AD)

Answer

Embedded SQL means SQL statements are written inside a host programming language (such as C, C++ or Java), so that the program can access the database. SQL statements are marked with a prefix such as EXEC SQL and terminated with a delimiter; a precompiler replaces them with function calls to the DBMS library before the program is compiled. Host variables, prefixed with a colon, exchange data between the program and SQL, and cursors are used to process query results one row at a time.

EXEC SQL SELECT name INTO :n FROM student WHERE roll = :r;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Asked 2 times
  • 2007 AD · 1 mark
  • 2013 AD · 1 mark

What is insertion anomaly?

Answer

An insertion anomaly occurs when certain data cannot be inserted into a table without also inserting other unrelated data, because of redundancy in the design.

Example: in Student(RollNo, Name, CourseID, CourseName), a new course cannot be added until at least one student enrols in it, since RollNo (part of the key) cannot be null.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Asked 2 times
  • 2007 AD · 1 mark
  • 2013 AD · 1 mark

What is trigger? Write syntax to define trigger in SQL.

Answer

A trigger is a stored procedure-like block of code that is executed automatically by the DBMS in response to an event (INSERT, UPDATE or DELETE) on a table. It is used to enforce business rules, auditing and maintain derived data.

Syntax:

CREATE TRIGGER trigger_name
{BEFORE | AFTER} {INSERT | UPDATE | DELETE}
ON table_name
FOR EACH ROW
BEGIN
    -- trigger body (SQL statements)
END;

Example:

CREATE TRIGGER log_delete
AFTER DELETE ON Student
FOR EACH ROW
INSERT INTO Audit(RollNo, Action) VALUES (OLD.RollNo, 'deleted');

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Asked 2 times
  • 2008 AD · 1 mark
  • 2013 AD · 1 mark

What do you mean by extraneous attributes?

Answer

An attribute is extraneous in a functional dependency if it can be removed from the dependency without changing the closure of the set of dependencies. For FF and α→β\alpha \rightarrow \beta:

  • AA is extraneous in α\alpha if A∈αA \in \alpha and FF implies (α−A)→β(\alpha - A) \rightarrow \beta.
  • AA is extraneous in β\beta if A∈βA \in \beta and (F−{α→β})∪{α→(β−A)}(F - \{\alpha \rightarrow \beta\}) \cup \{\alpha \rightarrow (\beta - A)\} implies α→β\alpha \rightarrow \beta.

Example: with F={A→C,AB→C}F=\{A \rightarrow C, AB \rightarrow C\}, BB is extraneous in AB→CAB \rightarrow C.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Asked 2 times
  • 2010 AD · 1 mark
  • 2011 AD · 1 mark

Define trigger.

Answer

A trigger is a statement stored in the database that the DBMS executes automatically as a side effect of a modification (INSERT, UPDATE or DELETE) on a specified table. It is defined by an event, an optional condition and an action (the ECA model), and is used to enforce complex integrity rules, auditing and automatic updates.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • Asked 2 times
  • 2011 AD · 1 mark
  • 2013 AD · 1 mark

What is view? Write syntax to define a view in SQL.

Answer

A view is a virtual relation that does not store data itself; it is defined by a query over one or more base tables and is computed when used. Views hide data (security) and simplify complex queries.

Syntax:

CREATE VIEW view_name [(column_list)] AS
  <query expression>;

Example:

CREATE VIEW cs_students AS
  SELECT roll, name FROM student WHERE dept = 'CS';

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 1 mark

What are the fundamental operations of Relational algebra?

Similar questions: What are the fundamental operations in relational (2013 AD)

Answer

The fundamental operations of relational algebra are:

  1. Select (σ\sigma): chooses tuples that satisfy a condition.
  2. Project (π\pi): chooses specified attributes (columns).
  3. Union (∪\cup): tuples in either relation.
  4. Set difference (−-): tuples in one relation but not in the other.
  5. Cartesian product (×\times): all combinations of tuples from two relations.
  6. Rename (ρ\rho): renames a relation or attributes.

Operations such as join, intersection and division can be derived from these.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 1 mark

Why is embedded SQL required?

Similar questions: Why embedded SQL is required? (2013 AD)

Answer

Embedded SQL is required because SQL alone is not a complete programming language: it has no loops, conditions or user-interface facilities. By embedding SQL statements in a host language (C, Java, COBOL), programs can use the full power of the language for computation, control flow, input and output and report generation, while accessing the database through SQL. It also allows queries to be written for applications that need the result processed row by row.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 5 marks

What is data abstraction? Explain the different levels of data abstractions.

Similar questions: Explain the different levels of data abstractions (2013 AD)

Answer

Data abstraction is the process of hiding the details of how data is stored and maintained and showing users only the information relevant to them. It makes the system easy to use while the complexity is hidden. A DBMS provides three levels of abstraction.

1. Physical level (internal level)

The lowest level. It describes how the data is actually stored on the disk, including file organization, indexes, storage structures and access paths. Only database administrators and system programmers deal with it.

2. Logical level (conceptual level)

The next higher level. It describes what data is stored in the database and the relationships among the data: tables, attributes, data types, keys and constraints. It is the view of the database administrator, and physical details are hidden.

3. View level (external level)

The highest level. It describes only the part of the database relevant to a particular user or application. Many different views may exist for the same database, which also gives security by hiding the rest of the data.

Data independence: Because of these levels, a change at a lower level does not affect the level above it. Physical data independence is the ability to change the physical schema without changing the logical schema, and logical data independence is the ability to change the logical schema without changing the views or application programs.

Example: for a Student table, the view level shows a student his own marks, the logical level defines the attributes RollNo, Name, Marks, and the physical level stores the records in blocks of a file with a B+ tree index.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

Write statement of third Normal Form.

Similar questions: Write statement of third Normal form (2009 AD)

Answer

A relation RR is in third normal form (3NF) if it is in 2NF and, for every non-trivial functional dependency X→AX \rightarrow A in RR, either XX is a superkey, or AA is a prime attribute (part of some candidate key). Equivalently, no non-prime attribute is transitively dependent on a key.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

Write statement of third Normal form.

Similar questions: Write statement of third Normal Form (2008 AD)

Answer

A relation RR is in third normal form (3NF) if it is in 2NF and, for every non-trivial functional dependency X→AX \rightarrow A in RR, either XX is a superkey, or AA is a prime attribute (part of some candidate key). Equivalently, no non-prime attribute is transitively dependent on a key.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 1 mark

What do you mean by Functional dependency?

Similar questions: What do you mean by functional dependency? (2014 AD)

Answer

A functional dependency X→YX \to Y between sets of attributes of a relation RR means that whenever two tuples agree on the values of XX, they must also agree on the values of YY; the value of XX determines the value of YY. For example, roll→nameroll \to name in a STUDENT relation. Functional dependencies are the basis for keys and normalization.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 1 mark

What are the fundamental operations in relational algebra?

Similar questions: What are the fundamental operations of Relational (2007 AD)

Answer

The fundamental (basic) operations of relational algebra are:

  1. Select (σ\sigma): chooses tuples satisfying a condition.
  2. Project (π\pi): chooses specified attributes (columns).
  3. Union (∪\cup): tuples in either relation.
  4. Set difference (−-): tuples in one relation but not the other.
  5. Cartesian product (×\times): all combinations of tuples of two relations.
  6. Rename (ρ\rho): renames a relation or its attributes.

All other operations, such as join, intersection and division, can be expressed using these.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 1 mark

Why embedded SQL is required?

Similar questions: Why is embedded SQL required? (2007 AD)

Answer

Embedded SQL is required because SQL alone is declarative and cannot do everything a general-purpose language can, such as complex computation, loops, user interfaces and report generation. By embedding SQL statements in a host language (C, Java, COBOL), applications get the full power of the programming language together with database access. Some queries also cannot be expressed in SQL alone, and results often need to be processed one row at a time.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 3 marks

Explain the different levels of data abstractions.

Similar questions: What is data abstraction? Explain the different (2007 AD)

Answer

Data abstraction hides the complex details of data storage from users. A database system has three levels.

  1. Physical level (internal level): the lowest level. It describes how the data is actually stored on disk, such as file organisation, indexes, and blocks.
  2. Logical level (conceptual level): describes what data is stored and the relationships among the data (entities, attributes, constraints). Database administrators work at this level, without worrying about physical details.
  3. View level (external level): the highest level. It describes only the part of the database relevant to a particular user or group, and hides the rest. A database can have many views, which also helps security.

The levels are linked by mappings, which give data independence between them.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

What do you mean by functional dependency?

Similar questions: What do you mean by Functional dependency? (2011 AD)

Answer

A functional dependency X→YX \to Y between two sets of attributes of a relation means that the value of XX uniquely determines the value of YY: if two tuples have the same XX value, they must have the same YY value. For example, roll_no → name.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

Why should organizations use database?

Similar questions: Why should organizations use database? Explain (2019 AD)

Answer

Organizations use a database to store large amounts of data in an organized way, reduce redundancy and inconsistency, share data among many users, enforce security and integrity, allow fast and flexible retrieval through queries, and support backup, recovery and decision making.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 5 marks

Why should organizations use database? Explain.

Similar questions: Why should organizations use database? (2017 AD)

Answer

Organizations should use a database (managed by a DBMS) instead of file-based systems for the following reasons.

  • Reduced data redundancy and inconsistency: data is stored once in a central place, so duplicate copies do not drift apart.
  • Data sharing: many users and applications can access the same data concurrently.
  • Data integrity: integrity constraints (keys, domain, referential) keep data correct and valid.
  • Security: access rights and authorization control who can view or change data.
  • Concurrency control: simultaneous transactions are handled without producing wrong results.
  • Backup and recovery: the DBMS restores data after failures, giving reliability.
  • Data independence: programs are insulated from changes in storage structure.
  • Efficient query and retrieval: SQL and indexing give fast, flexible access to data, helping decision making.
  • Standards enforcement and lower maintenance cost: centralized control makes standards easier to apply and reduces development effort.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 1 mark

What is referential integrity? Give an example.

Answer

Referential integrity is a constraint which ensures that a foreign key value in one relation must either be null or match an existing primary key value in the referenced relation. It prevents references to non-existent tuples.

Example: in Student(RollNo, Name, DeptID) and Department(DeptID, DeptName), DeptID in Student is a foreign key referencing Department. A student cannot be inserted with DeptID = 9 if no department with ID 9 exists.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 1 mark

What do you understand by extraneous attributes?

Answer

An attribute in a functional dependency is extraneous if it can be removed from the left or right side without changing the closure of the set of dependencies.

For a set FF and a dependency α→β\alpha \to \beta:

  • Attribute AA is extraneous in α\alpha if A∈αA \in \alpha and FF implies (F−{α→β})∪{(α−A)→β}(F - \{\alpha \to \beta\}) \cup \{(\alpha - A) \to \beta\}.
  • Attribute AA is extraneous in β\beta if A∈βA \in \beta and the set (F−{α→β})∪{α→(β−A)}(F - \{\alpha \to \beta\}) \cup \{\alpha \to (\beta - A)\} implies FF.

Example: with F={A→C, AB→C}F = \{A \to C,\ AB \to C\}, BB is extraneous in AB→CAB \to C because A→CA \to C already holds. Removing extraneous attributes is a step in finding the canonical cover.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 1 mark

What is the advantage of view in database?

Answer

Advantages of a view:

  • Security: users see only selected rows and columns, hiding sensitive data.
  • Simplicity: a complex query (joins, aggregates) can be saved as a view and used like a table.
  • Logical data independence: the view stays the same even if the underlying tables change.
  • Different users can see the same data in different forms.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 1 mark

Define transitive and partial functional dependencies.

Answer

Partial functional dependency: In a relation with a composite primary key, an attribute that depends on only a part of the key is partially dependent. For key (A,B)(A, B), if A→CA \to C holds where CC is a non-key attribute, then CC is partially dependent on the key. Example: in Enrol(StudentID, CourseID, StudentName), StudentID→StudentNameStudentID \to StudentName.

Transitive functional dependency: If A→BA \to B and B→CB \to C hold, and B↛AB \not\to A, then A→CA \to C is a transitive dependency; CC depends on AA through the non-key attribute BB. Example: EmpID→DeptIDEmpID \to DeptID and DeptID→DeptNameDeptID \to DeptName gives EmpID→DeptNameEmpID \to DeptName.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 1 mark

What do you understand by schema of a database?

Answer

The schema of a database is its overall logical design or structure. It describes the tables (relations), their attributes, data types, keys and constraints and the relationships among them, but not the actual data. It changes rarely, whereas the data stored in it (the instance) changes often.

Example: Student(RollNo, Name, Address).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 1 mark

What is role of buffer manager?

Answer

The buffer manager is the DBMS component that manages the main-memory buffer. It fetches disk blocks into the buffer when they are needed, decides which block to replace (using a policy such as LRU) when the buffer is full, writes modified blocks back to disk, and keeps frequently used blocks in memory. This reduces disk I/O and speeds up query processing.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 5 marks

What is normalization? Explain 1NF and 2NF with examples.

Answer

Normalization is the process of organizing the attributes and relations of a database to reduce data redundancy and avoid insertion, update and deletion anomalies. It does this by decomposing a relation into smaller relations using functional dependencies, without losing information (lossless decomposition).

First Normal Form (1NF)

A relation is in 1NF if every attribute contains only atomic (indivisible) values; there are no multivalued attributes or repeating groups.

Not in 1NF:

StudentIDNamePhone
1Ram9841, 9851

In 1NF (each cell has a single value):

StudentIDNamePhone
1Ram9841
1Ram9851

Alternatively, phone numbers can be moved to a separate relation StudentPhone(StudentID, Phone).

Second Normal Form (2NF)

A relation is in 2NF if it is in 1NF and every non-key attribute is fully functionally dependent on the whole primary key, i.e. there is no partial dependency. It matters only when the key is composite.

Example: Enrol(StudentID, CourseID, StudentName, Grade) with key (StudentID,CourseID)(StudentID, CourseID).

  • StudentID→StudentNameStudentID \to StudentName is a partial dependency, so the relation is not in 2NF.
  • (StudentID,CourseID)→Grade(StudentID, CourseID) \to Grade is a full dependency.

Decompose into:

  • Student(StudentID, StudentName)
  • Enrol(StudentID, CourseID, Grade)

Now every non-key attribute depends on the whole key, so both relations are in 2NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2007 AD · 5 marks

Consider the following relational database of a college.
Student(RollNumber, StudentName, Address)
Teachers(TeacherID, TecherName, TeachingSubject)
College(RollNumber, TeacherID)
Write SQL or Relational algebra expression for the following requests.
a. Find the name of Students who live in Lalitpur. b. Find the name of teacher who teaches Database Management System subject. c. Find the name of teacher who teaches Computer Organization subject to John Smith student. d. Insert a new tuple into relation teachers. e. Delete records of students whose address is "Pokhara".

Answer

(a) Students who live in Lalitpur

SQL:

SELECT StudentName FROM Student WHERE Address = 'Lalitpur';

Relational algebra: πStudentName(σAddress=′Lalitpur′(Student))\pi_{StudentName}(\sigma_{Address='Lalitpur'}(Student))

(b) Teachers who teach Database Management System

SQL:

SELECT TecherName FROM Teachers
WHERE TeachingSubject = 'Database Management System';

Relational algebra: πTecherName(σTeachingSubject=′Database Management System′(Teachers))\pi_{TecherName}(\sigma_{TeachingSubject='Database\ Management\ System'}(Teachers))

(c) Teacher who teaches Computer Organization to student John Smith

SQL:

SELECT T.TecherName
FROM Teachers T, College C, Student S
WHERE T.TeacherID = C.TeacherID
  AND C.RollNumber = S.RollNumber
  AND T.TeachingSubject = 'Computer Organization'
  AND S.StudentName = 'John Smith';

Relational algebra: πTecherName(σTeachingSubject=′Computer Organization′∧StudentName=′John Smith′(Teachers⋈College⋈Student))\pi_{TecherName}\big(\sigma_{TeachingSubject='Computer\ Organization' \wedge StudentName='John\ Smith'}(Teachers \bowtie College \bowtie Student)\big)

(d) Insert a new tuple into Teachers

INSERT INTO Teachers (TeacherID, TecherName, TeachingSubject)
VALUES (101, 'Hari Sharma', 'Database Management System');

Relational algebra: Teachers←Teachers∪{(101,Hari Sharma,Database Management System)}Teachers \leftarrow Teachers \cup \{(101, \text{Hari Sharma}, \text{Database Management System})\}

(e) Delete records of students whose address is Pokhara

DELETE FROM Student WHERE Address = 'Pokhara';

Relational algebra: Student←Student−σAddress=′Pokhara′(Student)Student \leftarrow Student - \sigma_{Address='Pokhara'}(Student)

(If College references Student through a foreign key, the related College tuples must also be deleted, or ON DELETE CASCADE used, to keep referential integrity.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

What is database?

Answer

A database is an organized collection of related data, stored so that it can be easily accessed, managed and updated. Example: the records of students, courses and results of a college.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

Which operator of Relational algebra is used to delete existing record from relation (table)?

Answer

The difference operator (−-) is used to delete records. To delete the tuples satisfying a condition from relation rr: r←r−σcondition(r)r \leftarrow r - \sigma_{condition}(r).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

Write syntax of SQL update statement.

Answer

UPDATE table_name
SET column1 = value1, column2 = value2, ...
[WHERE condition];

Example: UPDATE Student SET Age = 22 WHERE Roll = 5;. Without WHERE, all rows are updated.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

Write syntax to create a view.

Answer

CREATE VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
[WHERE condition];

Example: CREATE VIEW CS_Students AS SELECT Roll, Name FROM Student WHERE Dept = 'CS';

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

What is foreign key?

Answer

A foreign key is an attribute (or set of attributes) in one relation whose values must match the primary key (or a candidate key) values of another relation, or be null. It links two relations and enforces referential integrity. Example: Roll in Class referencing Roll in Student.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

What is cardinality constraint?

Answer

A cardinality constraint (mapping cardinality) in an E-R model specifies the number of entities of one entity set that can be associated with entities of another set through a relationship set. The types are one-to-one, one-to-many, many-to-one and many-to-many.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

What is the role of storage manager?

Answer

The storage manager is the DBMS component that provides the interface between the low-level data stored on disk and the application programs and queries. Its roles:

  • Interacting with the file manager to store, retrieve and update data on disk.
  • Authorization and integrity management (checking integrity constraints and user access rights).
  • Transaction management (keeping the database consistent despite failures and concurrent access).
  • Buffer management (moving data between disk and main memory) and maintaining indices and data files.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 1 mark

What is a strong entity set?

Answer

A strong entity set is an entity set that has a primary key of its own, formed from its own attributes, so its entities can be uniquely identified without depending on any other entity set. It is drawn with a single rectangle. Example: Student with key Roll.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 5 marks

What is Database Management System (DBMS)? What are data independence and three level architecture of DBMS? Explain in detail.

Answer

DBMS. A Database Management System is software that lets users define, create, maintain and control access to a database. It provides an environment to store and retrieve data conveniently and efficiently, with security, integrity, concurrency control and recovery. Examples: MySQL, Oracle, SQL Server.

Data independence. The ability to change the schema at one level without having to change the schema at the next higher level.

  • Physical data independence: the physical (internal) schema can be changed, for example file organization, indexes or storage devices, without changing the conceptual schema or application programs.
  • Logical data independence: the conceptual schema can be changed, for example by adding an attribute or entity, without changing external schemas or application programs. It is harder to achieve.

Three-level architecture (ANSI/SPARC).

  1. External (view) level: the user's view. Each user group sees only the part of the database relevant to it, through external schemas or views. It hides the rest of the data.
  2. Conceptual (logical) level: describes the whole database for the community of users: entities, attributes, relationships, constraints, security and integrity. It hides storage details.
  3. Internal (physical) level: describes how data is actually stored: file structures, indexes, record formats and access paths.

The mappings between levels (external/conceptual and conceptual/internal) are maintained by the DBMS and provide data independence. Changes at a lower level are absorbed by changing the mapping, so users and programs are unaffected.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 5 marks

What is SQL Data Definition Language (DDL)? Write SQL DDL statements for following relations (tables)
Relation NameField (attribute Name)Data TypeConstraint
StudentRollIntegerPrimary Key
StudentAgeIntegerValue Must be>20
StudentGenderVarchar (10)Value must be either Male or female
ClassClass noIntegerPrimary Key
ClassRollIntegerForeign Key References Student relation
ClassNumber Of StudentIntegerValue Must be>0

Answer

SQL DDL is the part of SQL used to define and modify the structure of database objects (schema). Its commands include CREATE, ALTER, DROP and TRUNCATE. It also specifies constraints such as primary key, foreign key, CHECK and NOT NULL.

CREATE TABLE Student (
    Roll   INTEGER PRIMARY KEY,
    Age    INTEGER CHECK (Age > 20),
    Gender VARCHAR(10) CHECK (Gender IN ('Male', 'Female'))
);

CREATE TABLE Class (
    ClassNo         INTEGER PRIMARY KEY,
    Roll            INTEGER,
    NumberOfStudent INTEGER CHECK (NumberOfStudent > 0),
    FOREIGN KEY (Roll) REFERENCES Student(Roll)
);

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 5 marks

What is generalization and specialization? Explain different types of constraints on Generalizations with examples.

Answer

Generalization is a bottom-up process: several lower-level entity sets that share common attributes are combined into a higher-level entity set. Example: Car and Truck are generalized into Vehicle, which holds the common attributes.

Specialization is a top-down process: a higher-level entity set is divided into lower-level entity sets that have distinctive attributes or relationships. Example: Employee is specialized into Manager and Clerk. The lower-level sets inherit the attributes of the higher-level set (ISA relationship).

Constraints on generalization

  1. Condition-defined vs user-defined (membership constraint). In condition-defined, membership is decided by a condition on an attribute (for example job_type = "manager"). In user-defined, the database user assigns each entity to a lower-level set, with no explicit condition.
  2. Disjoint vs overlapping. Disjoint means an entity can belong to at most one lower-level set (an account is either Savings or Current). Overlapping means an entity may belong to more than one (a person can be both Employee and Student).
  3. Completeness constraint. Total means every higher-level entity must belong to at least one lower-level set (every Account is Savings or Current). Partial means some higher-level entities need not belong to any lower-level set (an Employee need not be a Manager or Clerk).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 5 marks

Explain extraneous attributes and write a algorithm to calculate canonical cover for a set of functional dependencies F.

Answer

Extraneous attributes. An attribute of a functional dependency is extraneous if removing it does not change the closure F+F^+ of the set of dependencies.

  • A∈αA \in \alpha is extraneous in α→β\alpha \rightarrow \beta if FF implies (α−A)→β(\alpha - A) \rightarrow \beta. Test: compute (α−A)+(\alpha - A)^+ under FF; if it contains β\beta, AA is extraneous.
  • A∈βA \in \beta is extraneous if F′=(F−{α→β})∪{α→(β−A)}F' = (F - \{\alpha \rightarrow \beta\}) \cup \{\alpha \rightarrow (\beta - A)\} implies FF. Test: compute α+\alpha^+ under F′F'; if it contains AA, AA is extraneous.

Canonical cover FcF_c is a minimal set equivalent to FF in which no dependency has an extraneous attribute and every left side is unique.

Algorithm

Fc = F
repeat
    // Combine using the union rule
    for each pair a1 -> b1 and a1 -> b2 in Fc:
        replace them with a1 -> b1 b2
    // Remove extraneous attributes
    find a dependency a -> b in Fc with an extraneous attribute
        either in a or in b
    if found, delete the extraneous attribute from a -> b
until Fc does not change

Each loop gives a set equivalent to FF. Example: F={A→BC, B→C, A→B, AB→C}F=\{A\rightarrow BC,\ B\rightarrow C,\ A\rightarrow B,\ AB\rightarrow C\}. Union gives A→BCA\rightarrow BC. In AB→CAB\rightarrow C, AA is extraneous because B→CB \rightarrow C, so it becomes B→CB\rightarrow C. CC is extraneous in A→BCA\rightarrow BC because A→B→CA\rightarrow B\rightarrow C. So Fc={A→B, B→C}F_c=\{A\rightarrow B,\ B\rightarrow C\}.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 5 marks

Why is normalization required? Explain with examples.

Answer

Normalization is the process of decomposing relations to remove redundancy and undesirable dependencies, using functional dependencies and normal forms (1NF, 2NF, 3NF, BCNF). It is required because poorly designed relations suffer from anomalies:

Consider Emp_Dept(EmpID, EmpName, DeptID, DeptName) with DeptID→DeptNameDeptID \rightarrow DeptName.

EmpIDEmpNameDeptIDDeptName
1RamD1Sales
2SitaD1Sales
3HariD2HR
  • Redundancy: Sales is stored again for every employee of D1, wasting space.
  • Update anomaly: changing the name of D1 needs many rows to be updated; missing one causes inconsistency.
  • Insertion anomaly: a new department with no employee cannot be added without null EmpID (a primary key part).
  • Deletion anomaly: deleting Hari (the only D2 employee) also deletes the fact that D2 is HR.

Decomposing into Employee(EmpID, EmpName, DeptID) and Department(DeptID, DeptName) removes these problems, with a lossless join and dependency preservation.

So normalization reduces redundancy, avoids anomalies, saves storage, improves integrity and keeps the design logically consistent.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 5 marks

What is Relational Algebra (R.A)? Explain operators of RA to do following operations with examples.
i. Natural join. ii. Inserting of new record iii. Update of record

Answer

Relational algebra is a procedural query language. It has a set of operators that take one or two relations as input and produce a new relation as output. Basic operators: select (σ\sigma), project (π\pi), union (∪\cup), set difference (−-), Cartesian product (×\times) and rename (ρ\rho). Others are derived, such as join and intersection.

i. Natural join (⋈\bowtie). r⋈sr \bowtie s combines tuples of rr and ss that have equal values on all common attributes, and keeps one copy of each common attribute. It is defined as r⋈s=πR∪S(σr.A1=s.A1∧⋯∧r.An=s.An(r×s))r \bowtie s = \pi_{R \cup S}\big(\sigma_{r.A_1 = s.A_1 \wedge \dots \wedge r.A_n = s.A_n}(r \times s)\big) Example: Student(Roll, Name) ⋈\bowtie Result(Roll, Marks) gives (Roll, Name, Marks) for matching rolls.

ii. Inserting a new record. Use union with a relation holding the new tuple: r←r∪{(101,"Ram",22)}r \leftarrow r \cup \{(101, \text{"Ram"}, 22)\}

iii. Update of a record. Delete the old tuple using difference, then insert the changed one using union (or use the generalized projection): r←πRoll, Name, 23(σRoll=101(r))∪(r−σRoll=101(r))r \leftarrow \pi_{Roll,\ Name,\ 23}\big(\sigma_{Roll=101}(r)\big) \cup \big(r - \sigma_{Roll=101}(r)\big) This changes the age of the student with Roll 101 to 23.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 5 marks

What are fixed-length records and variable-length records? Explain Sequential File Organization in detail.

Answer

Fixed-length records. Every record in the file has the same size, for example Account(acc_no CHAR(10), branch CHAR(22), balance NUMERIC(8)) is 40 bytes each. Record ii starts at byte n×(i−1)n\times(i-1), so access is simple. Deletion leaves a gap which must be filled by moving records or by a free list linked from the file header. Space is wasted when values are shorter than the field size.

Variable-length records. Records of the same file differ in size, because of variable-length fields (VARCHAR), repeating fields or multiple record types. Each record stores an offset/length for variable fields and a null bitmap. They save space but are harder to locate, update and delete; the slotted-page structure is commonly used.

Sequential file organization. Records are stored in order, based on a search key (such as primary key), and are linked by pointers in search-key order.

  • Good for processing the entire file and for range queries, as records are read in order.
  • Reading a record by key can use binary search if the file is physically sorted.
  • Insertion: find the position by key; if free space exists in the block, insert there, otherwise put the record in an overflow block and link it by pointer.
  • Deletion: pointer chains are updated and the record's space is freed.
  • The file needs periodic reorganization to restore physical order.
  • Disadvantage: slow random access and costly insert/delete.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2008 AD · 5 marks

Consider following relational database:
Author (Author ID, Author name, address, age)
Book (book_id, name, price)
Writers (Author Id, book_id)
Write SQL or Relational Algebra expression for the following requests:
a. Find name of all books whose price is greater than average price of all books. b. Find name of all Author who live in same place as author "Hari" lives. c. List name of all books written by author with Author ID=7 d. List name of books whose price is greater than 500 and less than 1,000 or whose name starts with 'M'. e. List names of all Authors whose age is less than minimum age of all Authors

Answer

a.

SELECT name FROM Book
WHERE price > (SELECT AVG(price) FROM Book);

b.

SELECT A.Author_name FROM Author A
WHERE A.address = (SELECT address FROM Author WHERE Author_name = 'Hari');

c.

SELECT B.name FROM Book B, Writers W
WHERE B.book_id = W.book_id AND W.Author_ID = 7;

Relational algebra: πname(Book⋈σAuthor_ID=7(Writers))\pi_{name}\big(Book \bowtie \sigma_{Author\_ID=7}(Writers)\big)

d.

SELECT name FROM Book
WHERE (price > 500 AND price < 1000) OR name LIKE 'M%';

e.

SELECT Author_name FROM Author
WHERE age < (SELECT MIN(age) FROM Author);

The result of (e) is always empty, because no age can be less than the minimum age of the same relation.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

What do you mean by canonical cover of functional dependency?

Answer

A canonical cover FcF_c of a set of functional dependencies FF is a minimal set equivalent to FF (so Fc+=F+F_c^+ = F^+) in which no dependency contains an extraneous attribute and each left side is unique. It is used to reduce the cost of checking dependencies during updates.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

What is three-tier architecture?

Answer

Three-tier architecture divides an application into three layers:

  1. Presentation tier (client): the user interface, such as a browser or form.
  2. Application (business logic) tier: processes requests, applies business rules and talks to the database.
  3. Data tier: the database server that stores and manages the data.

The client never communicates directly with the database, which improves security, scalability and maintainability. Web applications commonly use it.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

Define closure of attribute.

Answer

The closure of an attribute set α\alpha under a set of functional dependencies FF, written α+\alpha^+, is the set of all attributes that are functionally determined by α\alpha using FF. If α+\alpha^+ contains all attributes of the relation, α\alpha is a superkey.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

What is NULL value?

Answer

NULL is a special marker meaning that the value of an attribute is unknown, missing or not applicable. It is not zero or an empty string. Comparisons with NULL give unknown, so IS NULL is used to test it. Primary key attributes cannot be NULL.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

What do you mean by file organization?

Answer

File organization is the way records of a file are arranged and stored on secondary storage (disk) so that they can be accessed efficiently. Common methods are heap (unordered), sequential, hash and indexed (clustering) file organization.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

What is partial dependency?

Answer

A partial dependency exists when a non-prime attribute depends on only part of a composite candidate key rather than on the whole key. Example: in Enrol(StudentID, CourseID, StudentName, Grade) with key (StudentID, CourseID), StudentID→StudentNameStudentID \rightarrow StudentName is a partial dependency. It must be removed to reach 2NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

How weak entity set can be made strong?

Answer

A weak entity set can be made strong by adding to it attributes that form a primary key of its own (for example, a unique identifier). It then no longer depends on an owner entity set for identification and need not have an identifying relationship.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

If Relation r1 has 3 rows and Relation r2 has 5 rows, how many rows will be returned by the Cartesian product of r1 x r2?

Answer

15 rows. The Cartesian product contains every pairing of a tuple of r1r_1 with a tuple of r2r_2, so 3×5=153 \times 5 = 15.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 1 mark

Why is normalization essential?

Answer

Normalization is essential to remove data redundancy and avoid insertion, update and deletion anomalies. It saves storage, keeps data consistent and gives a logical, well-structured design by decomposing relations using functional dependencies.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 5 marks

What is Database Management System (DBMS)? How DBMS can hide low level details from the users? Explain.

Answer

A Database Management System (DBMS) is software that allows users to define, create, store, retrieve, update and control access to a database, while providing security, integrity, concurrency control and recovery. Examples: Oracle, MySQL, SQL Server.

Hiding low-level details. The DBMS uses data abstraction with three levels, so users are not exposed to how data is stored:

  • Physical level: the lowest level, describing how data is actually stored (files, blocks, indexes, access paths). Hidden from almost everybody.
  • Logical level: describes what data is stored and the relationships among the data (tables, attributes, constraints). Used by database administrators. Users do not see the physical structures.
  • View level: the highest level, in which each user group sees only the part of the database it needs. Users cannot see the rest of the data, and complexity is hidden.

The DBMS keeps mappings between the levels. Because of these mappings, physical data independence and logical data independence are achieved, so users interact with the data through simple queries or forms without knowing about storage structures.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 5 marks

What are the constraints on generalization / specialization? Explain with examples.

Answer

Constraints on generalization/specialization restrict which entities may belong to the lower-level entity sets.

  1. Membership constraint
    • Condition-defined: membership is decided by a condition on an attribute. Example: in Employee, all entities with job_type = "manager" belong to Manager.
    • User-defined: the database user assigns entities to a lower-level set. Example: a project manager puts employees into work teams.
  2. Disjointness constraint
    • Disjoint: an entity belongs to at most one lower-level set. Example: Account is either Savings or Current.
    • Overlapping: an entity may belong to several lower-level sets. Example: a person can be both Student and Employee.
  3. Completeness constraint
    • Total: each higher-level entity must belong to some lower-level set. Example: every Account is Savings or Current.
    • Partial: a higher-level entity need not belong to any lower-level set. Example: an Employee may be neither Manager nor Clerk.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 5 marks

What is Structured Query Language (SQL)? Explain SQL Data Definition Language (DDL) with examples.

Answer

SQL (Structured Query Language) is the standard, declarative language for defining, manipulating and controlling data in a relational database. Its parts are DDL, DML, DCL and TCL.

SQL Data Definition Language (DDL) defines and changes the schema (structure) of the database. Main commands:

  • CREATE creates tables, views and indexes:
CREATE TABLE Student (
    Roll INTEGER PRIMARY KEY,
    Name VARCHAR(30) NOT NULL,
    Age  INTEGER CHECK (Age > 15)
);
  • ALTER changes an existing table:
ALTER TABLE Student ADD Address VARCHAR(40);
ALTER TABLE Student DROP COLUMN Age;
  • DROP removes a table (with its data) or other object:
DROP TABLE Student;
  • TRUNCATE removes all rows but keeps the table structure:
TRUNCATE TABLE Student;

DDL also covers constraints (PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK, DEFAULT) and the creation of views (CREATE VIEW) and indexes (CREATE INDEX).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 5 marks

What is extraneous attribute? Write an algorithm to calculate closure of functional dependency.

Answer

Extraneous attribute. An attribute in a functional dependency is extraneous if it can be removed without changing the closure of the set of dependencies. For α→β\alpha \rightarrow \beta in FF, A∈αA \in \alpha is extraneous if (α−A)+(\alpha - A)^+ under FF contains β\beta. For example, in AB→CAB \rightarrow C with A→CA \rightarrow C in FF, BB is extraneous.

Algorithm to compute the closure of a set of functional dependencies F+F^+

F+ = F
repeat
    for each functional dependency f in F+
        apply reflexivity and augmentation rules on f
        add the resulting functional dependencies to F+
    for each pair of functional dependencies f1 and f2 in F+
        if f1 and f2 can be combined using transitivity
            add the resulting functional dependency to F+
until F+ does not change any further

The rules used are reflexivity (if β⊆α\beta \subseteq \alpha then α→β\alpha \rightarrow \beta), augmentation (if α→β\alpha \rightarrow \beta then γα→γβ\gamma\alpha \rightarrow \gamma\beta) and transitivity (if α→β\alpha \rightarrow \beta and β→γ\beta \rightarrow \gamma then α→γ\alpha \rightarrow \gamma).

Closure of an attribute set (which is the practical way to test a dependency):

result = alpha
repeat
    for each functional dependency b -> g in F
        if b is a subset of result
            result = result U g
until result does not change

α→β\alpha \rightarrow \beta holds in F+F^+ if and only if β⊆α+\beta \subseteq \alpha^+.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 5 marks

Explain different integrity constraints in Database with examples.

Answer

Integrity constraints guard against accidental damage to the database by ensuring that changes keep the data consistent.

  1. Domain constraints: the value of each attribute must come from its domain (data type and allowed values). Example: Age INTEGER CHECK (Age > 20).
  2. Entity integrity: no primary key attribute can be NULL, so every tuple is uniquely identifiable. Example: Roll in Student.
  3. Referential integrity: a foreign key value must match an existing primary key value in the referenced relation, or be NULL. Example: Class.Roll must exist in Student.Roll. Deleting a referenced row needs ON DELETE CASCADE or similar actions.
  4. Key constraints: every relation has a candidate key whose values are unique (UNIQUE, PRIMARY KEY).
  5. NOT NULL constraint: the attribute cannot hold NULL.
  6. Assertions and triggers: general conditions that the database must always satisfy, for example CREATE ASSERTION that the sum of loan amounts is below a limit.
CREATE TABLE Class (
    ClassNo INTEGER PRIMARY KEY,
    Roll    INTEGER NOT NULL,
    Strength INTEGER CHECK (Strength > 0),
    FOREIGN KEY (Roll) REFERENCES Student(Roll)
);

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 5 marks

Consider the following relations
Personal_information(person_id, fName, mName, lName, Gender, Address, email, phone)
Dependent(dependent_id, person_id, fName, mName, lName, Gender, relation)
Write SQL or Relational algebra statement for following:
i. Insert new person (assume values of respective fields). ii. Change phone number of person with person_id 8 to 4433881. iii. Delete record of all dependent whose lName is 'xyz'. iv. Retrieve names of all persons who have boy as dependent. v. Retrieve fName of all persons who are male and whose address is 'aaa'.

Answer

i.

INSERT INTO Personal_information
VALUES (1, 'Ram', 'Bahadur', 'Thapa', 'Male', 'Kathmandu', 'ram@mail.com', 9841000000);

ii.

UPDATE Personal_information SET phone = 4433881 WHERE person_id = 8;

iii.

DELETE FROM Dependent WHERE lName = 'xyz';

Relational algebra: Dependent←Dependent−σlName=′xyz′(Dependent)Dependent \leftarrow Dependent - \sigma_{lName='xyz'}(Dependent)

iv.

SELECT DISTINCT P.fName, P.mName, P.lName
FROM Personal_information P, Dependent D
WHERE P.person_id = D.person_id AND D.relation = 'boy';

Here boy is taken as a dependent who is male, so the condition may also be written D.Gender = 'Male'.

v.

SELECT fName FROM Personal_information
WHERE Gender = 'Male' AND Address = 'aaa';

Relational algebra: πfName(σGender=′Male′∧Address=′aaa′(Personal_information))\pi_{fName}\big(\sigma_{Gender='Male' \wedge Address='aaa'}(Personal\_information)\big)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2009 AD · 5 marks

Explain the sequential file organization. Differentiate between variable length record and fixed length record with example.

Answer

Sequential file organization. Records are stored in sequence, ordered by a search key (often the primary key), and linked in key order by pointers.

  • Efficient for processing the whole file and range queries.
  • Insertion: locate the position by key; if free space exists in the block, insert there, otherwise put the record in an overflow block and link it with pointers.
  • Deletion: pointer chains are updated and space freed.
  • The file must be reorganized periodically to restore physical order.
  • Weak for random access, insertion and deletion.

Fixed-length vs variable-length records

BasisFixed-length recordVariable-length record
SizeEvery record has the same sizeRecords differ in size
FieldsFixed-size fields, such as CHAR(n)Variable fields such as VARCHAR, repeating groups
LocationRecord ii is at offset n(i−1)n(i-1), so it is simpleNeeds offsets/lengths, a slotted page or end-of-record markers
DeletionLeaves fixed-size holes, which are reused through a free listLeaves holes of different sizes; harder space management
SpaceWastes space on short valuesSaves space

Example: fixed: Account(acc_no CHAR(10), branch CHAR(22), balance NUMERIC(8)), 40 bytes each. Variable: Account with a VARCHAR branch name, or a record with an array of owners that grows.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 1 mark

Make a distinction between physical and logical data independence.

Answer

  • Physical data independence: the ability to change the physical (internal) schema, such as file organization, indexes or storage devices, without changing the conceptual schema or application programs. It is easier to achieve.
  • Logical data independence: the ability to change the conceptual schema, such as adding or removing attributes or entities, without changing external schemas or application programs. It is harder to achieve, because programs depend heavily on the logical structure.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 1 mark

What do you mean by discriminator of weak entity set?

Answer

The discriminator (partial key) of a weak entity set is the set of attributes that distinguishes the weak entities that depend on the same strong (owner) entity. The primary key of a weak entity set is the primary key of the owner entity set plus the discriminator. It is shown with a dashed underline in the E-R diagram.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 1 mark

Define view.

Answer

A view is a virtual relation defined by a query over one or more base tables. It does not store data itself; its contents are computed when it is used. Views hide data, simplify queries and give security. It is created with CREATE VIEW v AS SELECT ....

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 1 mark

What is user defined generalization?

Answer

In user-defined generalization/specialization, membership of an entity in a lower-level entity set is not decided by an explicit condition. The database user assigns each entity to a lower-level set manually, for example when adding the entity. Example: the manager assigns employees to work teams.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 1 mark

Differentiate super key from candidate key.

Answer

A super key is any set of attributes that uniquely identifies a tuple in a relation; it may contain redundant attributes (e.g. {roll, name}). A candidate key is a minimal super key, i.e. no proper subset of it is itself a super key (e.g. {roll}). Every candidate key is a super key, but not every super key is a candidate key.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 1 mark

What is the purpose of the (operator symbol not legible in the source) operator in relational algebra?

Answer

The rename operator ρ\rho gives a new name to a relational-algebra expression result and, optionally, to its attributes. For example, ρx(E)\rho_{x}(E) returns the result of expression EE under the name xx, and ρx(A1,A2)(E)\rho_{x(A_1,A_2)}(E) also renames its attributes. It is needed to refer to the same relation twice in one expression (self-join) and to avoid name clashes.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 1 mark

When is decomposition lossless?

Answer

A decomposition of relation RR into R1R_1 and R2R_2 is lossless when joining the parts gives back exactly RR, with no spurious tuples. This holds if at least one of the following functional dependencies is in F+F^+:

R1∩R2→R1orR1∩R2→R2R_1 \cap R_2 \to R_1 \quad\text{or}\quad R_1 \cap R_2 \to R_2

That is, the common attributes form a super key of R1R_1 or of R2R_2.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 1 mark

What do you mean by distributed database system?

Answer

A distributed database system consists of a collection of logically related databases stored at multiple sites (computers) connected by a network. Each site is autonomous and can process local transactions, while the sites together can also process global transactions that access data at several sites, so users see it as a single database.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 3 marks

What are the different types of database users? Explain.

Answer

Database users are classified by the way they interact with the system.

  • Naive (parametric) users: unsophisticated users who interact through pre-written application programs and forms, e.g. a bank teller or a ticket-booking clerk.
  • Application programmers: computer professionals who write application programs in languages such as Java or PHP, using embedded SQL or APIs to access the database.
  • Sophisticated users: analysts and engineers who form requests directly in a query language such as SQL, or use data-analysis tools, without writing programs.
  • Specialized users: write specialized database applications that do not fit traditional data processing, e.g. CAD systems, knowledge-based and expert systems, and multimedia applications.
  • Database administrator (DBA): has central control of the system; defines schema and storage structure, grants authorization, performs backup and recovery, and tunes performance.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 3 marks

Construct an E-R diagram for a car insurance company whose customer owns one or more cars. Each car is associated with zero to any number of recorded accidents. Assume the required attributes.

Answer

Entity sets and attributes

  • CUSTOMER (<u>customer_id</u>, name, address, phone)
  • CAR (<u>license_no</u>, model, year)
  • ACCIDENT (<u>report_no</u>, date, location, damage_amount)

Relationship sets

  • OWNS between CUSTOMER and CAR: one-to-many. A customer owns one or more cars (total participation of CUSTOMER), and each car is owned by one customer.
  • INVOLVED_IN between CAR and ACCIDENT: one-to-many. A car has zero or more recorded accidents (partial participation of CAR), and each accident record belongs to one car.

E-R diagram

 [CUSTOMER]====1--<OWNS>--N----[CAR]----1--<INVOLVED_IN>--N----[ACCIDENT]
  |  |  |  |                    |  |  |                        |  |  |  |
 id name addr phone          license model year          report_no date location damage

CUSTOMER has total participation in OWNS (double line), CAR has partial participation in INVOLVED_IN (single line), and the underlined attributes (customer_id, license_no, report_no) are the primary keys. In the relational schema, OWNS is realised by putting customer_id as a foreign key in CAR, and INVOLVED_IN by putting license_no as a foreign key in ACCIDENT.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 3 marks

What do you mean by domain and referential integrity constraints? Explain.

Answer

Domain constraint: the value of every attribute must come from the set of permitted values (its domain) and must be atomic. It is the most basic constraint, covering data type, range, format, NOT NULL and CHECK conditions. Example:

CREATE TABLE student (
  roll INT PRIMARY KEY,
  name VARCHAR(30) NOT NULL,
  age  INT CHECK (age BETWEEN 15 AND 60)
);

Referential integrity constraint: a value that appears in a foreign key of one relation must also appear as a primary (or candidate) key value in the referenced relation, or else be NULL. It keeps references between tables consistent: a student cannot be enrolled in a course that does not exist.

CREATE TABLE enrol (
  roll INT REFERENCES student(roll),
  cid  CHAR(5) REFERENCES course(cid)
);

Violations on insert or update are rejected; on delete of a referenced row the DBMS may reject it or cascade (ON DELETE CASCADE / SET NULL).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 3 marks

What do you mean by anomalies? Explain the different types of anomalies.

Answer

Anomalies are undesirable side effects that occur in a relation due to redundancy, which is caused by poor design (storing unrelated facts in one table). They are removed by normalization.

Consider EMP_DEPT(emp_id, emp_name, dept_id, dept_name, dept_location).

  • Insertion anomaly: a fact cannot be inserted without another unrelated fact. A new department with no employees cannot be recorded because emp_id (the key) cannot be NULL.
  • Deletion anomaly: deleting some data unintentionally loses other data. Deleting the last employee of a department also deletes the department's name and location.
  • Update (modification) anomaly: the same fact is stored in many rows, so changing it in only some rows causes inconsistency. If a department's location changes, every employee row of that department must be updated; missing one leaves the data inconsistent.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 3 marks

Define natural join on relations r and s. Explain the left outer join, right outer join and full outer join operations.

Answer

Natural join r⋈sr \bowtie s combines tuples of rr and ss that have equal values on all attributes common to both relations, and the common attributes appear only once in the result. Formally, if R∩S={A1,…,An}R \cap S=\{A_1,\dots,A_n\}:

r⋈s=πR∪S(σr.A1=s.A1∧⋯∧r.An=s.An(r×s))r \bowtie s = \pi_{R\cup S}\left(\sigma_{r.A_1=s.A_1 \wedge \dots \wedge r.A_n=s.A_n}(r\times s)\right)

Tuples with no match in the other relation are lost (dangling tuples). Outer joins keep them, padding with NULL.

  • Left outer join r⟕sr \mathbin{⟕} s: all tuples of the natural join, plus the tuples of rr that have no match in ss, with the attributes of ss set to NULL.
  • Right outer join r⟖sr \mathbin{⟖} s: all tuples of the natural join, plus the tuples of ss that have no match in rr, with the attributes of rr set to NULL.
  • Full outer join r⟗sr \mathbin{⟗} s: the natural join plus the unmatched tuples of both rr and ss, each padded with NULLs; it is the union of the left and right outer joins.

Example: for r(A,B)={(1,x),(2,y)}r(A,B)=\{(1,x),(2,y)\} and s(B,C)={(x,p),(z,q)}s(B,C)=\{(x,p),(z,q)\}, the natural join is {(1,x,p)}\{(1,x,p)\}; left outer adds (2,y,NULL)(2,y,\text{NULL}); right outer adds (NULL,z,q)(\text{NULL},z,q); full outer adds both.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 3 marks

Explain the ACID properties with supportive example.

Answer

A transaction must have the ACID properties so that the database stays correct despite concurrency and failures.

  • Atomicity: all operations of a transaction are executed or none are. If it fails midway, its effects are rolled back. Handled by the recovery manager.
  • Consistency: a transaction, run alone, takes the database from one consistent state to another, preserving all integrity constraints. Ensured by the programmer and the DBMS.
  • Isolation: concurrent transactions do not see each other's intermediate results; the outcome is as if they ran serially. Handled by the concurrency control manager.
  • Durability: once a transaction commits, its changes persist even after a system crash. Ensured by logging and recovery.

Example: transfer of Rs 500 from account A (balance Rs 2000) to B (balance Rs 1000).

read(A); A = A - 500; write(A);
read(B); B = B + 500; write(B);
  • Atomicity: if the system crashes after write(A) but before write(B), the debit is undone, so no money vanishes.
  • Consistency: A + B = Rs 3000 before and after.
  • Isolation: another transaction reading A and B in between must not see A = 1500 and B = 1000 (total Rs 2500).
  • Durability: after commit, A = 1500 and B = 1500 survive a crash.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 5 marks

What is normalization? Consider the following relation in 1NF:
STUDENT (name, grade, semester, program, roll, gender)
The relation has following functional dependencies
name -> semester
roll -> program
grade -> gender
Now normalize the relation up to 3NF.

Answer

Normalization is the process of decomposing relations to reduce redundancy and eliminate insertion, deletion and update anomalies, using functional dependencies and normal forms (1NF, 2NF, 3NF, BCNF). Decomposition should be lossless and preferably dependency preserving.

Given: STUDENT(name, grade, semester, program, roll, gender) with

name→semester,roll→program,grade→gendername \to semester,\quad roll \to program,\quad grade \to gender

Candidate key: name, roll and grade never appear on the right side except as determinants, and the other attributes are all determined by them. Closure:

{name,roll,grade}+={name,roll,grade,semester,program,gender}\{name, roll, grade\}^+ = \{name, roll, grade, semester, program, gender\}

so the key is {name,roll,grade}\{name, roll, grade\} (a composite key).

2NF: every non-key attribute must depend on the whole key. Here semester depends only on name, program only on roll and gender only on grade, so there are partial dependencies and the relation is not in 2NF. Remove them:

  • R1(<u>name</u>, semester)
  • R2(<u>roll</u>, program)
  • R3(<u>grade</u>, gender)
  • R4(<u>name, roll, grade</u>)

3NF: there must be no transitive dependency of a non-key attribute on the key. In R1, R2 and R3 the only non-key attribute depends directly on the key, and R4 has no non-key attribute. All determinants are keys of their relations, so no further decomposition is needed.

Final 3NF schema: R1(name, semester), R2(roll, program), R3(grade, gender), R4(name, roll, grade). The decomposition is lossless and dependency preserving.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 5 marks

Consider the following schema of the relational database:
Books (Bid, Btitle, Bauthor, Bpublisher, Bprice)
Members (Member_id, Name, Designation, Age)
Reserve (Member_id, Bid, Date)
i. Find the name of member with maximum age. ii. Find the name of Member who have reserved both the books with title "DBMS" and "Database". iii. Increase the price of "DBMS" book by 10%. iv. Find the authors and titles of books reserved on 27-May-2010. v. Delete all the books of publisher Bud Press.

Answer

i. Name of the member with maximum age

SELECT Name FROM Members
WHERE Age = (SELECT MAX(Age) FROM Members);

ii. Members who reserved both "DBMS" and "Database"

SELECT m.Name
FROM Members m
WHERE m.Member_id IN (SELECT r.Member_id FROM Reserve r, Books b
                      WHERE r.Bid = b.Bid AND b.Btitle = 'DBMS')
  AND m.Member_id IN (SELECT r.Member_id FROM Reserve r, Books b
                      WHERE r.Bid = b.Bid AND b.Btitle = 'Database');

iii. Increase the price of the "DBMS" book by 10%

UPDATE Books
SET Bprice = Bprice * 1.10
WHERE Btitle = 'DBMS';

iv. Authors and titles of books reserved on 27-May-2010

SELECT DISTINCT b.Bauthor, b.Btitle
FROM Books b, Reserve r
WHERE b.Bid = r.Bid AND r.Date = '2010-05-27';

v. Delete all books of publisher Bud Press

DELETE FROM Books
WHERE Bpublisher = 'Bud Press';

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2010 AD · 5 marks

Consider a database with following relations:
DOCTOR (name, age, address)
WORKS (name, deptno)
DEPARTMENT (deptno, floor, room)
Write down the SQL for the following.
a. Display the number of doctors in each address. b. Delete the department where no one works. c. Display the room of doctor with maximum age. d. Display the deptno of those doctors whose address do not start with 'U' or ends in 'U'. e. Increase the age of all doctors working in top floor by 1.

Answer

a. Number of doctors in each address

SELECT address, COUNT(*) AS no_of_doctors
FROM DOCTOR
GROUP BY address;

b. Delete the department where no one works

DELETE FROM DEPARTMENT
WHERE deptno NOT IN (SELECT deptno FROM WORKS);

c. Room of the doctor with maximum age

SELECT d.room
FROM DEPARTMENT d, WORKS w, DOCTOR dr
WHERE d.deptno = w.deptno AND w.name = dr.name
  AND dr.age = (SELECT MAX(age) FROM DOCTOR);

d. Deptno of doctors whose address neither starts with 'U' nor ends in 'U'

SELECT w.deptno
FROM WORKS w, DOCTOR dr
WHERE w.name = dr.name
  AND dr.address NOT LIKE 'U%'
  AND dr.address NOT LIKE '%U';

e. Increase by 1 the age of all doctors working on the top floor

UPDATE DOCTOR
SET age = age + 1
WHERE name IN (SELECT w.name
               FROM WORKS w, DEPARTMENT d
               WHERE w.deptno = d.deptno
                 AND d.floor = (SELECT MAX(floor) FROM DEPARTMENT));

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 1 mark

What do you mean by instance of a database?

Answer

The instance of a database is the collection of information stored in the database at a particular moment in time (a snapshot of the data). It changes as data are inserted, deleted or updated, whereas the schema (the overall design) stays the same.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 1 mark

What do you mean by closure of attributes?

Answer

The closure of a set of attributes XX under a set of functional dependencies FF, written X+X^+, is the set of all attributes that are functionally determined by XX, i.e. every AA such that X→AX \to A can be derived from FF. For F={A→B,B→C}F=\{A\to B, B\to C\}, A+={A,B,C}A^+=\{A,B,C\}.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 1 mark

Define Natural Join.

Answer

The natural join r⋈sr \bowtie s of two relations is the join that combines tuples having equal values on all attributes with the same name in both relations, keeping each common attribute only once in the result. It is equal to a selection on equality of the common attributes over the Cartesian product r×sr \times s, followed by a projection that removes the duplicate columns.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 1 mark

What do you mean by NULL values?

Answer

A NULL value is a special marker meaning that the value of an attribute is unknown, missing or not applicable. It is not the same as zero or an empty string. Any comparison with NULL (other than IS NULL / IS NOT NULL) evaluates to unknown, and aggregate functions such as SUM and AVG ignore NULLs.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 1 mark

What do you mean by composite attributes?

Answer

A composite attribute is an attribute that can be divided into smaller sub-parts, each with an independent meaning. For example, the attribute name can be divided into first_name, middle_name and last_name, and address into street, city and district. Attributes that cannot be divided are called simple (atomic) attributes.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 1 mark

What is parallel database system?

Answer

A parallel database system uses multiple processors and multiple disks working in parallel (connected by a high-speed interconnect) to execute database operations, so that data loading, scans, sorts, joins and queries run faster and more transactions per second can be handled. The architectures are shared-memory, shared-disk, shared-nothing and hierarchical. Its goals are higher throughput (speed-up) and scale-up with growing data and load.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 3 marks

What is transaction? Explain two phase locking protocol.

Answer

A transaction is a logical unit of database work consisting of a sequence of read and write operations that must be executed as a whole, taking the database from one consistent state to another. It ends with either commit or abort (rollback), and must satisfy the ACID properties.

Two-phase locking (2PL) protocol ensures conflict-serializable schedules by requiring each transaction to issue lock and unlock requests in two phases:

  1. Growing phase: the transaction may obtain locks (shared or exclusive) but may not release any lock.
  2. Shrinking phase: the transaction may release locks but may not obtain any new lock.

The point at which the transaction obtains its last lock (the lock point) orders the transactions in the equivalent serial schedule.

Example:

T1: lock-X(A); read(A); write(A); lock-X(B); read(B); write(B); unlock(A); unlock(B)

Here all locks are acquired before the first unlock, so T1 is two-phase.

2PL guarantees serializability, but it does not prevent deadlock and may cause cascading rollback. Strict 2PL (hold all exclusive locks until commit) avoids cascading rollback, and rigorous 2PL holds all locks until commit.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 3 marks

What is query processor? Write about components of query processor.

Answer

The query processor is the part of the DBMS that translates user queries (SQL) into low-level instructions the storage manager can execute, and decides how to evaluate them efficiently.

Components:

  • DDL interpreter: interprets DDL statements and records the definitions in the data dictionary (metadata).
  • DML compiler: translates DML statements in a query language into an evaluation plan of low-level instructions. It also performs query optimization, choosing the lowest-cost plan among the alternatives (using statistics, indexes and cost estimation).
  • Query evaluation engine: executes the low-level instructions generated by the DML compiler and returns the result.

In more detail, query processing goes through parsing and translation (checking syntax and converting to relational algebra), optimization (selecting the best evaluation plan) and evaluation (executing the plan).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 3 marks

What is Normalization? Normalize the following relation into BCNF.
CustomerIDCustomerNameSalesPersonRegion
8023AjayaAmritSouth
9167BipinBinitaWest
7924SangitaAmritSouth
6837SanjanaSabinEast
8596RumaBinitaWest
7018AshokRajanNorth

Answer

Normalization is the process of organizing the attributes and relations of a database by decomposing them using functional dependencies, in order to minimize redundancy and avoid insertion, deletion and update anomalies.

Functional dependencies in CUSTOMER(CustomerID, CustomerName, SalesPerson, Region), from the data:

CustomerID→CustomerName,SalesPerson,RegionCustomerID \to CustomerName, SalesPerson, Region SalesPerson→RegionSalesPerson \to Region

(Amrit is always South, Binita always West, and so on.)

Key: CustomerID is the only candidate key. The relation is in 1NF and 2NF (single-attribute key), but not in 3NF because Region depends on SalesPerson, a non-key attribute (transitive dependency CustomerID →\to SalesPerson →\to Region). It is also not in BCNF, since SalesPerson is a determinant but not a super key.

Decomposition into BCNF:

SALESPERSON(<u>SalesPerson</u>, Region)

SalesPersonRegion
AmritSouth
BinitaWest
SabinEast
RajanNorth

CUSTOMER(<u>CustomerID</u>, CustomerName, SalesPerson)

CustomerIDCustomerNameSalesPerson
8023AjayaAmrit
9167BipinBinita
7924SangitaAmrit
6837SanjanaSabin
8596RumaBinita
7018AshokRajan

In both relations every determinant is a candidate key, so they are in BCNF. The common attribute SalesPerson is the key of SALESPERSON, so the decomposition is lossless, and both dependencies are preserved.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 3 marks

Discuss the types of mapping cardinality in brief.

Answer

Mapping cardinality (cardinality ratio) expresses the number of entities of one entity set that can be associated with entities of another through a relationship set. For a binary relationship between AA and BB:

  • One-to-one (1:1): an entity in AA is associated with at most one entity in BB, and vice versa. Example: a person has one passport.
  • One-to-many (1:N): an entity in AA can be associated with any number of entities in BB, but an entity in BB is associated with at most one in AA. Example: one department has many employees.
  • Many-to-one (N:1): an entity in AA is associated with at most one entity in BB, while an entity in BB can be associated with many in AA. Example: many students belong to one college.
  • Many-to-many (M:N): an entity in AA can be associated with any number of entities in BB and vice versa. Example: students enrol in many courses, and each course has many students.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 3 marks

What is distributed database? How it differs from centralized database system?

Answer

A distributed database is a collection of logically interrelated databases spread over several sites connected by a network. Each site has its own local database and can run local transactions, and together the sites can run global transactions; to the user it appears as a single database.

Differences from a centralized database system

BasisCentralizedDistributed
Data locationStored at one siteSpread across many sites
ReliabilitySingle point of failureFailure of a site does not stop the whole system
AvailabilityLowerHigher, because of replication
Response timeSlow for remote usersFaster, since data is stored near users
ScalabilityHard, needs a bigger machineEasy, add sites
ComplexitySimple design and managementComplex: fragmentation, replication, distributed query processing, commit protocols (2PC)
Cost of communicationNoneNetwork cost and delay
ControlCentralLocal autonomy with global coordination

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 5 marks

The department store database system contains information about customers, items they order, departments in the store, employees and suppliers of merchandise. For customers we record their name, address, salary and orders they have placed. The orders are for certain items and should include a description of the item, item no and quantity. Items are usually being supplied by more than one supplier at different prices. The store needs to keep contact information about the suppliers.
Identify the entity sets, attributes and relationship sets and construct E-R diagram for the system.

Answer

Entity sets and attributes

  • CUSTOMER (<u>customer_id</u>, name, address, salary)
  • ORDER (<u>order_no</u>, order_date)
  • ITEM (<u>item_no</u>, description)
  • DEPARTMENT (<u>dept_no</u>, dept_name)
  • EMPLOYEE (<u>emp_id</u>, name, address, salary)
  • SUPPLIER (<u>supplier_id</u>, name, address, phone, email)

Relationship sets

RelationshipEntitiesCardinalityAttributes
PLACESCUSTOMER - ORDER1:N
CONTAINSORDER - ITEMM:Nquantity
SUPPLIESSUPPLIER - ITEMM:Nprice
WORKS_INEMPLOYEE - DEPARTMENTN:1
SOLD_BY (items kept in)ITEM - DEPARTMENTN:1

E-R diagram (textual)

[CUSTOMER]--1--<PLACES>--N--[ORDER]--M--<CONTAINS>(quantity)--N--[ITEM]--N--<SUPPLIES>(price)--M--[SUPPLIER]
                                                                   |
                                                                   N
                                                               <SOLD_IN>
                                                                   |
                                                                   1
[EMPLOYEE]--N--<WORKS_IN>--1--------------------------------[DEPARTMENT]

Entity sets are drawn as rectangles, relationships as diamonds, attributes as ellipses (the keys underlined). SUPPLIES carries the attribute price because an item is supplied by several suppliers at different prices, and CONTAINS carries quantity of the item in an order. Supplier contact details (address, phone, email) are kept as attributes of SUPPLIER.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 5 marks

Consider a database schema of company.
Employee (employee_name, street, city, age)
Works (employee_name, company_name, salary)
Company (company_name, city)
Managers (employee_name, manager_name)
Where the primary keys are underlined. Write relational algebra expression for the following queries
i. Insert the new record of employee who works for IBM Company located in Darchula. ii. Find the names and cities of employee who work for the "Deerwalk Company" iii. Delete the record of employees whose salary is greater than 5000. iv. Increase the salary of employees by 10% on employee relation whose salary is less than 2000. v. Find the maximum salary of employee.

Answer

i. Insert a new employee working for IBM, a company located in Darchula (the values of the employee tuple are assumed):

Company←Company∪{(IBM,Darchula)}Company \leftarrow Company \cup \{(\text{IBM},\text{Darchula})\} Employee←Employee∪{(Ram,Main Street,Darchula,30)}Employee \leftarrow Employee \cup \{(\text{Ram},\text{Main Street},\text{Darchula},30)\} Works←Works∪{(Ram,IBM,3000)}Works \leftarrow Works \cup \{(\text{Ram},\text{IBM},3000)\}

ii. Names and cities of employees who work for Deerwalk Company:

πemployee_name, city(Employee⋈σcompany_name="Deerwalk Company"(Works))\pi_{employee\_name,\,city}\left(Employee \bowtie \sigma_{company\_name=\text{"Deerwalk Company"}}(Works)\right)

iii. Delete the records of employees whose salary is greater than 5000:

Works←Works−σsalary>5000(Works)Works \leftarrow Works - \sigma_{salary>5000}(Works)

(To remove the employees completely, also delete their other tuples: Employee←Employee−(Employee⋈σsalary>5000(Works))Employee \leftarrow Employee - \left(Employee \bowtie \sigma_{salary>5000}(Works)\right) projected onto the Employee attributes, and the same for Managers.)

iv. Increase the salary by 10% for those whose salary is less than 2000 (the salary is stored in Works):

Works←πemployee_name, company_name, salary×1.1(σsalary<2000(Works))∪σsalary≥2000(Works)Works \leftarrow \pi_{employee\_name,\,company\_name,\,salary\times 1.1}\left(\sigma_{salary<2000}(Works)\right) \cup \sigma_{salary\ge 2000}(Works)

v. Maximum salary of an employee:

Gmax⁡(salary)(Works)\mathcal{G}_{\max(salary)}(Works)

The same result without aggregation: πsalary(Works)−πWorks.salary(σWorks.salary<d.salary(Works×ρd(Works)))\pi_{salary}(Works) - \pi_{Works.salary}\left(\sigma_{Works.salary<d.salary}(Works \times \rho_d(Works))\right).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2011 AD · 5 marks

Consider a simple relational database of hospital management system
Doctors (DoctorID, DoctorName, Department, Address, Salary)
Patients (PatientID, Patent Name, Address, Age, Gender)
Hospitals (PatientID, Doctor ID, HostpitalName, Location)
Write down the SQL for the following.
a. Find the name of the doctors whose salaries are greater than average salary of doctors. b. Remove record of patient with patient ID = 44. c. Find the name of doctor who do not work in Teaching Hospital. d. Display id of patients admitted to hospital of Biratnagar and whose name contains exactly 3 characters. e. Increase the salary of doctors by 12% who works in General Medicine department

Answer

a. Doctors whose salary is greater than the average salary

SELECT DoctorName
FROM Doctors
WHERE Salary > (SELECT AVG(Salary) FROM Doctors);

b. Remove the record of patient with PatientID = 44

DELETE FROM Patients
WHERE PatientID = 44;

c. Doctors who do not work in Teaching Hospital

SELECT DoctorName
FROM Doctors
WHERE DoctorID NOT IN (SELECT DoctorID FROM Hospitals
                       WHERE HostpitalName = 'Teaching Hospital');

d. Ids of patients admitted to a hospital of Biratnagar whose name has exactly 3 characters

SELECT h.PatientID
FROM Hospitals h, Patients p
WHERE h.PatientID = p.PatientID
  AND h.Location = 'Biratnagar'
  AND p."Patent Name" LIKE '___';

e. Increase the salary by 12% of doctors working in General Medicine

UPDATE Doctors
SET Salary = Salary * 1.12
WHERE Department = 'General Medicine';

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

Define transaction.

Answer

A transaction is a unit of program execution that accesses and possibly updates data items, consisting of a sequence of read and write operations that form one logical unit of work. It either completes entirely (commit) or has no effect (abort), and must satisfy the ACID properties.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

Why normalization is required?

Answer

Normalization is required to remove data redundancy and the resulting insertion, deletion and update anomalies. It keeps the data consistent, saves storage space, and gives a logical, well-structured design in which each relation represents one kind of fact.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

Write the responsibilities of concurrency control manager.

Answer

The concurrency control manager is responsible for controlling the interaction among concurrent transactions to ensure the isolation property and consistency of the database. Its responsibilities are:

  • Granting and releasing locks (or timestamps) on data items, using a protocol such as two-phase locking.
  • Ensuring that concurrent schedules are serializable.
  • Detecting and resolving deadlocks, and preventing lost updates, dirty reads and unrepeatable reads.
  • Making transactions wait, or aborting and restarting them when conflicts arise.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

What do you mean by transitive dependency?

Answer

A transitive dependency exists in a relation when a non-key attribute depends on another non-key attribute rather than directly on the key. If A→BA \to B and B→CB \to C (with B↛AB \not\to A), then CC is transitively dependent on AA through BB. For example, roll→deptroll \to dept and dept→hoddept \to hod imply roll→hodroll \to hod transitively. Such a dependency must be removed to reach 3NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

List the advantages of using DBMS.

Answer

Advantages of using a DBMS:

  • Reduced data redundancy and inconsistency.
  • Data sharing among multiple users and applications.
  • Data independence (physical and logical) from application programs.
  • Data integrity through constraints.
  • Security through authorization and access control.
  • Concurrent access with consistent results.
  • Backup and recovery from failures.
  • Efficient data access through indexing and query optimization.
  • Standards enforcement and easier data administration.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

Who is naive user?

Answer

A naive user is an unsophisticated end user who interacts with the system by invoking one of the permanent application programs already written for them, usually through forms and menus, without any knowledge of the DBMS or query languages. Examples are bank tellers, reservation clerks and online shoppers.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

What is advantage of getting closure of an attribute?

Answer

Computing the closure of an attribute set X+X^+ lets us:

  • Test whether XX is a super key (if X+X^+ contains all attributes of the relation) and find candidate keys.
  • Check whether a given functional dependency X→YX \to Y holds (it does if Y⊆X+Y \subseteq X^+).
  • Compute the closure F+F^+ of a set of dependencies and test equivalence or find a canonical cover, which helps in normalization and in checking that a decomposition preserves dependencies.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

Differentiate between assertion and trigger.

Answer

AssertionTrigger
A predicate that the database must always satisfy; it expresses an integrity constraint.An action that the DBMS executes automatically when a specified event (insert, update or delete) occurs.
Checked whenever a statement could violate it; if violated, the operation is rejected.Follows the event-condition-action model; it performs actions such as updating other tables or logging.
Defined with CREATE ASSERTION ... CHECK (predicate).Defined with CREATE TRIGGER ... BEFORE/AFTER event ON table ....
Only prevents invalid states.Can enforce rules, maintain derived data, send alerts and audit.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 1 mark

State any one Armstrong's Rules.

Answer

Reflexivity rule: if Y⊆XY \subseteq X, then X→YX \to Y. (Trivial dependencies always hold; for example {roll,name}→name\{roll, name\} \to name.)

The other rules are augmentation (if X→YX \to Y then XZ→YZXZ \to YZ) and transitivity (if X→YX \to Y and Y→ZY \to Z then X→ZX \to Z).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 3 marks

Differentiate between centralized database and distributed database. Also write their application area.

Answer

A centralized database stores all data at a single site (one computer or server), and all users access it from there. A distributed database stores data across several sites connected by a network, but users see it as one logical database.

BasisCentralized databaseDistributed database
Location of dataSingle siteMultiple sites, linked by a network
ControlCentral administrationShared or local autonomy at each site
ReliabilitySingle point of failure; if the site fails, all data is unavailableFailure of one site does not stop the others; data can be replicated
Response timeRemote users face network delayData is kept near the users, so access is faster
Cost and complexitySimple and cheaper to design and maintainComplex (query processing, concurrency, recovery across sites)
ScalabilityHard to grow; limited by one machineEasy to grow by adding new sites

Application areas

  • Centralized: small and medium organisations, a single-branch library, school or hospital information system, a single-shop billing system.
  • Distributed: banks with many branches and ATMs, airline and railway reservation, multinational companies, telecom billing, and large e-commerce systems.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 3 marks

Define constraint. Write about mapping cardinality, domain constraint and total participation.

Answer

A constraint is a rule defined on the database that the data must satisfy at all times, so that the data stays correct and consistent. Examples are key, domain, referential integrity and cardinality constraints.

Mapping cardinality states the number of entities of one entity set that can be associated with entities of another set through a relationship set. The types are one-to-one (1:1), one-to-many (1:N), many-to-one (N:1) and many-to-many (M:N). For example, a department has many employees (1:N), while a student can enrol in many courses and a course has many students (M:N).

Domain constraint specifies the set of permitted values for an attribute, including its data type and any range or format. For example, age must be an integer between 0 and 120, and gender must be 'M' or 'F'. Any value outside the domain is rejected.

Total participation means that every entity in an entity set must take part in the relationship. It is shown by a double line in an E-R diagram. For example, if every employee must belong to some department, the participation of EMPLOYEE in WORKS_FOR is total. If some entities may not take part, the participation is partial.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 3 marks

What is the function of storage manager? Describe its components.

Answer

The storage manager is the DBMS component that provides the interface between the low-level data stored on disk and the application programs and queries submitted to the system. It is responsible for storing, retrieving and updating data in the database.

Components of the storage manager

  • Authorization and integrity manager: checks that users are allowed to access the data and that integrity constraints are satisfied.
  • Transaction manager: ensures the database stays consistent despite failures and that concurrent transactions execute without conflict.
  • File manager: manages disk space allocation and the data structures used to represent information on disk.
  • Buffer manager: fetches data from disk into main memory and decides which data to keep in memory (cache). This lets the database hold more data than fits in memory.

Data structures it implements: data files (the database itself), the data dictionary (metadata) and indices for fast access.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 3 marks

Describe two phase-locking protocol.

Answer

The two-phase locking (2PL) protocol is a concurrency control protocol that ensures conflict-serializable schedules. Each transaction requests and releases locks in two separate phases.

  1. Growing phase: the transaction may obtain locks (shared or exclusive) but may not release any lock.
  2. Shrinking phase: the transaction may release locks but may not obtain any new lock.

The point at which the transaction obtains its last lock is called its lock point. Transactions can be serialized in the order of their lock points.

Example: T1 does lock-X(A), lock-X(B), reads and writes A and B, then unlock(A), unlock(B). All locks are taken before any is released, so it follows 2PL.

Variants: strict 2PL holds all exclusive locks until the transaction commits or aborts, which avoids cascading rollbacks. Rigorous 2PL holds all locks until commit.

Drawbacks: 2PL does not prevent deadlock, and without the strict version it may cause cascading rollbacks.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 3 marks

Travel agency maintains the database of passengers traveling on aircrafts in specific routes. Each passenger is assigned in at most one aircraft and one aircraft can contain more than one passengers. An aircraft can travel in only one route but one route can contain one or more aircrafts. Passenger have id (unique), name (composite), phone (multi-valued), birth_date and age. Route has number (unique) and distance. Aircrafts have regno (unique), name and capacity. Draw ER diagram which represents the given scenario.

Answer

Entities and attributes

  • PASSENGER: id (key, underlined), name (composite: first_name, last_name), phone (multi-valued, double ellipse), birth_date, age (derived from birth_date, dashed ellipse).
  • AIRCRAFT: regno (key), name, capacity.
  • ROUTE: number (key), distance.

Relationships

  • TRAVELS_IN between PASSENGER and AIRCRAFT: many-to-one (N:1). Each passenger is assigned to at most one aircraft; one aircraft carries many passengers. PASSENGER participation is partial.
  • FLIES_ON between AIRCRAFT and ROUTE: many-to-one (N:1). An aircraft travels on only one route; a route may have one or more aircraft. AIRCRAFT has total participation.
 [PASSENGER] N ---<TRAVELS_IN>--- 1 [AIRCRAFT] N ---<FLIES_ON>--- 1 [ROUTE]
   id, name(fname,lname),            regno, name, capacity          number, distance
   phone{multi}, birth_date, age(derived)

Relational mapping: PASSENGER(id, fname, lname, birth_date, aircraft_regno), PASSENGER_PHONE(id, phone), AIRCRAFT(regno, name, capacity, route_number), ROUTE(number, distance).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 5 marks

Describe insertion, update and deletion anomalies. Normalize the following relation up to third normal form.
NameRollSemesterCollegePhoneAdmitted_YearAddress
ABC18XYZ981232007KTM
ABC16MNP986502008BKT
ACD302XYZ986752010BKT
BCD26MNP987602007KTM

Answer

Anomalies are problems that arise from redundancy in a poorly designed relation.

  • Insertion anomaly: a new fact cannot be stored without also storing unrelated data. For example, a new college cannot be recorded until a student is admitted to it.
  • Update anomaly: the same fact is stored in many rows, so changing it requires updating all of them; missing one causes inconsistency. For example, a student's address changes but only some rows are updated.
  • Deletion anomaly: deleting a row removes other useful facts. For example, deleting the only student of a college also deletes the college's phone number.

Normalization

Assumed dependencies: Roll identifies a student, so Roll → Name, Address. The key of the given relation is (Roll, Semester), and Roll, Semester → College, Phone, Admitted_Year (the admission details of that semester).

The relation is in 1NF (all values atomic). The candidate key is (Roll, Semester).

2NF: Name and Address depend only on part of the key (Roll), a partial dependency. Remove it:

  • STUDENT(Roll, Name, Address)
  • ADMISSION(Roll, Semester, College, Phone, Admitted_Year)

3NF: Under these dependencies no non-key attribute determines another non-key attribute in either relation, so there is no transitive dependency. The relations are already in 3NF:

STUDENTRollNameAddress
1ABCKTM
30ACDBKT
2BCDKTM
ADMISSIONRollSemesterCollegePhoneAdmitted_Year
18XYZ981232007
16MNP986502008
302XYZ986752010
26MNP987602007

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 5 marks

Consider the following schema of the relational database:
Publisher (pid, name, location)
Book (bid, title, author, page, price)
Publish (bid, pid, publish_date)
Write Relational algebra expression for the following:
i) Delete book which price is greater than 400. ii) Find the name of publisher which has published "Data Structure using C++". iii) Change price of book "Database Management System" to 800. iv) "Data Communication" written by ABC is published by "pearson", book id is 509 and publisher id is 238; insert this information in above database. v) Find price of all books.

Answer

Notation: σ\sigma select, π\pi project, ⋈\bowtie natural join, ←\leftarrow assignment.

(i) Delete books with price greater than 400. (Deletion applies to Book; also to the dependent Publish tuples for consistency.)

Publish←Publish−πbid,pid,publish_date(Publish⋈σprice>400(Book))Publish \leftarrow Publish - \pi_{bid,pid,publish\_date}\big(Publish \bowtie \sigma_{price>400}(Book)\big) Book←Book−σprice>400(Book)Book \leftarrow Book - \sigma_{price>400}(Book)

(ii) Name of the publisher that published "Data Structure using C++":

πname(Publisher⋈Publish⋈σtitle=′Data Structure using C++′(Book))\pi_{name}\big(Publisher \bowtie Publish \bowtie \sigma_{title='Data\ Structure\ using\ C++'}(Book)\big)

(iii) Change the price of "Database Management System" to 800:

Book←πbid,title,author,page,800(σtitle=′Database Management System′(Book))∪σtitle≠′Database Management System′(Book)Book \leftarrow \pi_{bid,title,author,page,800}\big(\sigma_{title='Database\ Management\ System'}(Book)\big) \cup \sigma_{title\neq'Database\ Management\ System'}(Book)

Using the generalized projection (the constant 800 replaces the price attribute).

(iv) Insert the new information (publish_date is not given, so it is null):

Book←Book∪{(509, ′Data Communication′, ′ABC′, null, null)}Book \leftarrow Book \cup \{(509,\ 'Data\ Communication',\ 'ABC',\ null,\ null)\} Publisher←Publisher∪{(238, ′pearson′, null)}Publisher \leftarrow Publisher \cup \{(238,\ 'pearson',\ null)\} Publish←Publish∪{(509, 238, null)}Publish \leftarrow Publish \cup \{(509,\ 238,\ null)\}

(v) Price of all books:

πtitle, price(Book)\pi_{title,\ price}(Book)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2012 AD · 5 marks

Consider the following schema of the relational database:
Passenger (pid, name, age, weight)
Bus (bid, name, capacity)
Assign (bid, pid)
Travel (bid, rid)
Route (rid, distance)
Write SQL statement for the following:
i) Find name of passenger who are traveling in bus named "Agni Yatayat". ii) Add attribute price in table Route. iii) Delete the name of passenger whose name ends with 'a'. iv) Display the name bus

Answer

(i) Names of passengers travelling in the bus "Agni Yatayat":

SELECT p.name
FROM Passenger p, Assign a, Bus b
WHERE p.pid = a.pid
  AND a.bid = b.bid
  AND b.name = 'Agni Yatayat';

(ii) Add attribute price to Route:

ALTER TABLE Route ADD price DECIMAL(10,2);

(iii) Delete passengers whose name ends with 'a':

DELETE FROM Assign WHERE pid IN (SELECT pid FROM Passenger WHERE name LIKE '%a');
DELETE FROM Passenger WHERE name LIKE '%a';

(The first statement removes dependent rows so that the foreign key is not violated.)

(iv) The question is incomplete ("Display the name bus"). It is taken as displaying the names of all buses:

SELECT name FROM Bus;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 1 mark

What do you mean by database management system?

Answer

A database management system (DBMS) is software that allows users to define, create, store, retrieve, update and manage a database. It provides an interface between users or application programs and the data, and controls security, integrity, concurrency and recovery. Examples are MySQL, Oracle and SQL Server.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 1 mark

What do you mean by primary key of a relation?

Answer

A primary key is a minimal set of one or more attributes chosen from the candidate keys of a relation that uniquely identifies each tuple. Its values must be unique and cannot be NULL. For example, roll_no in a Student relation.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 1 mark

What is distributed database?

Answer

A distributed database is a collection of logically related data that is physically stored at multiple sites connected by a computer network. Each site can process local transactions, and together the sites appear to the user as a single database.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 1 mark

What is data independence?

Answer

Data independence is the ability to change the schema at one level of the database without changing the schema at the next higher level. It is of two types: physical data independence (changing the internal/storage schema without changing the conceptual schema) and logical data independence (changing the conceptual schema without changing external schemas or application programs).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 3 marks

Explain 1NF and 2NF with example.

Answer

First Normal Form (1NF): a relation is in 1NF if every attribute holds only atomic (indivisible) values; there are no multi-valued or composite attributes or repeating groups.

Example: STUDENT(Roll, Name, Phone) with Roll 1 having Phone {9841, 9851} violates 1NF. Making each value atomic gives rows (1, Ram, 9841) and (1, Ram, 9851), or a separate table STUDENT_PHONE(Roll, Phone).

Second Normal Form (2NF): a relation is in 2NF if it is in 1NF and every non-prime attribute is fully functionally dependent on the whole candidate key (no partial dependency).

Example: ENROLL(Roll, Course_ID, Student_Name, Grade) with key (Roll, Course_ID). Here Roll → Student_Name is a partial dependency. Decompose into:

  • STUDENT(Roll, Student_Name)
  • ENROLL(Roll, Course_ID, Grade)

Now every non-key attribute depends on the full key, so both relations are in 2NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 3 marks

What are the types of mapping cardinality? Explain briefly.

Answer

Mapping cardinality (cardinality ratio) is the number of entities to which another entity can be associated through a relationship set. For a binary relationship between A and B, there are four types.

  1. One-to-one (1:1): an entity in A is associated with at most one entity in B and vice versa. Example: a person and a passport.
  2. One-to-many (1:N): an entity in A can be associated with many entities in B, but each entity in B with at most one in A. Example: a department and its employees.
  3. Many-to-one (N:1): many entities in A map to at most one in B. Example: many employees work for one department.
  4. Many-to-many (M:N): entities in A may be associated with many in B and vice versa. Example: students and courses.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 3 marks

Write algorithm to compute closure of given set of functional dependences.

Answer

The closure F+F^+ of a set FF of functional dependencies is the set of all functional dependencies logically implied by FF. It is computed by repeatedly applying Armstrong's axioms:

  • Reflexivity: if β⊆α\beta \subseteq \alpha, then α→β\alpha \to \beta.
  • Augmentation: if α→β\alpha \to \beta, then γα→γβ\gamma\alpha \to \gamma\beta.
  • Transitivity: if α→β\alpha \to \beta and β→γ\beta \to \gamma, then α→γ\alpha \to \gamma.

Algorithm

F+ = F
repeat
    for each functional dependency f in F+
        apply reflexivity and augmentation rules on f
        add the resulting functional dependencies to F+
    for each pair of functional dependencies f1 and f2 in F+
        if f1 and f2 can be combined using transitivity
            add the resulting functional dependency to F+
until F+ does not change any further

Union, decomposition and pseudotransitivity are derived rules that can be used to shorten the process. Since F+ may be exponentially large, in practice the attribute closure α+\alpha^+ is used to test whether a given dependency α→β\alpha \to \beta is in F+F^+.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 3 marks

Explain two phase locking protocol.

Answer

The two-phase locking (2PL) protocol ensures serializability by requiring each transaction to issue lock and unlock requests in two phases.

  1. Growing phase: the transaction may acquire locks (shared or exclusive), but cannot release any lock.
  2. Shrinking phase: the transaction may release locks, but cannot acquire any new lock.

The point where the transaction gets its final lock is its lock point; transactions are serialized in lock-point order, so every schedule allowed by 2PL is conflict serializable.

Example:

T1: lock-S(A); read(A); lock-X(B); read(B); write(B); unlock(A); unlock(B)

The locks on A and B are taken first (growing) and released afterwards (shrinking).

Variants: strict 2PL keeps exclusive locks until commit or abort, preventing cascading rollback. Rigorous 2PL keeps all locks until commit.

Limitation: deadlock is possible, for example when T1 holds a lock on A and waits for B while T2 holds B and waits for A.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 5 marks

A university registrar's office maintains data about the following entities:
  • Courses (number, title, credits, syllabus, and prerequisites)
  • Course offerings (course_number, year, semester, section number, instructor(s), timings, and classroom)
  • Students (student-id, name, and program)
  • Instructors (identification number, name, department, and title.)
Construct an E-R diagram for the registrar's office. State any assumptions made in the design of the E-R diagram

Answer

Entity sets and attributes

  • COURSE: number (key), title, credits, syllabus.
  • COURSE_OFFERING (weak entity, depends on COURSE): year, semester, section_no (together the partial key), timings, classroom. Its full key is course_number + year + semester + section_no.
  • STUDENT: student_id (key), name, program.
  • INSTRUCTOR: id (key), name, department, title.

Relationships

  • HAS_OFFERING: COURSE (1) to COURSE_OFFERING (N), the identifying relationship of the weak entity; total participation of COURSE_OFFERING.
  • PREREQUISITE: recursive relationship on COURSE (M:N); a course may have several prerequisites, with roles course and prerequisite.
  • TAUGHT_BY: COURSE_OFFERING (M) to INSTRUCTOR (N), many-to-many since an offering may have several instructors.
  • ENROLLED_IN: STUDENT (M) to COURSE_OFFERING (N), many-to-many.
[COURSE]--1--<HAS_OFFERING>==N==[[COURSE_OFFERING]]--M--<TAUGHT_BY>--N--[INSTRUCTOR]
   |  (M:N recursive: PREREQUISITE)      |
                                    N <ENROLLED_IN> M
                                         |
                                     [STUDENT]

Assumptions

  • The course number is unique, and a course offering is identified only together with its course.
  • A section of an offering has one timing and one classroom.
  • A student may enrol in many offerings, and an instructor may teach many offerings.
  • Syllabus is a single attribute (text or file); prerequisites are modelled as a relationship rather than an attribute.
  • Each instructor belongs to one department.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 5 marks

Consider the following relational schema of company where the primary keys are underlined:
EMPLOYEE (EMPLOYEE_NAME, STREET, CITY)
WORKS (EMPLOYEE_NAME, COMPANY_NAME, SALARY)
COMPANY (COMPANY_NAME, CITY)
MANAGERS (EMPLOYEE_NAME, MANAGER_NAME)
Write SQL statement for the following queries:
a. Find names and cities of employee who works for the "ABC Company" b. Find name of the manager of Mac Company c. Delete record of employees whose salary is greater than 10000. d. Increase salary of employees by 10% on employee relation whose salary is below 12000. e. Find average salary of each company.

Answer

a. Names and cities of employees who work for "ABC Company":

SELECT e.employee_name, e.city
FROM employee e, works w
WHERE e.employee_name = w.employee_name
  AND w.company_name = 'ABC Company';

b. Name of the manager of "Mac Company". MANAGERS has no company column, so the manager is found through the employees who work for the company:

SELECT DISTINCT m.manager_name
FROM managers m, works w
WHERE m.employee_name = w.employee_name
  AND w.company_name = 'Mac Company';

c. Delete records of employees whose salary is greater than 10000. Salary is stored in WORKS, so the employee's rows in the other tables are deleted first and WORKS last:

DELETE FROM managers WHERE employee_name IN (SELECT employee_name FROM works WHERE salary > 10000);
DELETE FROM employee WHERE employee_name IN (SELECT employee_name FROM works WHERE salary > 10000);
DELETE FROM works WHERE salary > 10000;

d. Increase salary by 10% for those below 12000 (salary is held in WORKS):

UPDATE works SET salary = salary * 1.10 WHERE salary < 12000;

e. Average salary of each company:

SELECT company_name, AVG(salary) AS avg_salary
FROM works
GROUP BY company_name;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2013 AD · 5 marks

Given the following relations where the primary keys are underlined:
EMPLOYEE (EMPLOYEE_NAME, STREET, CITY)
WORKS (EMPLOYEE_NAME, COMPANY_NAME, SALARY)
COMPANY (COMPANY_NAME, CITY)
MANAGERS (EMPLOYEE_NAME, MANAGER_NAME)
Write Relational algebra expression for the following queries.
a. Find name of the manager of Microsoft Company. b. Find names and cities of employee who works for the "CISCO Company" c. Delete record of employees whose salary is less than 10000 d. Increase salary of employees by 5% on employee relation whose salary is less than 5000. e. Find minimum salary of the employee of each company.

Answer

Notation: σ\sigma select, π\pi project, ⋈\bowtie natural join, ←\leftarrow assignment, and GGF_{G}\mathcal{G}_{F} aggregation.

a. Manager of Microsoft Company (found through the employees who work there): πmanager_name(Managers⋈σcompany_name=′Microsoft′(Works))\pi_{manager\_name}\big(Managers \bowtie \sigma_{company\_name='Microsoft'}(Works)\big)

b. Names and cities of employees who work for CISCO: πemployee_name, city(Employee⋈σcompany_name=′CISCO′(Works))\pi_{employee\_name,\ city}\big(Employee \bowtie \sigma_{company\_name='CISCO'}(Works)\big)

c. Delete records of employees whose salary is less than 10000: Works←Works−σsalary<10000(Works)Works \leftarrow Works - \sigma_{salary<10000}(Works) To remove the employees completely: Employee←Employee−πemployee_name,street,city(Employee⋈σsalary<10000(Works))Employee \leftarrow Employee - \pi_{employee\_name,street,city}\big(Employee \bowtie \sigma_{salary<10000}(Works)\big)

d. Increase salary by 5% for those below 5000: Works←πemployee_name, company_name, salary×1.05(σsalary<5000(Works))∪σsalary≥5000(Works)Works \leftarrow \pi_{employee\_name,\ company\_name,\ salary\times1.05}\big(\sigma_{salary<5000}(Works)\big) \cup \sigma_{salary\ge5000}(Works)

e. Minimum salary of each company: company_nameGmin⁡(salary)(Works)_{company\_name}\mathcal{G}_{\min(salary)}(Works)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

What do you mean by schema of a database?

Answer

A database schema is the overall logical design or structure of a database. It describes the relations, their attributes, data types, keys and constraints. It is specified at design time and changes rarely, unlike the data (the instance), which changes often. Example: Student(roll, name, address).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

What is theta join?

Answer

A theta join (⋈θ\bowtie_\theta) combines tuples from two relations that satisfy a given condition θ\theta, which can use any comparison operator (=,<,>,≤,≥,≠=, <, >, \le, \ge, \ne). R⋈θS=σθ(R×S)R \bowtie_\theta S = \sigma_\theta(R \times S). When θ\theta uses only equality, it is called an equi-join.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

What do you mean by entity constraint?

Answer

The entity integrity constraint states that no attribute of the primary key of a relation may be NULL. Every tuple must have a unique, non-null primary-key value so that each entity can be identified.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

How parallel database differs from centralized database?

Answer

A centralized database runs on a single computer with one CPU and one disk system, so queries and transactions are processed one after another by one processor. A parallel database uses multiple processors, memory and disks working simultaneously (shared-memory, shared-disk or shared-nothing architecture), so it gives higher throughput and faster response time on large data and can be scaled by adding hardware.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

What is extraneous attribute?

Answer

An extraneous attribute is an attribute in a functional dependency that can be removed from it without changing the closure of the set of dependencies. For FF and a dependency α→β\alpha \to \beta, attribute AA in α\alpha is extraneous if FF still implies (α−A)→β(\alpha - A) \to \beta. For example, in {A→C, AB→C}\{A \to C,\ AB \to C\}, BB is extraneous in AB→CAB \to C.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

Write syntax to define trigger in SQL

Answer

CREATE TRIGGER trigger_name
{BEFORE | AFTER} {INSERT | UPDATE | DELETE} ON table_name
[REFERENCING OLD ROW AS old NEW ROW AS new]
FOR EACH ROW
[WHEN (condition)]
BEGIN
    -- trigger action (SQL statements)
END;

Example: CREATE TRIGGER log_del AFTER DELETE ON student FOR EACH ROW INSERT INTO log VALUES (OLD.roll);

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

Why is dynamic SQL used?

Answer

Dynamic SQL is used when the SQL statement is not known until run time. It lets a program build SQL strings on the fly (for example, from user input such as table names, columns or search conditions), then prepare and execute them. This makes applications flexible, such as general query tools and interactive interfaces, which static embedded SQL cannot support.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

What is NULL value in database?

Answer

A NULL value represents missing, unknown or inapplicable data. It is not the same as zero or an empty string. Any arithmetic or comparison with NULL gives unknown, so it is tested with IS NULL or IS NOT NULL. Primary-key attributes cannot be NULL.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 1 mark

What do you mean by closure of an attribute?

Answer

The closure of an attribute set XX, written X+X^+, with respect to a set FF of functional dependencies, is the set of all attributes that are functionally determined by XX using FF. If X+X^+ contains all attributes of the relation, then XX is a superkey.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 3 marks

Explain 3NF and BCNF with examples.

Answer

Third Normal Form (3NF): a relation is in 3NF if it is in 2NF and no non-prime attribute is transitively dependent on a key. Formally, for every dependency X→AX \to A, either XX is a superkey or AA is a prime attribute.

Example: STUDENT(Roll, Name, Dept, Dept_Head) with Roll → Dept and Dept → Dept_Head. Dept_Head depends on the key transitively through Dept. Decompose into STUDENT(Roll, Name, Dept) and DEPARTMENT(Dept, Dept_Head).

Boyce-Codd Normal Form (BCNF): a stricter form. A relation is in BCNF if for every non-trivial dependency X→YX \to Y, XX is a superkey.

Example: TEACH(Student, Course, Teacher) with (Student, Course) → Teacher and Teacher → Course. The relation is in 3NF (Course is prime) but not BCNF, since Teacher is not a superkey. Decompose into TEACHER_COURSE(Teacher, Course) and STUDENT_TEACHER(Student, Teacher).

Every BCNF relation is in 3NF, but not the reverse. BCNF may lose some dependency preservation.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 3 marks

What do you mean by distributed database system? Explain different reasons for building distributed database system.

Answer

A distributed database system consists of loosely coupled sites (computers) that share no physical components, each with its own local database, connected by a network. Users at any site can access data at any other site as if it were stored locally, and the data is logically one database.

Reasons for building a distributed database system

  1. Sharing of data: users at one site can access data at other sites, while each site keeps control of its local data.
  2. Autonomy: each site can control its own data and administer it locally.
  3. Availability and reliability: if one site fails, the others continue to work; replication of data keeps it available.
  4. Faster access: data is stored near where it is used most, reducing communication cost and response time.
  5. Reflects organisational structure: it matches organisations with branches in different locations (banks, companies).
  6. Scalability and parallelism: new sites can be added easily, and queries can run in parallel at different sites.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 3 marks

Write SQL statement to create following tables:
Project (Pid, pname, budget)
Employee (Eid, name, address, Pid) Foreign Key Pid References Project

Answer

CREATE TABLE Project (
    Pid     INT PRIMARY KEY,
    pname   VARCHAR(50) NOT NULL,
    budget  DECIMAL(12,2)
);

CREATE TABLE Employee (
    Eid      INT PRIMARY KEY,
    name     VARCHAR(50) NOT NULL,
    address  VARCHAR(100),
    Pid      INT,
    FOREIGN KEY (Pid) REFERENCES Project(Pid)
);

Project is created first so that the foreign key in Employee can refer to it.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 3 marks

What is transaction? Explain concurrent transactions with example.

Answer

A transaction is a logical unit of work consisting of one or more database operations (reads and writes) that must be executed as a whole. It transforms the database from one consistent state to another. It has the ACID properties: Atomicity, Consistency, Isolation and Durability.

Concurrent transactions are transactions that execute at the same time with their operations interleaved. They improve throughput and reduce waiting time, but if not controlled they can cause problems such as lost update, dirty read and inconsistent (unrepeatable) read. The concurrency control manager must ensure that the result is equivalent to some serial execution (serializability).

Example: Account A has Rs 1000. T1 withdraws Rs 100 and T2 withdraws Rs 200 concurrently.

T1: read(A)  -> 1000
T2: read(A)  -> 1000
T1: A = 900;  write(A)
T2: A = 800;  write(A)

The final balance is Rs 800, but the correct balance is Rs 700. T1's update is lost. Using locks (T1 locks A, finishes, then T2 reads 900) gives the correct result Rs 700.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 3 marks

Consider schema U={A,B,C,D,E,F}U=\{A,B,C,D,E,F\} and the functional dependencies AB→CAB\to C, B→EB\to E, CF→DCF\to D. Find closure of ABAB.

Answer

Given F={AB→C, B→E, CF→D}F = \{AB \to C,\ B \to E,\ CF \to D\}. Compute (AB)+(AB)^+:

  1. Start: (AB)+={A,B}(AB)^+ = \{A, B\}.
  2. AB→CAB \to C: A,BA, B are in the set, so add CC: {A,B,C}\{A, B, C\}.
  3. B→EB \to E: BB is in the set, so add EE: {A,B,C,E}\{A, B, C, E\}.
  4. CF→DCF \to D: FF is not in the set, so it cannot be applied.
  5. No further change.

(AB)+={A,B,C,E}(AB)^+ = \{A, B, C, E\}

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 5 marks

Design a database using ER diagram for a mobile shop. This mobile shop maintains information about entities: customer, mobile, bills, and login.
  • Customer has attributes: cid, cname, address, phone, type, the name is composed of first_name, middle_name, and last_name
  • Mobile has attributes: model, name, brand, IMEINO. A customer may purchase one or more mobile and request only one bill for payment.
  • Login has attributes: userid and password
  • Bill has attributes: billno, cname, amount
State any assumptions made in the design of the E-R diagram

Answer

Entity sets and attributes

  • CUSTOMER: cid (key), cname (composite: first_name, middle_name, last_name), address, phone, type.
  • MOBILE: IMEINO (key), model, name, brand.
  • BILL: billno (key), cname, amount.
  • LOGIN: userid (key), password.

Relationships

  • PURCHASES: CUSTOMER (1) to MOBILE (N). A customer may purchase one or more mobiles; each mobile unit (identified by its IMEI) is sold to one customer. CUSTOMER participation is partial.
  • REQUESTS: CUSTOMER (1) to BILL (1). A customer requests only one bill for payment (one bill covers all the purchases). BILL has total participation.
  • HAS_LOGIN: CUSTOMER (1) to LOGIN (1), a customer logs in with a userid and password.
[LOGIN]--1--<HAS_LOGIN>--1--[CUSTOMER]--1--<PURCHASES>--N--[MOBILE]
 userid,password              cid, cname(fn,mn,ln),          IMEINO, model, name, brand
                              address, phone, type
                                  |
                              1 <REQUESTS> 1
                                  |
                               [BILL] billno, cname, amount

Assumptions

  • IMEINO uniquely identifies each physical mobile, so a mobile unit is sold only once.
  • cname in BILL is a copy of the customer's name (a derivable attribute) and is kept for display; the bill is linked to the customer through REQUESTS.
  • amount is the total of the prices of the mobiles purchased.
  • type of customer indicates a category such as regular or wholesale.
  • Each login belongs to exactly one customer, and userid is unique.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 5 marks

Consider the following relational database.
Students(RollNumber, StudentName, Address, Year)
Teachers(TeacherID, TeacherName, CourseID, Salary, Department)
Courses(CourseID, RollNumber, CourseTitle, Semester)
Write relational algebra expression for the following requests
i) Find the name of the Students of 3rd year and studying Computer Network ii) Find the name of the teacher who teaches subject "Database System" to Rajan Sharma. iii) Find the maximum salary of teacher in each department. iv) Delete record of 4th year students of Account department v) Change salary of teacher Arju Shrestha from 21000 to 17000.

Answer

Notation: σ\sigma select, π\pi project, ⋈\bowtie natural join, ←\leftarrow assignment, G\mathcal{G} aggregation.

i) Names of 3rd-year students studying Computer Network: πStudentName(σYear=3(Students)⋈σCourseTitle=′Computer Network′(Courses))\pi_{StudentName}\big(\sigma_{Year=3}(Students) \bowtie \sigma_{CourseTitle='Computer\ Network'}(Courses)\big)

ii) Name of the teacher who teaches "Database System" to Rajan Sharma: πTeacherName(Teachers⋈σCourseTitle=′Database System′(Courses)⋈σStudentName=′Rajan Sharma′(Students))\pi_{TeacherName}\Big(Teachers \bowtie \sigma_{CourseTitle='Database\ System'}(Courses) \bowtie \sigma_{StudentName='Rajan\ Sharma'}(Students)\Big) Teachers and Courses join on CourseID; Courses and Students join on RollNumber.

iii) Maximum salary of teachers in each department: DepartmentGmax⁡(Salary)(Teachers)_{Department}\mathcal{G}_{\max(Salary)}(Teachers)

iv) Delete records of 4th-year students of the Account department. The Students relation has no department attribute, so the department is taken from the teachers of their courses: Students←Students−πRollNumber,StudentName,Address,Year(σYear=4(Students)⋈Courses⋈σDepartment=′Account′(Teachers))Students \leftarrow Students - \pi_{RollNumber,StudentName,Address,Year}\Big(\sigma_{Year=4}(Students) \bowtie Courses \bowtie \sigma_{Department='Account'}(Teachers)\Big)

v) Change salary of Arju Shrestha from 21000 to 17000: Teachers←πTeacherID,TeacherName,CourseID,17000,Department(σTeacherName=′Arju Shrestha′∧Salary=21000(Teachers))∪σ¬(TeacherName=′Arju Shrestha′∧Salary=21000)(Teachers)Teachers \leftarrow \pi_{TeacherID,TeacherName,CourseID,17000,Department}\big(\sigma_{TeacherName='Arju\ Shrestha' \wedge Salary=21000}(Teachers)\big) \cup \sigma_{\neg(TeacherName='Arju\ Shrestha' \wedge Salary=21000)}(Teachers)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2014 AD · 5 marks

Consider the following relational database
Project (P_ID, P_Name, P_Location, Type)
Employee (Emp_Id, Emp_Name, Address, Salary, Post, Date_Join)
Works (Dept_No, Emp_Id, Shift)
Write the SQL statement for the following queries
i) Insert new project {'P1002','Edge of tomorrow','Putalinagar','Private'}, ii) List the name of the employees who work at "Save the Children" project. iii) List the name of the employees whose salary is above the average salary. iv) Remove record of all employees who work in morning shift at the project located in Bagbazar Kathmandu v) Change address and post of employee 'Singh Shab' to 'Pokhara' and 'assistant lecturer'.

Answer

Works(Dept_No, Emp_Id, Shift) is taken to record the project (Dept_No holds the project id, P_ID) on which each employee works.

i) Insert a new project:

INSERT INTO Project (P_ID, P_Name, P_Location, Type)
VALUES ('P1002', 'Edge of tomorrow', 'Putalinagar', 'Private');

ii) Employees working at the "Save the Children" project:

SELECT e.Emp_Name
FROM Employee e, Works w, Project p
WHERE e.Emp_Id = w.Emp_Id
  AND w.Dept_No = p.P_ID
  AND p.P_Name = 'Save the Children';

iii) Employees whose salary is above the average salary:

SELECT Emp_Name
FROM Employee
WHERE Salary > (SELECT AVG(Salary) FROM Employee);

iv) Remove employees who work in the morning shift at the project located in Bagbazar, Kathmandu (employee rows first, then the Works rows, so the subquery still finds them):

DELETE FROM Employee
WHERE Emp_Id IN (SELECT w.Emp_Id FROM Works w, Project p
                 WHERE w.Dept_No = p.P_ID AND w.Shift = 'Morning'
                   AND p.P_Location = 'Bagbazar Kathmandu');

DELETE FROM Works
WHERE Shift = 'Morning'
  AND Dept_No IN (SELECT P_ID FROM Project WHERE P_Location = 'Bagbazar Kathmandu');

v) Change address and post of 'Singh Shab':

UPDATE Employee
SET Address = 'Pokhara', Post = 'assistant lecturer'
WHERE Emp_Name = 'Singh Shab';

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

Differentiate between generalization and specialization.

Answer

Generalization is a bottom-up process: several lower-level entity sets with common attributes are combined into one higher-level entity set (e.g. Student and Teacher into Person). Specialization is a top-down process: a higher-level entity set is divided into lower-level subgroups that have their own distinct attributes (e.g. Employee into Manager and Clerk).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

List any four advantages of relational DBMS.

Answer

  • Data is stored in simple tables (relations), which are easy to understand and use.
  • Data independence: the physical storage can change without affecting applications.
  • Integrity constraints (keys, foreign keys, domain constraints) keep data consistent and accurate.
  • Powerful, standard query language (SQL) for retrieval and manipulation.
  • Reduced redundancy through normalization, and better security and concurrent access.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

Define one to one relationship.

Answer

A one-to-one relationship is a relationship in which an entity in set A is associated with at most one entity in set B, and an entity in B is associated with at most one entity in A. For example, one person has one passport and one passport belongs to exactly one person.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

Write SQL syntax to create a VIEW.

Answer

CREATE VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
WHERE condition;

For example, CREATE VIEW cheap_items AS SELECT id, name FROM item WHERE price < 100;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

Why is GROUP BY clause used?

Answer

The GROUP BY clause is used to arrange rows that have the same values in one or more columns into groups, so that aggregate functions such as COUNT, SUM, AVG, MAX and MIN can be applied to each group separately (e.g. total salary per department).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

What is delete anomaly?

Answer

A delete anomaly occurs when deleting a record unintentionally removes other important information that was stored in the same row. For example, if a table holds student and course details together, deleting the only student enrolled in a course also deletes the course's information. It is caused by poor design (redundancy) and is removed by normalization.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

Write functions of storage manager.

Answer

The storage manager is the DBMS component that provides the interface between the low-level data stored on disk and the application programs and queries. Its functions are:

  • Authorization and integrity manager: checks integrity constraints and the authority of users.
  • Transaction manager: ensures the database stays consistent despite failures and that concurrent transactions run without conflict.
  • File manager: manages disk space allocation and the data structures used to represent information on disk.
  • Buffer manager: fetches data from disk into main memory and decides what to cache.
  • It also maintains data files, the data dictionary and indices.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

Why is domain constraints required?

Answer

Domain constraints specify the set of permissible values (data type, range, format, NOT NULL) for each attribute. They are required so that only valid data is entered (e.g. age must be a positive integer, gender only 'M' or 'F'), which maintains the integrity and consistency of the database and allows the system to check values and compare them meaningfully.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

What is isolated transaction?

Answer

Isolation is the ACID property which requires that concurrently executing transactions do not interfere with each other. Each transaction behaves as if it were the only one running, and its intermediate (uncommitted) results are not visible to other transactions. An isolated transaction is therefore one whose effect is the same as if it ran alone, so the final result equals that of some serial execution.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 1 mark

What is serializability?

Answer

Serializability is the property of a concurrent schedule whereby its outcome is equivalent to that of some serial schedule of the same transactions. A schedule that is serializable keeps the database consistent. It is tested through conflict serializability (using a precedence graph, which must be acyclic) or view serializability.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 4 marks

Write down the SQL statements to create following table (assume appropriate data types):
Customers(customerID, customerName, phone, date_of_birth)
Orders(orderID, orderDate, deliveryDate, customerID(FK))
Payments(paymentID, paidDate, amount, orderID(FK))

Answer

CREATE TABLE Customers (
    customerID   INT PRIMARY KEY,
    customerName VARCHAR(100) NOT NULL,
    phone        VARCHAR(15),
    date_of_birth DATE
);

CREATE TABLE Orders (
    orderID      INT PRIMARY KEY,
    orderDate    DATE NOT NULL,
    deliveryDate DATE,
    customerID   INT NOT NULL,
    FOREIGN KEY (customerID) REFERENCES Customers(customerID)
);

CREATE TABLE Payments (
    paymentID INT PRIMARY KEY,
    paidDate  DATE NOT NULL,
    amount    DECIMAL(10,2) NOT NULL,
    orderID   INT NOT NULL,
    FOREIGN KEY (orderID) REFERENCES Orders(orderID)
);

The tables are created in this order so that every referenced table already exists when a foreign key is declared.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 4 marks

Consider the following relations and write the SQL statements to:
Customers(customerID, customerName, phone, date_of_birth)
Orders(orderID, orderDate, deliveryDate, customerID(FK))
Payments(paymentID, paidDate, amount, orderID(FK))
a. Find the total amount paid by each customer b. Find the list of those customers who has not made any orders till date

Answer

(a) Total amount paid by each customer:

SELECT c.customerID, c.customerName, SUM(p.amount) AS total_paid
FROM Customers c
JOIN Orders o   ON o.customerID = c.customerID
JOIN Payments p ON p.orderID = o.orderID
GROUP BY c.customerID, c.customerName;

(b) Customers who have not made any orders till date:

SELECT customerID, customerName
FROM Customers
WHERE customerID NOT IN (SELECT customerID FROM Orders);

An equivalent form uses NOT EXISTS:

SELECT c.customerID, c.customerName
FROM Customers c
WHERE NOT EXISTS (SELECT 1 FROM Orders o WHERE o.customerID = c.customerID);

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 4 marks

Normalize following table:
Product_details
PidpnamePricemidMnameAddressPhone
1ABC1000101EPGKtm Bkt4412
2XYZ2000101EPGBkt4561
1ABC3000102MNPLtp,Ktm2341
3ABC1000105LBDBrt,Bkt2169
4XYZ1000105LBDKtm6635

Answer

Assumptions (from the data): pid -> pname; mid -> Mname; the price depends on both the product and the manufacturer, so (pid, mid) -> Price. Address and phone belong to the manufacturer, and a manufacturer can have several addresses/phones (e.g. "Ktm Bkt", "Ltp,Ktm" hold more than one value).

1NF: Every attribute must be atomic. The composite values in Address (such as "Ktm Bkt", "Brt,Bkt") are split so each row has one value. The key of the table is (pid,mid)(pid, mid).

2NF: Remove partial dependencies on the composite key (pid,mid)(pid, mid):

  • pid→pnamepid \to pname (partial)
  • mid→Mnamemid \to Mname, Address, Phone (partial)

Only PricePrice depends on the full key. Decomposing:

  • Product(pid, pname)
  • Manufacturer(mid, Mname)
  • ManufacturerAddress(mid, address)
  • ManufacturerPhone(mid, phone)
  • Product_Manufacturer(pid, mid, Price) with pid and mid as foreign keys

3NF: There are no transitive dependencies among non-key attributes in these relations (Product: only pid→pnamepid \to pname; Manufacturer: only mid→Mnamemid \to Mname; Product_Manufacturer: only (pid,mid)→Price(pid, mid) \to Price), so the above relations are already in 3NF.

Resulting data:

Pidpname
1ABC
2XYZ
3ABC
4XYZ
midMname
101EPG
102MNP
105LBD
pidmidPrice
11011000
21012000
11023000
31051000
41051000

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 4 marks

Write algorithm to find closure of attribute sets.

Answer

The closure X+X^+ of an attribute set XX under a set of functional dependencies FF is the set of all attributes that are functionally determined by XX.

Algorithm:

Input : attribute set X, set of functional dependencies F
Output: X+

result := X
repeat
    old := result
    for each functional dependency A -> B in F do
        if A is a subset of result then
            result := result U B
until result = old
return result

Explanation: Start with XX itself. In each pass, whenever the left-hand side of a dependency is already contained in the result, add its right-hand side. Stop when a full pass adds nothing new.

Example: R(A,B,C,D)R(A,B,C,D), F={A→B, B→C}F = \{A \to B,\ B \to C\}. For X={A}X=\{A\}: result ={A}=\{A\}, then {A,B}\{A,B\} using A→BA\to B, then {A,B,C}\{A,B,C\} using B→CB\to C. So A+={A,B,C}A^+=\{A,B,C\}.

Uses: testing whether XX is a superkey (if X+X^+ contains all attributes of RR), checking whether a dependency X→YX \to Y holds (Y⊆X+Y \subseteq X^+), and computing a canonical cover.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 4 marks

Design ER model of a database for a world-wide package delivery company (e.g., DHL or Fed EX). The database must be able to keep track of customers (who ship items) and customers (who receive items); some customers may do both. It is known that every order has a one-time payment. Choose appropriate attributes and list all assumptions made (if any).

Answer

Entities and attributes

  • Customer (<u>customer_id</u>, name, address, phone, email). A customer can be a sender, a receiver, or both, so one entity set is used for both roles.
  • Order (<u>order_id</u>, order_date, service_type, total_charge)
  • Package (<u>package_id</u>, weight, type, description, declared_value)
  • Payment (<u>payment_id</u>, amount, payment_date, method)
  • Tracking_Event (weak entity: <u>event_no</u>, status, location, event_time)
  • Branch/Hub (<u>hub_id</u>, name, city, country)

Relationships

  • Customer ships Order: one-to-many (a customer may place many orders as sender; each order has exactly one sender).
  • Customer receives Order: one-to-many (each order has exactly one receiver; a customer may receive many orders). The two relationships (ships, receives) both link the same Customer entity set, so a customer can play both roles.
  • Order contains Package: one-to-many (an order has one or more packages).
  • Order has Payment: one-to-one (every order has a single one-time payment), with total participation of both.
  • Package has Tracking_Event: one-to-many (weak entity identified by package_id plus event_no).
  • Tracking_Event occurs at Hub: many-to-one.

ER diagram (text form)

Customer (1) --ships--> (N) Order <--receives-- (1) Customer
Order (1) --has-- (1) Payment
Order (1) --contains-- (N) Package (1) --has-- (N) Tracking_Event (N) --at-- (1) Hub

Assumptions

  • Each order has exactly one sender and one receiver, who may be the same customer.
  • Payment is made once per order, so Payment is in one-to-one relation with Order.
  • An order has at least one package, and each package belongs to one order.
  • Tracking events are recorded as the package moves through hubs.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 5 marks

List functions of concurrency control manager. Explain shadow paging algorithm of database recovery technique

Answer

Functions of the concurrency control manager

  • Ensures that concurrent transactions execute without interfering with one another (isolation).
  • Controls access to data items using locks, timestamps or validation, and decides whether a request is granted, delayed or aborted.
  • Preserves serializability so the database stays consistent.
  • Detects and resolves (or prevents) deadlocks.
  • Prevents lost update, dirty read and unrepeatable read problems.

Shadow paging

Shadow paging is a recovery technique that does not use a log. The database is divided into fixed-size disk pages, and a page table (directory) has an entry pointing to each page.

  1. At the start of a transaction, the current page table is copied to a shadow page table, which is saved on disk and never changed during the transaction.
  2. When a transaction writes to a page, a new copy of that page is made on a free disk block, and the change is made in the copy. The current page table is updated to point to the new page; the shadow table still points to the original.
  3. Commit: the current page table becomes the new shadow page table (the pointer to the table is switched atomically). Old pages are freed.
  4. Failure/abort: the current page table is discarded and the shadow page table is used, so the database returns to its state before the transaction. No undo or redo is needed.

Advantages: no log writing, fast recovery. Disadvantages: data fragmentation, garbage collection of old pages, overhead of copying the page table, and difficulty with concurrent transactions.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2015 AD · 5 marks

Identify and explain database user.

Answer

Database users are classified by the way they interact with the system.

  • Naive (end) users: unsophisticated users who use pre-written application programs and forms, such as a bank teller or a ticket-booking clerk. They need no knowledge of the DBMS.
  • Application programmers: computer professionals who write application programs in languages such as Java, PHP or C using embedded SQL or APIs to access the database.
  • Sophisticated users: analysts and scientists who write queries directly in a query language (SQL) or use tools such as OLAP and data mining, without writing programs.
  • Specialized users: write specialized database applications that do not fit the traditional data-processing framework, such as CAD systems, knowledge-based systems and multimedia databases.
  • Database administrator (DBA): has central control over the system. The DBA defines the schema and storage structure, grants access and authorization, takes backups and recovery, monitors performance, and maintains security and integrity.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

List any four major characteristics of DBMS.

Answer

  • Self-describing nature: the database contains a catalogue (metadata) describing its own structure.
  • Data independence (insulation between programs and data).
  • Controlled redundancy and consistency of data.
  • Support for multiple views of the data and for multi-user concurrent access.
  • Data security, integrity constraints and backup/recovery.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

What do you mean by data abstraction?

Answer

Data abstraction means hiding the complex details of how data is stored and maintained and showing users only the information they need. A DBMS has three levels: the physical level (how data is actually stored), the logical level (what data is stored and the relationships between them), and the view level (the part of the database relevant to a particular user).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

What is use of Entity Relationship Diagram?

Answer

An entity-relationship diagram is used to model the data of an organization graphically at the conceptual design stage. It shows entities, their attributes, and the relationships and constraints among them, helping designers and users understand and communicate the database structure before it is converted into relational tables.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

What happens if a view is updated?

Answer

A view stores no data of its own, so an update on a view is translated into an update on the underlying base table(s) and the change appears in the base table. This is possible only for simple views (based on a single table, containing the primary key, with no aggregates, DISTINCT or GROUP BY). Updates on complex views, such as those with joins or aggregation, are normally not allowed.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

Why do we need normalization?

Answer

Normalization is needed to organize data into well-structured tables so that redundancy is reduced and insertion, update and deletion anomalies are avoided. It saves storage, keeps data consistent and makes the database easier to maintain.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

What is the advantage of creating primary key in a table?

Answer

A primary key uniquely identifies each row of a table, so duplicate and NULL values are not allowed in it. It maintains entity integrity, allows rows to be retrieved quickly (an index is created automatically), and is what other tables reference through foreign keys.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

How can authorization and authentication be implemented using SQL commands?

Answer

Authentication (verifying who the user is) is implemented by creating user accounts with passwords, and authorization (what the user may do) by granting and revoking privileges.

CREATE USER ram IDENTIFIED BY 'secret123';
GRANT SELECT, INSERT ON employee TO ram;
GRANT SELECT ON employee TO ram WITH GRANT OPTION;
REVOKE INSERT ON employee FROM ram;

Roles can also be used to group privileges: CREATE ROLE clerk; GRANT SELECT ON employee TO clerk; GRANT clerk TO ram;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

Write down the uses of GROUP BY clause.

Answer

  • To divide rows into groups that share the same value in one or more columns.
  • To apply aggregate functions (COUNT, SUM, AVG, MAX, MIN) to each group, e.g. total sales per branch.
  • Together with HAVING, to filter groups after aggregation.
  • To produce summary reports and to list distinct values of a column.

Example: SELECT dept_id, AVG(salary) FROM employee GROUP BY dept_id HAVING AVG(salary) > 30000;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

Why do we need data recovery mechanism?

Answer

A recovery mechanism is needed because failures such as transaction errors, system crashes, power loss, disk failure or software bugs can leave the database inconsistent or lose data. Recovery restores the database to the last consistent state, preserving atomicity (a transaction is completed fully or not at all) and durability (committed changes are not lost).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 1 mark

What is concurrency control in database management system?

Answer

Concurrency control is the set of techniques a DBMS uses to manage the simultaneous execution of transactions so that they do not interfere with each other. It ensures isolation and database consistency, and prevents problems such as lost update, dirty read and unrepeatable read. Common methods are locking, timestamp ordering and optimistic validation.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 4 marks

Normalize the following schema, with given constraints, to 3NF.
books(isbn, title, author, publisher)
users(userid, name, deptid, deptname)
Given functional dependencies:
isbn -> title
isbn -> publisher
isbn -> author
userid -> name
userid -> deptid
deptid -> deptname

Answer

Given:

  • isbn→title,publisher,authorisbn \to title, publisher, author
  • userid→name,deptiduserid \to name, deptid
  • deptid→deptnamedeptid \to deptname

books(isbn, title, author, publisher)

The only key is isbnisbn, and every other attribute depends directly on it. There are no partial dependencies (the key is a single attribute) and no transitive dependencies, so books is already in 3NF.

users(userid, name, deptid, deptname)

  • Key: useriduserid.
  • 1NF and 2NF: all attributes are atomic and the key is a single attribute, so there are no partial dependencies.
  • 3NF violation: userid→deptiduserid \to deptid and deptid→deptnamedeptid \to deptname, so deptnamedeptname depends transitively on the key through deptiddeptid. Decompose:
users(userid, name, deptid)         -- deptid is FK to department
department(deptid, deptname)

Final 3NF schema

books(isbn, title, author, publisher)
users(userid, name, deptid)
department(deptid, deptname)

In each relation every non-key attribute depends only on the key, so the schema is in 3NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 4 marks

SoftNEP Pvt. Ltd., an IT Firm provides multiple services to its client. A client can take multiple services with a service start date and service end date. A client has to pay annual to renew the service for another year.
Draw the ER-model for the given scenario (assuming any other relevant facts if necessary).

Answer

Entities

  • Client (<u>client_id</u>, name, address, phone, email)
  • Service (<u>service_id</u>, service_name, description, annual_fee)
  • Payment (<u>payment_id</u>, payment_date, amount)

Relationships

  • Client subscribes to Service: many-to-many. The relationship has the attributes start_date and end_date. Since a client can renew a service every year, a subscription is identified by (client_id, service_id, start_date), and each renewal is a new subscription period.
  • Subscription has Payment: one-to-many, because an annual payment is made for each year of the service.

ER diagram (text form)

[Client] N ----< Subscribes (start_date, end_date) >---- M [Service]
                         |
                         | 1
                         N
                     [Payment]

Assumptions

  • A client may take many services, and a service may be taken by many clients.
  • Each subscription runs for one year from start_date to end_date, and is renewed by paying the annual fee.
  • Every payment relates to exactly one subscription period.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 4 marks

Write SQL statements of create tables for following entities:
Person(pid, name, address)
Class(classid, pid, total_number_of_students)

Answer

CREATE TABLE Person (
    pid     INT PRIMARY KEY,
    name    VARCHAR(100) NOT NULL,
    address VARCHAR(200)
);

CREATE TABLE Class (
    classid                  INT PRIMARY KEY,
    pid                      INT,
    total_number_of_students INT CHECK (total_number_of_students >= 0),
    FOREIGN KEY (pid) REFERENCES Person(pid)
);

Here pid in Class is a foreign key referencing Person, so Person is created first.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 4 marks

Define serial schedule with an example. Explain various transaction states in the database.

Answer

Serial schedule

A serial schedule is a schedule in which the transactions are executed one after another with no interleaving: all operations of one transaction complete before the next transaction starts. For nn transactions there are n!n! possible serial schedules, and every serial schedule is correct and leaves the database consistent.

Example with T1T_1 and T2T_2 (serial order T1T_1 then T2T_2):

T1T2
read(A)
A = A - 50
write(A)
commit
read(A)
A = A + 100
write(A)
commit

Transaction states

  • Active: the initial state; the transaction is executing its operations.
  • Partially committed: after the final statement has been executed (results may still be only in main memory).
  • Committed: after successful completion, when changes are permanently stored in the database.
  • Failed: after the discovery that normal execution can no longer proceed.
  • Aborted: after the transaction has been rolled back and the database restored to its state before the transaction started. The transaction may then be restarted or killed.

Transitions: Active -> Partially committed -> Committed; Active or Partially committed -> Failed -> Aborted.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 4 marks

Explain Basic Timestamp Ordering (TO) Protocol of concurrency control technique.

Answer

Timestamp ordering is a concurrency control method that decides the serializability order in advance using timestamps, without locks.

Timestamps

  • Each transaction TiT_i gets a unique timestamp TS(Ti)TS(T_i) when it starts; older transactions have smaller timestamps.
  • Each data item QQ keeps two values: R-TS(Q)R\text{-}TS(Q), the largest timestamp of any transaction that successfully read QQ, and W-TS(Q)W\text{-}TS(Q), the largest timestamp of any transaction that successfully wrote QQ.

Rules

Transaction TiT_i issues read(Q):

  • If TS(Ti)<W-TS(Q)TS(T_i) < W\text{-}TS(Q): TiT_i would read a value already overwritten, so the read is rejected and TiT_i is rolled back and restarted with a new timestamp.
  • Otherwise the read is executed and R-TS(Q)=max⁡(R-TS(Q),TS(Ti))R\text{-}TS(Q) = \max(R\text{-}TS(Q), TS(T_i)).

Transaction TiT_i issues write(Q):

  • If TS(Ti)<R-TS(Q)TS(T_i) < R\text{-}TS(Q): a younger transaction has already read the old value, so the write is rejected and TiT_i is rolled back.
  • If TS(Ti)<W-TS(Q)TS(T_i) < W\text{-}TS(Q): TiT_i is writing an obsolete value, so the write is rejected and TiT_i is rolled back.
  • Otherwise the write is executed and W-TS(Q)=TS(Ti)W\text{-}TS(Q) = TS(T_i).

Properties

  • It guarantees conflict serializability, equivalent to the serial order of timestamps.
  • It is free from deadlock because no transaction waits.
  • Drawbacks: possible starvation of long transactions through repeated restarts, cascading rollbacks, and schedules that may not be recoverable.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 5 marks

Consider the following relations
Users(userID, username, password, email, dateOfBirth, gender, registeredDate)
Categories(categoryID, categoryName, upperLimit)
Expenses(expenseID, spentDate, amount, categoryID, userID)
Write down the SQL statements for the following:
a. Insert a new user. b. Find users whose date of birth is before Jan 01, 2000. c. Find top 5 categories on which users spend their money. d. Find categories in which no expenditure has been made so far. e. Find those users whose expenditure is not less than that of userID 405.

Answer

(a) Insert a new user:

INSERT INTO Users (userID, username, password, email, dateOfBirth, gender, registeredDate)
VALUES (501, 'ram123', 'pass@123', 'ram@example.com', '1998-05-12', 'M', '2024-01-15');

(b) Users born before Jan 01, 2000:

SELECT * FROM Users
WHERE dateOfBirth < '2000-01-01';

(c) Top 5 categories on which users spend most:

SELECT c.categoryID, c.categoryName, SUM(e.amount) AS total_spent
FROM Categories c
JOIN Expenses e ON e.categoryID = c.categoryID
GROUP BY c.categoryID, c.categoryName
ORDER BY total_spent DESC
LIMIT 5;

(d) Categories with no expenditure so far:

SELECT categoryID, categoryName
FROM Categories
WHERE categoryID NOT IN (SELECT categoryID FROM Expenses);

(e) Users whose expenditure is not less than that of user 405:

SELECT userID
FROM Expenses
GROUP BY userID
HAVING SUM(amount) >= (SELECT SUM(amount) FROM Expenses WHERE userID = 405);

To show full user details, join the result with Users on userID.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2016 AD · 5 marks

Define different types of joins and differentiate between join operation and sub query.

Answer

Joins

A join combines rows from two or more tables based on a related column.

  • Inner join: returns only the rows with matching values in both tables.
  • Left (outer) join: returns all rows of the left table and the matching rows of the right table; unmatched right columns are NULL.
  • Right (outer) join: returns all rows of the right table and the matching rows of the left table.
  • Full (outer) join: returns all rows from both tables, with NULLs where there is no match.
  • Cross join: returns the Cartesian product of the two tables.
  • Natural join: joins on all columns with the same name.
  • Self join: a table is joined with itself using aliases.
SELECT e.name, d.dname
FROM employee e
INNER JOIN department d ON e.deptid = d.deptid;

Join versus sub query

JoinSub query
Combines tables side by side in one result.A query nested inside another query, whose result is used by the outer query.
Columns of all joined tables can appear in the result.Only the outer query's columns can be displayed.
Usually faster, as the optimizer can choose efficient join methods.Can be slower, especially when correlated (runs for each outer row).
Harder to write for conditions like "not in" or comparing with an aggregate.Easy for conditions based on aggregates or on existence.
SELECT name FROM employee
WHERE deptid IN (SELECT deptid FROM department WHERE dname = 'IT');

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

What is data abstraction?

Answer

Data abstraction is the process of hiding the complexity of how data is stored and maintained and presenting only the necessary information to users. It is provided at three levels: physical (how data is stored), logical (what data and relationships exist) and view (what a particular user sees).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

What is importance of generalization?

Answer

Generalization combines entity sets that share common attributes into a higher-level entity set. Its importance is that it removes repeated attributes by storing common features once, makes the ER design simpler and more compact, and shows the similarities between entity sets clearly.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

Define set operation in SQL.

Answer

Set operations combine the results of two or more SELECT queries, which must have the same number of columns with compatible data types. The operations are UNION (all rows from both, duplicates removed), INTERSECT (rows common to both) and EXCEPT/MINUS (rows in the first but not in the second). UNION ALL keeps duplicates.

SELECT name FROM student UNION SELECT name FROM teacher;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

Write the SQL statement to display current date.

Answer

SELECT CURRENT_DATE;

In Oracle: SELECT SYSDATE FROM DUAL;. In MySQL, SELECT CURDATE(); also works.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

What is assertion?

Answer

An assertion is a database-wide integrity constraint that states a condition the database must always satisfy, even across several tables. It is checked whenever a relevant change is made, and the change is rejected if the condition would be violated.

CREATE ASSERTION sum_check
CHECK (NOT EXISTS (SELECT * FROM account WHERE balance < 0));

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

Define partial dependency.

Answer

A partial dependency occurs when a non-prime attribute depends on only a part (proper subset) of a composite candidate key rather than on the whole key. For example, in Enrol(StudentID, CourseID, StudentName) with key (StudentID, CourseID), the dependency StudentID→StudentNameStudentID \rightarrow StudentName is partial. It violates 2NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

Write SQL Grant statement to provide read privilege on table students to user Ram.

Answer

GRANT SELECT ON students TO Ram;

The SELECT privilege lets user Ram read (query) the table students but not modify it.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

List process state for transaction processing.

Answer

The states of a transaction are:

  • Active
  • Partially committed
  • Committed
  • Failed
  • Aborted (terminated)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 1 mark

What do you mean by concurrent transactions?

Answer

Concurrent transactions are two or more transactions that execute at the same time, with their operations interleaved, on the same database. They improve throughput and resource utilisation but need concurrency control to keep the database consistent.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 4 marks

A company stores information about employee (ssn, phone, salary), department (dno, dname, budget) and children of employee (childid, name, age). Create ER diagram using entities in previous sentence, make your own assumption about the relationships between the entities.

Answer

Entities and attributes

  • EMPLOYEE(<u>ssn</u>, phone, salary)
  • DEPARTMENT(<u>dno</u>, dname, budget)
  • CHILD(childid, name, age), a weak entity identified by childid together with the owner employee's ssn

Assumptions and relationships

  • WORKS_FOR between EMPLOYEE and DEPARTMENT: many-to-one. An employee works for exactly one department, and a department has many employees (total participation of EMPLOYEE).
  • HAS_DEPENDENT between EMPLOYEE and CHILD: one-to-many, an identifying relationship. A child cannot exist without its employee (total participation of CHILD).

ER diagram (text form)

 [EMPLOYEE] N ----<WORKS_FOR>---- 1 [DEPARTMENT]
   ssn, phone, salary                dno, dname, budget
     |
     | 1
 <<HAS_DEPENDENT>>   (double diamond, identifying)
     | N
 [[CHILD]]  (double rectangle, weak entity)
   childid (partial key), name, age

Mapping to tables: EMPLOYEE(ssn, phone, salary, dno) with dno a foreign key; DEPARTMENT(dno, dname, budget); CHILD(ssn, childid, name, age) with primary key (ssn, childid) and ssn a foreign key to EMPLOYEE.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 4 marks

Write the DDL statements to construct the table with following fields.
Field NameData TypeConstraint
Music_IDTextPrimary key
TitleTextShould not more than 40 character
LyricistTextNot null
RatingNumericMust be positive
GenderCharacterMust be 'm' OR 'f' OR 'o'

Answer

CREATE TABLE Music (
    Music_ID  VARCHAR(20) PRIMARY KEY,
    Title     VARCHAR(40),
    Lyricist  VARCHAR(50) NOT NULL,
    Rating    NUMERIC(4,2) CHECK (Rating > 0),
    Gender    CHAR(1) CHECK (Gender IN ('m', 'f', 'o'))
);
  • PRIMARY KEY makes Music_ID unique and not null.
  • VARCHAR(40) limits Title to at most 40 characters.
  • NOT NULL forces a Lyricist value.
  • CHECK (Rating > 0) keeps Rating positive.
  • CHECK (Gender IN ('m','f','o')) allows only those three values.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 4 marks

Consider the following schema:
Supplier(sid, sname, address)
Parts(pid, pname, color)
Catalog(sid, pid, cost)
Write the following queries in SQL:
a. Find the name of parts for which there is one supplier. b. Find the name of suppliers who supply only red color parts. c. Increase the cost of catalog by 20%. d. Find the name of parts supplied by Acme Widget Suppliers.

Answer

(a) Parts that have exactly one supplier:

SELECT p.pname
FROM Parts p
JOIN Catalog c ON p.pid = c.pid
GROUP BY p.pid, p.pname
HAVING COUNT(c.sid) = 1;

(b) Suppliers who supply only red parts:

SELECT s.sname
FROM Supplier s
WHERE EXISTS (SELECT 1 FROM Catalog c WHERE c.sid = s.sid)
  AND NOT EXISTS (
      SELECT 1
      FROM Catalog c JOIN Parts p ON c.pid = p.pid
      WHERE c.sid = s.sid AND p.color <> 'red');

(c) Increase every cost by 20%:

UPDATE Catalog SET cost = cost * 1.20;

(d) Parts supplied by Acme Widget Suppliers:

SELECT p.pname
FROM Parts p
JOIN Catalog c ON p.pid = c.pid
JOIN Supplier s ON s.sid = c.sid
WHERE s.sname = 'Acme Widget Suppliers';

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 4 marks

What is SQL join? Explain different types of join.

Answer

A join combines rows from two or more tables based on a related column (usually a primary key matched with a foreign key), so that related data stored in separate tables can be retrieved in one result.

Types of join

  1. INNER JOIN: returns only rows with matching values in both tables.
    SELECT e.name, d.dname FROM Employee e INNER JOIN Department d ON e.dno = d.dno;
    
  2. LEFT (OUTER) JOIN: all rows of the left table, with matching right rows; unmatched right columns are NULL.
  3. RIGHT (OUTER) JOIN: all rows of the right table, with matching left rows; unmatched left columns are NULL.
  4. FULL (OUTER) JOIN: all rows from both tables, with NULLs where there is no match.
  5. CROSS JOIN: Cartesian product; every row of the first table paired with every row of the second (m×nm \times n rows).
  6. NATURAL JOIN: joins automatically on all columns having the same name in both tables.
  7. SELF JOIN: a table joined with itself (using aliases), e.g. to find an employee's manager.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 4 marks

Normalize the following relations up to BCNF.
IDFirst NameLast NameSchoolNameSchAddressSchCitySchStateSchPhone
1JoeSmithCarver123 Easy StreetLittle RockAR72201,1,21113
2FredaJosephCarver123 Easy StreetLittle RockAR72201,23434
3BusyBodycloverdale456 AnywhereLittle RockAR72209
4PikapAndropovLakewood789 HighNorth RockAR72222,22222

Answer

Given relation: Student(ID, FirstName, LastName, SchoolName, SchAddress, SchCity, SchState, SchPhone)

Functional dependencies (assumed)

  • ID→FirstName,LastName,SchoolNameID \rightarrow FirstName, LastName, SchoolName
  • SchoolName→SchAddress,SchCity,SchState,SchPhoneSchoolName \rightarrow SchAddress, SchCity, SchState, SchPhone

1NF: The SchPhone column holds multiple values (e.g. 72201,1,21113), so each phone number must go in its own row/atomic value. Phone numbers are placed in a separate relation.

2NF: The key ID is a single attribute, so there is no partial dependency. The relation is already in 2NF.

3NF: ID→SchoolName→SchAddress,…ID \rightarrow SchoolName \rightarrow SchAddress, \dots is a transitive dependency, so the school attributes are separated.

BCNF: In each resulting relation, every determinant is a candidate key, so all are in BCNF:

  • STUDENT(<u>ID</u>, FirstName, LastName, SchoolName) with SchoolName a foreign key
  • SCHOOL(<u>SchoolName</u>, SchAddress, SchCity, SchState)
  • SCHOOL_PHONE(<u>SchoolName, SchPhone</u>)

(The phone is a property of the school, so the multi-valued phone attribute moves to SCHOOL_PHONE.)

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 5 marks

Explain serializable transaction schedule with example.

Answer

A schedule is the order in which operations of concurrent transactions are executed. A schedule is serializable if its result is equivalent to that of some serial schedule (one in which transactions run one after another without interleaving). It gives the concurrency benefits while preserving consistency.

Example: Let T1 transfer Rs 100 from A to B, and T2 add Rs 50 to A. Initially A = 500, B = 200.

T1T2
read(A)
A = A - 100
write(A)
read(A)
A = A + 50
write(A)
read(B)
B = B + 100
write(B)

Here T2 only touches A after T1 has finished with A, and they share no other item. The result (A = 450, B = 300) is the same as the serial schedule T1 followed by T2, so the schedule is serializable.

Types

  • Conflict serializable: the schedule can be turned into a serial one by swapping non-conflicting operations. This is tested with a precedence graph; the schedule is conflict serializable if the graph has no cycle. Two operations conflict if they belong to different transactions, access the same data item and at least one is a write.
  • View serializable: the schedule has the same initial reads, the same read-from relations and the same final writes as some serial schedule.

Every conflict serializable schedule is view serializable, but not the reverse.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2017 AD · 5 marks

Explain different points of a transaction schedule at which transaction may fail and also explain how transaction can be recovered from those mentioned points of a transaction schedule.

Answer

Points of failure

  1. Before the transaction starts or while it is active: logical errors (bad input, divide by zero), deadlock or resource shortage make a transaction fail during execution.
  2. Partially committed state: the last statement has executed but the changes are still in memory buffers; a power loss or disk failure here loses the updates.
  3. After commit: a system crash may occur before the changes are written from buffer to disk.
  4. During rollback/abort: a failure while undoing the transaction.

Types of failure causing these: transaction failure (logical/system error), system crash (power failure, OS crash), and disk failure.

Recovery

  • Log-based recovery: every update is first written to a log (transaction id, data item, old value, new value) using write-ahead logging.
    • Undo: if the transaction had not committed (it failed in the active or partially committed state), its changes are rolled back using old values from the log.
    • Redo: if it had committed (log has the <T commit> record) but the changes were not on disk, they are reapplied using new values from the log.
  • Deferred update: database is changed only after commit, so a failed transaction needs no undo (only redo).
  • Immediate update: changes are written during execution, so undo may be needed.
  • Checkpoints: periodically written so recovery only scans the log after the latest checkpoint.
  • Shadow paging: keeps a shadow copy of the page table; on failure the shadow table is used and the changes are discarded.
  • Disk failure: recovered from backup/archive plus the log.

An aborted transaction is rolled back and may be restarted if the failure was not a logical error.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

What do you mean by relational model.

Answer

The relational model represents data as a collection of relations (tables) made of rows (tuples) and columns (attributes). Each relation has a unique name, a primary key identifies the rows, and relationships between tables are expressed through foreign keys. It is based on set theory and is manipulated with relational algebra and SQL.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

What is the use of a view?

Answer

A view is a virtual table defined by a stored query. It is used to simplify complex queries, hide sensitive columns or rows (security), and present customised data to different users without storing a separate copy.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

Define generalization.

Answer

Generalization is a bottom-up design process in which two or more lower-level entity sets sharing common attributes are combined into a higher-level (superclass) entity set. For example, Car and Truck can be generalized to Vehicle.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

Where will you use CHECK clause?

Answer

The CHECK clause is used in CREATE TABLE or ALTER TABLE to enforce a domain constraint on a column (or row) by restricting the values that may be stored. For example, age INT CHECK (age >= 18) or gender CHAR(1) CHECK (gender IN ('m','f','o')).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

List the use of ORDER BY and LIMIT Clause.

Answer

  • ORDER BY sorts the result rows by one or more columns in ascending (ASC, default) or descending (DESC) order.
  • LIMIT restricts the number of rows returned, e.g. the top N rows; it is often used with ORDER BY (SELECT * FROM Movies ORDER BY ticketPrice DESC LIMIT 5;) and for pagination.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

What do you mean CASCADE ON DELETE?

Answer

ON DELETE CASCADE is a foreign key option specifying that when a row in the parent (referenced) table is deleted, all rows in the child table that reference it are automatically deleted too. This maintains referential integrity.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

Define partial function dependency.

Answer

A partial functional dependency exists when a non-prime attribute is functionally dependent on only part of a composite candidate key. For key (A, B), if A→CA \rightarrow C where C is non-prime, then C is partially dependent on the key. It must be removed to reach 2NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

What do you mean by isolated transaction?

Answer

An isolated transaction is one that executes as if it were the only transaction in the system. Its intermediate results are invisible to other concurrent transactions until it commits. This is the Isolation property of ACID.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

What is Serializable schedule?

Answer

A serializable schedule is a (possibly interleaved) schedule of concurrent transactions whose effect on the database is equivalent to that of some serial schedule. It therefore preserves database consistency.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 1 mark

What do you mean by normalization in database design?

Answer

Normalization is the process of organising the tables and attributes of a database, using functional dependencies and normal forms (1NF, 2NF, 3NF, BCNF), to reduce data redundancy and avoid insertion, update and deletion anomalies.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 4 marks

Define Data Abstraction. Explain logical and physical data independence.

Answer

Data abstraction is hiding the complex details of how data is stored and maintained and showing users only the relevant view. A DBMS provides three levels:

  • Physical level: how data is actually stored (files, indexes, blocks).
  • Logical level: what data is stored and the relationships among them (tables, attributes, constraints).
  • View level: the part of the database relevant to a particular user.

Physical data independence is the ability to change the physical (internal) schema, such as file organisation, indexes or storage devices, without changing the logical schema or application programs. For example, adding an index does not require rewriting queries.

Logical data independence is the ability to change the logical (conceptual) schema, such as adding or removing attributes or tables, without changing external views or application programs. It is harder to achieve than physical independence because applications depend heavily on the logical structure.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 4 marks

Draw a ER diagram of the following. Mention any assumptions.
A dealer deals with multiple petroleum gas companies (Baba Gas, Shyam Gas, etc). A customer can take one or more gas cylinders. A customer number, full name, email address, phone and address are attributes of customer. A customer can order multiple cylinders of one or more companies. Each order has a unique order id, delivery date, delivery address and delivery status. The payment for each order has to be made immediately after the delivery.

Answer

Entities and attributes

  • COMPANY(<u>company_id</u>, name): the gas company (Baba Gas, Shyam Gas, ...)
  • CUSTOMER(<u>customer_no</u>, full_name, email, phone, address)
  • ORDER(<u>order_id</u>, delivery_date, delivery_address, delivery_status)
  • CYLINDER(<u>cylinder_id</u>, type/size, price): offered by a company
  • PAYMENT(<u>payment_id</u>, amount, date, mode)

The dealer is the single business owner, so it is not modelled as an entity.

Relationships and assumptions

  • CUSTOMER places ORDER: 1 to N (a customer can place many orders; each order belongs to one customer).
  • ORDER contains CYLINDER: M to N with attribute quantity (an order can include multiple cylinders of one or more companies).
  • COMPANY supplies CYLINDER: 1 to N (each cylinder type belongs to one company).
  • ORDER has PAYMENT: 1 to 1 (payment is made immediately after delivery; one payment per order, total participation of PAYMENT).

ER diagram (text form)

[CUSTOMER] 1 --<places>-- N [ORDER] 1 --<has>-- 1 [PAYMENT]
                              |
                              N
                         <contains> (quantity)
                              |
                              M
[COMPANY] 1 --<supplies>-- N [CYLINDER]

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 4 marks

Define ACID properties of a transaction. Explain each states of a transaction in detail.

Answer

ACID properties

  • Atomicity: all operations of a transaction are executed or none are (all-or-nothing). The recovery system undoes partial work.
  • Consistency: a transaction takes the database from one consistent state to another, preserving all integrity constraints.
  • Isolation: concurrent transactions do not interfere; each appears to run alone, and intermediate results are hidden.
  • Durability: once committed, changes persist even after system failure.

States of a transaction

  1. Active: the initial state; the transaction is executing its read/write operations.
  2. Partially committed: after its final statement has executed, but changes may still be in main memory and not yet permanent.
  3. Committed: after successful completion, the changes are permanently stored in the database; the transaction can no longer be rolled back.
  4. Failed: normal execution can no longer proceed (error, crash, or a failed check in the partially committed state).
  5. Aborted: the transaction has been rolled back and the database restored to its state before the transaction. The system may then restart the transaction or kill it.

Transitions: Active to Partially committed to Committed; Active or Partially committed to Failed to Aborted.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2018 AD · 4 marks

From the given relation, write SQL statements for given queries:
COMPANY(companyID, companyName, address, phone, estdYear)
JOBS(jobID, jobTitle, jobDescription, companyID, postedDate, lastDateOfApplication)
APPLICANT(applicantID, fullName, email, phone)
APPLICATION_SUBMISSION(jobID, applicantID, submittedDate)
a. Find the list of all the companies that were established in the Year 2018. b. Find the name and phone number of all the applicants. c. Delete all the companies which have never posted any job. d. Find how many applicants were submitted on '2018-08-01' e. Find how many jobs were submitted by each company.

Answer

(a) Companies established in 2018:

SELECT * FROM COMPANY WHERE estdYear = 2018;

(b) Name and phone of all applicants:

SELECT fullName, phone FROM APPLICANT;

(c) Delete companies that never posted a job:

DELETE FROM COMPANY
WHERE companyID NOT IN (SELECT companyID FROM JOBS);

(d) Number of applications submitted on 2018-08-01:

SELECT COUNT(*) FROM APPLICATION_SUBMISSION
WHERE submittedDate = '2018-08-01';

(e) Number of jobs posted by each company:

SELECT companyID, COUNT(jobID) AS total_jobs
FROM JOBS
GROUP BY companyID;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

List the application areas of DBMS.

Answer

  • Banking (accounts, loans, transactions)
  • Airlines and railways (reservations, schedules)
  • Universities and schools (student records, results)
  • Telecommunications (call records, billing)
  • Sales and e-commerce (customers, products, orders)
  • Manufacturing and inventory management
  • Human resources (employee and payroll data)
  • Healthcare and hospitals
  • Finance (stock trading, tax records)
  • Government and library systems

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

What is specialization?

Answer

Specialization is a top-down design process in which a higher-level entity set is divided into lower-level entity sets based on distinguishing characteristics. For example, EMPLOYEE can be specialized into MANAGER and ENGINEER, each with its own extra attributes (the reverse of generalization).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

What is data redundancy?

Answer

Data redundancy is the unnecessary duplication of the same data in multiple places in a database or in several files. It wastes storage and can cause inconsistency and update anomalies. Proper design and normalization reduce it.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

Define a partial dependency.

Answer

A partial dependency is a functional dependency in which a non-prime attribute depends on only part of a composite primary (candidate) key. For key (A, B), if A→CA \rightarrow C, then C is partially dependent. Such dependencies are removed in 2NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

What do you mean by atomicity in transaction?

Answer

Atomicity is the "all or nothing" property of a transaction: either all its operations are performed completely, or none are. If a failure happens midway, the partial changes are rolled back so the database is never left partially updated. The recovery manager ensures this.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

Why views are created in database?

Answer

Views are created to:

  • Provide security by hiding sensitive columns or rows from users.
  • Simplify complex queries by storing them as a named virtual table.
  • Present data in a customised form for different users.
  • Give logical data independence when the underlying tables change.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

What is the role of a query processor?

Answer

The query processor interprets and executes user queries. It parses the SQL query, checks syntax and semantics, translates it to relational algebra, optimises it by choosing the cheapest execution plan, and passes the plan to the evaluation engine, which retrieves data and returns the result.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

Define relational database.

Answer

A relational database is a database that organises data into relations (tables) of rows and columns, with relationships among tables expressed through primary and foreign keys. It is based on the relational model and is managed and queried using SQL (e.g. MySQL, Oracle, PostgreSQL).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

Why is concurrency control required?

Answer

Concurrency control is required to manage simultaneous transactions so that they do not interfere. Without it the following problems arise:

  • Lost update
  • Dirty read (reading uncommitted data)
  • Non-repeatable read
  • Phantom read

It ensures isolation, consistency and correct results while still allowing high throughput.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 1 mark

Write the use of a TRIGGER.

Answer

A trigger is a stored procedure that executes automatically when a specified event (INSERT, UPDATE or DELETE) occurs on a table. It is used to enforce complex business rules and integrity constraints, maintain audit logs, and automatically update related data (e.g. update stock after a sale).

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 4 marks

Write statement of 3NF. Normalize the following database table to 3NF.
Project CodeProject NameProject ManagerProject BudgetEmployees Name
101Sing VillaPratchi500,0000Shamvab, Krishna
102Mishra PharmaPoonam700,0000Krishna, Saumya
103Shrestha HouseRiti900,000Saumya

Answer

Statement of 3NF: A relation is in third normal form if it is in 2NF and no non-prime attribute is transitively dependent on the primary key; i.e. for every non-trivial dependency X→AX \rightarrow A, either X is a superkey or A is a prime attribute.

Given table: Project(ProjectCode, ProjectName, ProjectManager, ProjectBudget, EmployeesName)

Dependencies (assumed): ProjectCode→ProjectName,ProjectManager,ProjectBudgetProjectCode \rightarrow ProjectName, ProjectManager, ProjectBudget. EmployeesName is multi-valued.

1NF: Make each field atomic, so the Employees Name column with several names (Shamvab, Krishna) is split into one employee per row:

ProjectCodeProjectNameProjectManagerProjectBudgetEmployeeName
101Sing VillaPratchi5000000Shamvab
101Sing VillaPratchi5000000Krishna
102Mishra PharmaPoonam7000000Krishna
102Mishra PharmaPoonam7000000Saumya
103Shrestha HouseRiti900000Saumya

The key is (ProjectCode, EmployeeName).

2NF: The project attributes depend only on ProjectCode, a part of the key (partial dependency). Remove them:

  • PROJECT(<u>ProjectCode</u>, ProjectName, ProjectManager, ProjectBudget)
  • PROJECT_EMPLOYEE(<u>ProjectCode, EmployeeName</u>)

3NF: In PROJECT, all attributes depend directly on ProjectCode; there is no transitive dependency (ProjectManager does not determine other attributes). PROJECT_EMPLOYEE has only key attributes. So both relations are in 3NF.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 4 marks

Draw an ER diagram for the following scenario. Make any assumptions if necessary.
"Mrs. Sunaina Pathak is the manager of an art gallery. She wants an online application to keep track of the artists, paintings, customers, orders and payments details. It is known that the admin should store the information of artists and their paintings. Multiple artists can participate to make a painting. A customer can place an order of any number of paintings but must pay in a single installment."

Answer

Entities and attributes

  • ARTIST(<u>artist_id</u>, name, address, phone)
  • PAINTING(<u>painting_id</u>, title, year, price)
  • CUSTOMER(<u>customer_id</u>, name, phone, email, address)
  • ORDER(<u>order_id</u>, order_date, total_amount)
  • PAYMENT(<u>payment_id</u>, amount, payment_date, mode)

Relationships and assumptions

  • ARTIST paints PAINTING: M to N (multiple artists can make one painting; an artist can make many paintings).
  • CUSTOMER places ORDER: 1 to N.
  • ORDER includes PAINTING: M to N with attribute quantity/price (an order can contain any number of paintings).
  • ORDER has PAYMENT: 1 to 1, because payment is made in a single installment.
  • The admin manages all of the data. Payment is made only once per order.

ER diagram (text form)

[ARTIST] M --<paints>-- N [PAINTING] M --<includes>-- N [ORDER]
                                                         | N
                                                    <places>
                                                         | 1
                                                    [CUSTOMER]
[ORDER] 1 --<has>-- 1 [PAYMENT]

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 4 marks

How domain integrity and referential integrity constraints can be specified in database? Explain with example.

Answer

Domain integrity constraints restrict the values a column may hold: data type, NOT NULL, DEFAULT, CHECK and UNIQUE. They ensure that every value lies in its permitted domain.

Referential integrity constraints ensure that a foreign key value in one table must match an existing primary key value in the referenced table (or be NULL). They are specified using FOREIGN KEY ... REFERENCES, optionally with ON DELETE / ON UPDATE actions (CASCADE, SET NULL, RESTRICT).

Example

CREATE TABLE Department (
    dno    INT PRIMARY KEY,
    dname  VARCHAR(30) NOT NULL
);

CREATE TABLE Employee (
    eid     INT PRIMARY KEY,
    name    VARCHAR(40) NOT NULL,
    age     INT CHECK (age >= 18),                  -- domain integrity
    gender  CHAR(1) CHECK (gender IN ('m','f','o')), -- domain integrity
    dno     INT,
    FOREIGN KEY (dno) REFERENCES Department(dno)    -- referential integrity
        ON DELETE CASCADE
);

Here, an employee with age 15 or a dno that does not exist in Department is rejected by the DBMS.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 4 marks

Consider the following relations and answer the following questions:
Movies(movieID, movieName, releaseDate, ticketPrice, buyPrice)
Viewers(viewerID, viewerName, email, phone, age)
Tickets(ticketID, showDateTime, screenNumber, seatNumber, viewerID, movieID)
a. Write the DDL statement to create the Tickets table. b. Write SQL query to find the list of all the movies released in the month of January 2018. c. Write SQL query to find the name and email of viewers whose name contains "Prakash". d. Write SQL to find the name of the viewers of age not less than 18 years.

Answer

(a)

CREATE TABLE Tickets (
    ticketID      INT PRIMARY KEY,
    showDateTime  DATETIME,
    screenNumber  INT,
    seatNumber    VARCHAR(5),
    viewerID      INT,
    movieID       INT,
    FOREIGN KEY (viewerID) REFERENCES Viewers(viewerID),
    FOREIGN KEY (movieID)  REFERENCES Movies(movieID)
);

(b) Movies released in January 2018:

SELECT * FROM Movies
WHERE releaseDate BETWEEN '2018-01-01' AND '2018-01-31';

(c) Name and email of viewers whose name contains "Prakash":

SELECT viewerName, email FROM Viewers
WHERE viewerName LIKE '%Prakash%';

(d) Names of viewers aged not less than 18:

SELECT viewerName FROM Viewers WHERE age >= 18;

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 4 marks

Explain serial schedule with example.

Answer

A serial schedule is a schedule in which the transactions are executed one after another: all operations of one transaction are completed before the next transaction starts, with no interleaving. For nn transactions there are n!n! possible serial schedules. Serial schedules are always consistent but give poor throughput because there is no concurrency.

Example: T1: transfer Rs 100 from A to B. T2: add Rs 50 to A. Initially A = 500, B = 200.

Serial schedule S1 (T1 then T2)

T1T2
read(A); A = A - 100; write(A)
read(B); B = B + 100; write(B)
read(A); A = A + 50; write(A)

Result: A = 450, B = 300.

Serial schedule S2 (T2 then T1) gives A = 450, B = 300 as well, since the two transactions here commute. Both are valid serial schedules, because each transaction runs completely before the other begins.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

  • 2019 AD · 5 marks

What do you mean by data independence? How data independence is achieved in database?

Answer

Data independence is the ability to change the schema at one level of a database system without having to change the schema at the next higher level. It separates application programs from the way data is stored and organised.

Types

  • Physical data independence: the physical (internal) schema can be changed (file organisation, indexes, storage devices, access paths) without changing the logical (conceptual) schema or the application programs.
  • Logical data independence: the logical (conceptual) schema can be changed (adding or removing attributes, entities or relationships) without changing external views or application programs. It is harder to achieve than physical independence.

How it is achieved

  • Through the three-schema architecture (external, conceptual and internal levels).
  • The DBMS keeps mappings between levels: the external/conceptual mapping gives logical independence, and the conceptual/internal mapping gives physical independence.
  • When a lower-level schema changes, only the mapping is modified by the DBA, so higher levels and applications continue to work unchanged.
  • Using views and a high-level query language (SQL) that does not mention physical storage details also supports independence.

Answer checked by Claude Sonnet · Oct 21, 2026

Test yourself · 2 MCQs

Loading…

Questions from TU BIM Fourth Semester ACC 202 Cost and Management Accounting Model Question 2024 (Faculty of Management model question 2024, BIM fourth semester (new course), via EducateNepal), TU BIM Fourth Semester ECO 206 Economics for Business Model Question 2024 (Faculty of Management model question 2024, BIM fourth semester (new course), via EducateNepal), TU BIM Fourth Semester IT 239 Web Technology II Model Question 2024 (Faculty of Management model question 2024, BIM fourth semester (new course), via EducateNepal), TU BIM Fourth Semester IT 240 Business Data Communication and Networking Model Question 2024 (Faculty of Management model question 2024, BIM fourth semester (new course), via EducateNepal), TU BIM Fourth Semester IT 220 Database Management System Model Question 2024 (Faculty of Management model question 2024, BIM fourth semester (new course), via EducateNepal), TU BIM Fourth Semester IT 241 Operating System Model Question 2024 (Faculty of Management model question 2024, BIM fourth semester (new course), via EducateNepal), TU BBA/BIM 4th Semester Cost and Management Accounting 2014 (model question) (Faculty of Management model question 2014 (old course), via EducateNepal), TU BIM Data Structure and Algorithm with Java (IT 218) 2015 AD (Board exam paper, 2015 AD), TU BIM Data Structure and Algorithm with Java (IT 218) 2016 AD (Board exam paper, 2016 AD), TU BIM Data Structure and Algorithm with Java (IT 218) 2017 AD (Board exam paper, 2017 AD), TU BIM Data Structure and Algorithm with Java (IT 218) 2018 AD (Board exam paper, 2018 AD), TU BIM Data Structure and Algorithm with Java (IT 218) 2019 AD (Board exam paper, 2019 AD), TU BIM Web Programming II (IT 219) 2015 AD (Board exam paper, 2015 AD), TU BIM Web Programming II (IT 219) 2016 AD (Board exam paper, 2016 AD), TU BIM Web Programming II (IT 219) 2017 AD (Board exam paper, 2017 AD), TU BIM Web Programming II (IT 219) 2018 AD (Board exam paper, 2018 AD), TU BIM Web Programming II (IT 219) 2019 AD (Board exam paper, 2019 AD), TU BIM Database Management System (ITC 218) 2007 AD (Board exam paper, 2007 AD), TU BIM Database Management System (ITC 218) 2008 AD (Board exam paper, 2008 AD), TU BIM Database Management System (ITC 218) 2009 AD (Board exam paper, 2009 AD), TU BIM Database Management System (ITC 218) 2010 AD (Board exam paper, 2010 AD), TU BIM Database Management System (ITC 218) 2011 AD (Board exam paper, 2011 AD), TU BIM Database Management System (ITC 218) 2012 AD (Board exam paper, 2012 AD), TU BIM Database Management System (ITC 218) 2013 AD (Board exam paper, 2013 AD), TU BIM Database Management System (ITC 218) 2014 AD (Board exam paper, 2014 AD), TU BIM Database Management System (ITC 218) 2015 AD (Board exam paper, 2015 AD), TU BIM Database Management System (ITC 218) 2016 AD (Board exam paper, 2016 AD), TU BIM Database Management System (ITC 218) 2017 AD (Board exam paper, 2017 AD), TU BIM Database Management System (ITC 218) 2018 AD (Board exam paper, 2018 AD), TU BIM Database Management System (ITC 218) 2019 AD (Board exam paper, 2019 AD), TU BIM Micro Economics (ECO 201) 2007 AD (Board exam paper, 2007 AD), TU BIM Micro Economics (ECO 201) 2008 AD (Board exam paper, 2008 AD), TU BIM Micro Economics (ECO 201) 2009 AD (Board exam paper, 2009 AD), TU BIM Micro Economics (ECO 201) 2010 AD (Board exam paper, 2010 AD), TU BIM Micro Economics (ECO 201) 2014 AD (Board exam paper, 2014 AD), TU BIM Micro Economics (ECO 201) 2015 AD (Board exam paper, 2015 AD), TU BIM Micro Economics (ECO 201) 2016 AD (Board exam paper, 2016 AD), TU BIM Micro Economics (ECO 201) 2017 AD (Board exam paper, 2017 AD), TU BIM Micro Economics (ECO 201) 2018 AD (Board exam paper, 2018 AD) and TU BIM Micro Economics (ECO 201) 2019 AD (Board exam paper, 2019 AD). Answers are written for this site; check them against your class notes.