CS409 – Introduction to Database Administration: Midterm Important Subjective (30 Solved Q&As)
Computer Science • Read every solved subjective question with its model answer directly on this page. Free, no login required.
All 664 Midterm Packs · CS409 Course Page · CS409 MCQ Pack (54 MCQs)
-
Explain Database Schema and write two categories name?
Topic: Database Schema & Its Categories • 3 marks marks
A database schema is the overall description of the structure (design) of a database. It defines the tables, the attributes/columns of each table, their data types, the constraints applied on the data and the relationships among the tables. The schema is specified at the time of database design and is not expected to change frequently. It does not contain the actual data; the collection of data stored in the database at a particular moment is called the database instance (or state), which keeps changing as data is inserted, deleted and updated. The two categories of database schema are: 1. Physical Schema: It describes how the data is actually stored on the storage media — the file organization, record formats and indexes used for storage. 2. Logical Schema: It describes the entire logical structure of the database — what data is stored and what relationships exist among that data. Application programmers and administrators mainly work at this level.
-
Define Meta date with example?
Topic: Metadata & Data Dictionary • 3 marks marks
(Note: the paper writes “Meta date”, which means Metadata.) Metadata is defined as “data about data”. It is the descriptive information about the data stored in the database — such as the names of tables and columns, data types, field sizes, constraints, relationships between tables and the access privileges of users. Metadata is stored in a special area of the database called the data dictionary (system catalog), and the DBMS consults it whenever data is accessed. Example: In a Student table, the record “Ali, 20, Lahore” is the actual data, whereas the information that the column StudentName is of type VARCHAR(50), Age is of type INT and RollNo is the primary key is metadata.
-
Define Data Administration and write five responsibilities?
Topic: Data Administration • 5 marks marks
Data Administration (DA) is the function responsible for the overall management of the data resources of an organization. It is a management/policy-level function that deals with data planning, data policies, standards and procedures for the whole organization, rather than with the technical operation of a particular database (which is the DBA's job). The person performing this function is called the Data Administrator. Five responsibilities of Data Administration: 1. Data planning — identifying the present and future data needs of the organization. 2. Developing and enforcing data policies, standards and procedures for data definition and use. 3. Resolving data ownership and data-sharing issues among different departments. 4. Promoting data as a corporate asset and ensuring that it is defined consistently and shared across the organization. 5. Coordinating with management and the DBA, and providing guidance and training to users about data standards.
-
Define DBA Guidelines and write five Features DBMS? Which provide by the DBA?
Topic: DBA Guidelines & Features of DBMS • 5 marks marks
DBA guidelines are the documented set of rules, standards and procedures that govern how the database environment is administered and used. They cover areas such as security and authorization, backup and recovery schedules, naming conventions, change control and performance monitoring, so that the database is managed in a consistent, secure and controlled manner. Five features of a DBMS (which the DBA configures and manages for the users): 1. Data security and authorization — the DBMS restricts unauthorized access; the DBA grants and revokes user privileges. 2. Backup and recovery — the DBMS provides facilities to back up the database and restore it to a consistent state after a failure. 3. Concurrency control — many users can access the same data simultaneously without interfering with each other, through locking and transaction management. 4. Data integrity — integrity constraints (keys, checks, referential integrity) ensure that only valid and consistent data is stored. 5. Data independence — application programs are not affected by changes in the way data is stored (physical) or organized (logical).
-
Scenario given tha Clustered index create krny ka syntax likhna tha?
Topic: Indexes — Clustered Index • 5 marks marks
(Paper's wording, partly in Roman Urdu: a scenario is given, and the syntax for creating a clustered index has to be written.) A clustered index determines the physical order in which the data rows of a table are stored on disk. Its general syntax (SQL Server) is: CREATE CLUSTERED INDEX index_name ON table_name (column_name); Example (scenario): Suppose an Employee table stores the records of employees and the records are to be physically ordered by EmpID. The clustered index is created as: CREATE CLUSTERED INDEX IX_Emp ON Employee (EmpID); Important points: (i) Only ONE clustered index can be created on a table, because the data rows can be physically sorted in only one order. (ii) If a PRIMARY KEY constraint is created on a table that has no clustered index, a clustered index is created by default. (iii) A table without a clustered index is called a heap.
-
Differentiate between database schema and database instance.
Topic: Database Schema & Instances • 3 marks marks
Schema is the overall description/design of the structure of the database (tables, columns, data types, constraints and relationships). It is defined at design time and changes only rarely. Instance (state) is the actual data stored in the database at a particular moment; it changes frequently whenever data is inserted, updated or deleted. In short: the schema is the skeleton or blueprint of the database, while the instance is its current content.
-
Describe the three levels of the three-schema architecture.
Topic: Database Schema & Instances • 5 marks marks
1. External Level: It consists of several external schemas (user views). Each external schema describes the part of the database that a particular user group is interested in and hides the rest of the database from that group. 2. Conceptual Level: The conceptual schema describes the structure of the whole database for all users — all tables, data types, relationships and constraints — without any physical storage details. 3. Internal Level: The internal schema describes the physical storage structure of the database — the files, record formats and indexes used to store the data. This architecture provides data independence between the levels, so a change at one level does not force changes at the higher level.
-
What is a subschema?
Topic: Database Schema & Instances • 3 marks marks
A subschema is a description of a portion of the database that is relevant to a particular user or application program. It corresponds to an external schema in the three-schema architecture: each user or application sees only its own subschema (view) of the database, which simplifies its work and improves security by hiding the rest of the data.
-
What is data independence? Differentiate between physical and logical data independence.
Topic: Database Schema & Instances • 5 marks marks
Data independence is the capacity to change the schema at one level of a database system without having to change the schema at the next higher level, so that application programs remain unaffected. Physical data independence is the capacity to change the internal (physical) schema — for example, changing the file organization or adding an index — without changing the conceptual schema. Logical data independence is the capacity to change the conceptual schema — for example, adding a new table or a new column — without changing the external schemas or the application programs. Logical data independence is harder to achieve than physical data independence.
-
Why does the database schema remain almost fixed while the database instance changes frequently?
Topic: Database Schema & Instances • 3 marks marks
The schema is the design or blueprint of the database. It is decided when the database is created and is changed only when the requirements change (for example, when a new table or column is added), which happens rarely. The instance is the actual data, and day-to-day operations — insertions, deletions and updates — constantly change the data. Therefore the instance changes every moment while the schema stays stable.
-
What is a data dictionary (system catalog)? What information is stored in it?
Topic: Metadata & Data Dictionary • 5 marks marks
The data dictionary, also called the system catalog, is a special set of tables maintained by the DBMS itself that stores the metadata of the database. It stores: the names of tables (relations) and their columns; the data types and sizes of the columns; constraints (primary keys, foreign keys, checks); relationships among tables; views and indexes defined on the database; and information about users and their access privileges. The DBMS consults the data dictionary before accessing any data.
-
Differentiate between an active and a passive data dictionary.
Topic: Metadata & Data Dictionary • 3 marks marks
An active data dictionary is maintained and updated automatically by the DBMS itself whenever the database structure changes (for example, after a DDL statement), so it is always consistent with the actual database. A passive data dictionary is maintained separately, usually as documentation, and is updated manually by the staff after changes are made; therefore it may become inconsistent with the actual structure of the database.
-
What happens to the metadata when a CREATE TABLE statement is executed?
Topic: Metadata & Data Dictionary • 3 marks marks
CREATE TABLE is a DDL (Data Definition Language) statement. When it is executed, the DBMS records the metadata of the new table — its name, the names of its columns, their data types and sizes, and the constraints — in the data dictionary (system catalog). No actual user data is stored at this stage; later, when rows are inserted, the DBMS validates them against this stored metadata.
-
Write any five types of information that the data dictionary stores about a table.
Topic: Metadata & Data Dictionary • 3 marks marks
Any five of the following: (1) the table name; (2) the names of its columns/attributes; (3) the data type and length of each column; (4) primary key and foreign key constraints; (5) other integrity constraints such as NOT NULL, UNIQUE and CHECK; (6) the indexes defined on the table; (7) the owner of the table and the users authorized to access it.
-
Why is metadata important for a DBMS?
Topic: Metadata & Data Dictionary • 3 marks marks
Metadata is essential because the DBMS uses it to interpret and process all data operations: it validates inserted and updated data against the data types and constraints, enforces security by checking user privileges, plans query execution using table and index information, and provides data independence by keeping the description of the data separate from the application programs. Without metadata, the DBMS could not understand the structure of the stored data.
-
Differentiate between Data Administration (DA) and Database Administration (DBA).
Topic: Data Administration • 5 marks marks
1. Nature: DA is a management/policy-level function, while DBA is a technical function. 2. Scope: DA deals with the data of the entire organization, while DBA deals with a particular database and DBMS. 3. Duties: DA makes data policies, standards and data plans; DBA installs the DBMS, creates the database and manages security, backup/recovery and performance. 4. Concern: DA is concerned with what data the organization needs and how it should be shared; DBA is concerned with how the database is physically implemented and kept running.
-
Who is a Data Administrator? Describe his role in an organization.
Topic: Data Administration • 3 marks marks
The Data Administrator is the person responsible for the overall management of the data resources of an organization. His role is managerial rather than technical: he plans the organization's data, sets data policies and standards, resolves data ownership disputes between departments, and ensures that data is treated as a shared corporate asset. He works at a higher level than the DBA and coordinates between the top management and the technical database staff.
-
What is data planning? Why is it a responsibility of Data Administration?
Topic: Data Administration • 3 marks marks
Data planning is the process of identifying the data that an organization currently uses and will need in the future, and planning how this data will be collected, stored and shared. It is a responsibility of Data Administration because it is a long-term, organization-wide, policy-level activity: it concerns the information needs of the whole enterprise rather than the technical operation of any single database, which is the DBA's area.
-
Why is data regarded as a corporate asset, and how does Data Administration protect this asset?
Topic: Data Administration • 3 marks marks
Data is regarded as a corporate asset because the decisions and daily operations of the whole organization depend on it, it is costly to collect and maintain, and it is shared by many departments. Data Administration protects this asset by setting data standards and ownership rules, ensuring consistent definitions of data across the organization, controlling how data is shared, and making policies for data quality and security at the organizational level.
-
Define Database Administrator (DBA) and write any five responsibilities of a DBA.
Topic: DBA Role, Guidelines & DBMS Features • 5 marks marks
The Database Administrator (DBA) is the person responsible for the technical management and control of the database environment — installing and running the DBMS and ensuring that the database remains secure, available and efficient. Five responsibilities of a DBA: (1) Installing and upgrading the DBMS software. (2) Creating the database and implementing its schema. (3) Managing database security — creating user accounts and granting/revoking privileges. (4) Backup and recovery of the database. (5) Performance monitoring and tuning. (Other responsibilities include allocating storage space, enforcing standards and supporting the end users.)
-
Explain the role of the DBA in database security management.
Topic: DBA Role, Guidelines & DBMS Features • 3 marks marks
The DBA protects the database from unauthorized access. He creates user accounts with usernames and passwords, grants only the privileges each user actually needs (for example, SELECT or INSERT on specific tables) and revokes them when they are no longer required, creates views to restrict access to sensitive columns, and monitors/audits database access to detect any misuse.
-
What is backup and recovery? Why is it the responsibility of the DBA?
Topic: DBA Role, Guidelines & DBMS Features • 3 marks marks
Backup means making copies of the database at regular intervals; recovery means restoring the database to a consistent state from these backups (and the transaction log) after a failure such as a disk crash, power failure or user error. It is the DBA's responsibility because he manages the physical database environment, decides the backup schedule and strategy, and is accountable for the availability and safety of the organization's data.
-
What is performance tuning? Write any three activities a DBA performs for performance tuning.
Topic: DBA Role, Guidelines & DBMS Features • 3 marks marks
Performance tuning means monitoring the database and making changes so that queries and transactions run faster and system resources are used efficiently. Three activities of the DBA for performance tuning: (1) creating indexes on frequently searched columns; (2) allocating and adjusting storage space and memory (buffer cache) parameters; (3) analyzing and rewriting slow queries and reorganizing fragmented tables/files.
-
Write any five features/advantages of a DBMS over the traditional file-processing system.
Topic: DBA Role, Guidelines & DBMS Features • 5 marks marks
(1) Reduced data redundancy — data is stored centrally instead of being duplicated in separate files of each application. (2) Data consistency — a single updated copy of the data serves all applications. (3) Data sharing — many users and applications can use the same data at the same time. (4) Data security and integrity — authorization and constraints protect the data. (5) Backup and recovery facilities. (Other advantages include data independence, a standard query language (SQL), and controlled concurrent access.)
-
What is concurrency control? Why is it needed in a multi-user DBMS?
Topic: DBA Role, Guidelines & DBMS Features • 3 marks marks
Concurrency control is the DBMS mechanism that manages the simultaneous operations of multiple users/transactions on the same data so that they do not interfere with each other. It is needed because if two users update the same record at the same time without control, one update may be lost or the data may become inconsistent. Locking and transaction management keep the results correct, as if the transactions had run one by one.
-
What is an index in a database? Why are indexes created?
Topic: Indexes: Clustered & Non-Clustered • 3 marks marks
An index is a separate database structure built on one or more columns of a table that allows the DBMS to locate rows quickly — just like the index of a book helps in finding a topic without reading the whole book. Indexes are created to speed up data retrieval (SELECT queries and joins) on frequently searched columns. The trade-off is extra storage space and slightly slower INSERT, UPDATE and DELETE operations, because the index must also be maintained.
-
Differentiate between a clustered and a non-clustered index (any five differences).
Topic: Indexes: Clustered & Non-Clustered • 5 marks marks
1. A clustered index determines the physical order of the data rows in the table; a non-clustered index does not change the physical order of the rows. 2. Only one clustered index can exist on a table, while many non-clustered indexes can be created on the same table. 3. In a clustered index, the data itself is stored at the leaf level of the index; a non-clustered index is a separate structure that stores the key values together with pointers to the data rows. 4. A table without a clustered index is called a heap; creating a clustered index reorganizes the table's rows. 5. A clustered index is generally faster for range queries on the indexed column, because related rows are physically stored together.
-
Why can a table have only one clustered index but many non-clustered indexes?
Topic: Indexes: Clustered & Non-Clustered • 3 marks marks
A clustered index physically sorts and stores the data rows in the order of the index key. The rows of a table can be physically arranged in only one order at a time, so only one clustered index is possible. Non-clustered indexes are separate structures (key values plus pointers to the rows) that do not disturb the physical order of the rows, so many of them can be created on different columns of the same table.
-
What is a heap? What happens when a clustered index is created on a heap?
Topic: Indexes: Clustered & Non-Clustered • 3 marks marks
A heap is a table that has no clustered index; its data rows are stored in no particular order, so the DBMS usually has to scan the whole table to find the required rows. When a clustered index is created on a heap, the data rows are physically reorganized and stored in the order of the clustered index key, and the table is no longer a heap.
-
Write the syntax to create a non-clustered index named IX_Stud on the Name column of the Student table. How does its syntax differ from that of a clustered index?
Topic: Indexes: Clustered & Non-Clustered • 3 marks marks
Syntax: CREATE NONCLUSTERED INDEX IX_Stud ON Student (Name); The syntax differs from that of a clustered index only in the keyword: NONCLUSTERED is used instead of CLUSTERED; the rest of the syntax — index name, table name and column name — is exactly the same.