0% found this document useful (0 votes)
55 views28 pages

Database Management Systems Exam

The document is an exam on Database Management Systems, consisting of multiple-choice questions covering topics such as query processing, optimization techniques, relational algebra operations, and object-oriented programming principles. Each question includes options and explanations for the correct answers, focusing on key concepts and definitions relevant to database management. The exam tests knowledge on various algorithms, operations, and characteristics of database systems.

Uploaded by

eliasaraya142
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views28 pages

Database Management Systems Exam

The document is an exam on Database Management Systems, consisting of multiple-choice questions covering topics such as query processing, optimization techniques, relational algebra operations, and object-oriented programming principles. Each question includes options and explanations for the correct answers, focusing on key concepts and definitions relevant to database management. The exam tests knowledge on various algorithms, operations, and characteristics of database systems.

Uploaded by

eliasaraya142
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Database Management Systems Exam

Instructions: Choose the best answer for each of the following questions.

1. Which of the following is the initial stage in query processing?


a) Optimization
b) Execution
c) Parsing1 ...
d) Query Rewriting
Explanation: The first step in query processing is parsing the query into smaller components1
....
2. What is the primary goal of query optimisation within a DBMS?
a) To translate SQL into relational algebra3 ...
b) To ensure the accuracy of query results
c) To execute database queries efficiently1
d) To manage the physical storage of data
3. Following the parsing stage, into what is a SQL query typically translated for internal
processing?
a) Machine code
b) Relational algebra
c) Parse tree5
d) Object code

Explanation: After parsing, SQL queries are translated into expressions in relational algebra,
which is suitable for the system's internal representation4 .

4. The relational algebra operation that chooses specific attributes from a relation, discarding
others, is known as:
a) Selection6
b) Projection6 ...
c) Join6
d) Union6

Explanation: The Project operation in relational algebra selects certain attributes, which
corresponds to vertical partitioning of the relation7 .
5.What is another common term used to describe the Selection operation in relational algebra?
a) Vertical partitioning7 ...
b) Horizontal partitioning8 ...
c) Cartesian product
d) Renaming
10 11 Explanation: The Selection operation chooses a subset of tuples (rows), effectively
partitioning the table horizontally8 ....
6.
Which relational algebra operator combines related tuples from two different relations based on
a given condition? a) Projection7 b) Selection9 c) Join6 ... d) Intersection6 ... Explanation: A
Join operation combines tuples from two relations if and only if the specified join condition is
met12 .
7.
A Left Outer Join operation returns: a) Only the matching tuples from both relations b) Only
the tuples from the left relation c) Matching tuples and only the non-matching tuples from the
right relation d) All tuples from the left relation and the matching tuples from the right
relation, with NULLs for non-matches in the right relation's attributes14 Explanation: A
left outer join includes all tuples from the left relation (R) and the matching tuples from the right
relation (S). If there's no match in S, the attributes of S are filled with NULL14 .
8.
Which of the following is NOT typically considered a primary type of query optimizer
algorithm? a) Rule-Based Optimizers15 b) Cost-Based Optimizers15 ... c) Hybrid Optimizers15
... d) Data-Driven Optimizers
9.
What database characteristic can pose a challenge to effective query optimisation due to skewed
indices or inefficient join orders? a) Query complexity16 b) Non-uniform data distribution16
c) Frequent query load changes2 d) Outdated query syntax
10.
The heuristic optimisation technique of Predicate Pushdown aims to: a) Optimise the order in
which tables are joined17 ... b) Store the results of subqueries for reuse19 c) Apply selection
operations as early as possible in the query execution plan18 ... d) Choose the most effective
index for a query15 Explanation: Predicate pushdown involves moving selection (filter)
operations closer to the data source to reduce the volume of data processed in subsequent steps18
....
11.
In query optimisation, selectivity is best described as: a) The number of join operations in a
query b) The variety of data types used in a table c) The proportion of rows in a table that
satisfy a given condition21 ... d) The speed at which data can be read from disk
12.
Semantic query optimisation differs from other types primarily by: a) Its reliance on predefined
rules b) Its use of estimated execution costs c) Its use of knowledge about the data's meaning
and constraints23 ... d) Its focus on rewriting the query syntax
13.
The SQL query SELECT product_name FROM Products WHERE category =
'Electronics'; would typically be translated into relational algebra using which sequence
of operations? a) Only Projection b) Only Selection c) Selection followed by Projection25 ... d)
Projection followed by Selection Explanation: The WHERE clause corresponds to a Selection
(σ), and the SELECT product_name clause corresponds to a Projection (π). Selection is
usually performed before projection for efficiency25 ....
14.
Which basic algorithm for executing a join operation involves iterating through each row of the
outer table and, for each row, scanning all rows of the inner table to find matches? a) Sort-Merge
Join28 b) Hash Join28 c) Nested Loop Join28 ... d) Index Join
15.
For the Binary Search algorithm to be effectively used in query execution, what crucial
property must the data possess? a) It must be indexed30 b) It must be stored using hashing31 c)
It must be sorted32 d) It must reside entirely in memory
16.
What is the relational algebra equivalent of the SQL SELECT DISTINCT column_name
FROM table_name;? a) σ(column_name)(table_name) b) RENAME(table_name) c)
π(column_name)(table_name)33 d) table_name Explanation: The SELECT DISTINCT
clause in SQL is equivalent to the PROJECT operation (π) in relational algebra, which inherently
removes duplicate tuples33 .
17.
Which relational algebra operation includes all tuples that are present in either one or both of the
given relations? a) Intersection13 b) Minus34 c) Union6 ... d) Cartesian product10 Explanation:
The union operation (∪) combines all tuples from two relations, eliminating duplicates35 .
18.
The relational algebra operation that yields all pairs of tuples from two relations, regardless of
whether they have matching attribute values, is the: a) Natural Join12 b) Outer Join36 c)
Cartesian product10 d) Equi Join37 Explanation: The Cartesian product (X) combines every
row from one table with every row from another table10 .
19.
What is the purpose of the Rename operation in relational algebra? a) To modify the values of
attributes b) To select a subset of tuples c) To change the name of a relation or its attributes6
... d) To combine tuples from different relations
20.
An Equi Join is a type of join based on: a) Matching tuples on all common attribute names12 b)
Including all tuples from both relations, padding with NULLs37 ... c) A condition of equality
between specified attributes of the two relations37 d) The absence of common attributes
between the two relations
21.
Which type of outer join returns all tuples from the right relation and the matching tuples from
the left relation, padding with NULL if there's no match in the left relation? a) Left outer join14
b) Full outer join38 c) Right outer join38 d) Natural outer join
22.
A Full Outer Join combines the effects of which other join types? a) Natural join and Equi join
b) Cartesian product and Union c) Left outer join and Right outer join38 d) Inner join and
Cross join Explanation: A full outer join includes all rows from both tables. For rows where a
match is not found in the other table, NULL values are used38 .
23.
What is a significant drawback of using a Sequential Search algorithm for query execution on
large, unsorted tables? a) It requires the data to be indexed. b) It can only be used for equality
predicates. c) It involves examining every record in the table, leading to high I/O costs.32 ...
d) It cannot be used for complex search conditions.
24.
Indexing in databases primarily aims to improve the performance of: a) Data insertion
operations b) Data deletion operations c) Data retrieval operations30 d) Data update operations
Explanation: Indexes are data structures that allow the database engine to locate and retrieve
specific rows quickly without scanning the entire table30 .
25.
What type of data structure is commonly used to implement database indexes for efficient
searching? a) Linked lists b) Stacks c) Queues d) B-trees30
26.
Hashing as a query execution technique is particularly efficient for: a) Range-based queries b)
Sorted data retrieval c) Equality-based lookups31 d) Joins on multiple attributes
27.
In the context of join algorithms, what is a key advantage of using a Hash Join? a) It works
efficiently on already sorted data. b) It requires minimal memory overhead. c) It can be more
efficient than nested loop join for large tables when sufficient memory is available.40 d) It
does not require any pre-processing of the tables.
28.
The Merge Join algorithm for executing joins requires that the input tables are: a) Hashed on the
join keys b) Indexed on the join keys c) Sorted on the join keys28 ... d) Small enough to fit in
memory
29.
What are the two primary relational algebra operations involved in retrieving specific columns
and rows from a table based on certain conditions? a) Union and Intersection b) Join and
Cartesian product c) Projection and Selection25 ... d) Rename and Division
30.
Aggregation functions in SQL (e.g., COUNT, SUM, AVG) are used to: a) Filter rows based on
group properties b) Combine data from multiple tables c) Summarise data by performing
calculations on sets of values40 ... d) Modify existing data values
31.
In heuristic query optimisation, why is it generally beneficial to select before joins? a) It
increases the complexity of the query plan. b) It ensures that all possible combinations of rows
are considered. c) It reduces the number of rows that need to be processed by the join
operation.18 ... d) It requires the use of more complex join algorithms.
32.
The heuristic optimisation rule of "pushing selections and projections down" means
performing these operations: a) After all join operations have been completed b) Only on the
final result set c) As early as possible in the query execution plan20 d) In a specific order
determined by the query optimizer's cost model
33.
When a subquery is referenced multiple times within a larger query, which heuristic optimisation
technique might suggest computing and storing its result temporarily? a) Predicate Pushdown18
b) Join Order Optimization18 ... c) Materialization19 ... d) Index Selection
34.
In query optimisation, a predicate with high selectivity is one that: a) Returns a large fraction of
the rows in a table. b) Involves complex comparison operators. c) Returns a small fraction of
the rows in a table.21 ... d) Operates on non-indexed columns.
35.
Cost estimates in query optimisation are used to predict: a) The accuracy of the query results b)
The time it takes to parse the query c) The resources (e.g., CPU, I/O, memory) required to
execute a query plan22 ... d) The number of users currently accessing the database
36.
Factors considered in cost models for query optimisation often include: a) The colour of the
database server b) The brand of the operating system c) The size of tables, data distribution,
and index availability22 ... d) The number of developers who wrote the query
37.
If a query optimizer has to choose between using an index scan that is highly selective versus a
full table scan that might read fewer blocks initially, it will likely base its decision on: a) The
order in which the tables appear in the FROM clause. b) The complexity of the SQL syntax. c)
Cost estimates that consider the number of rows to process and the I/O costs.42 ... d)
Heuristic rules that always favour index scans.
38.
Semantic query optimisation can potentially remove a join operation if: a) The join condition is
based on non-key attributes. b) One of the tables involved is very large. c) Existing constraints
or business logic guarantee the same result without the join.23 ... d) The join attributes have
different data types.
39.
Identifying and eliminating unreachable data is a goal of semantic query optimisation that
relies on: a) The frequency with which the query is executed. b) The size of the intermediate
result sets. c) Understanding the semantic rules and constraints defined on the data.24 ... d)
Rewriting the query using different SQL keywords.
40.
The concept of functional dependency in databases can be leveraged by semantic query
optimisation to: a) Introduce redundant joins to improve parallelism. b) Increase the number of
subqueries to clarify the logic. c) Simplify query execution by avoiding redundant data
retrieval.24 ... d) Change the order of predicates in the WHERE clause.
41.
Which of the following is a key characteristic of object identity in object-oriented
programming? a) It is determined by the object's state or attributes. b) Two objects with the same
state are considered to have the same identity. c) Each object has a unique identity,
independent of its state.47 ... d) It is typically represented by the object's class name.
42.
In OOP, the structure of an object is defined by its: a) Behaviour and persistence. b) Type
hierarchy and inheritance. c) Attributes (data members) and methods (functions).48 d)
Encapsulation and polymorphism.
43.
Type constructors in OOP allow for: a) The execution of methods on objects. b) The definition
of object behaviour through methods. c) The creation of new data types based on existing
ones.49 d) The enforcement of data access restrictions.
44.
The principle of encapsulation in OOP involves: a) Defining relationships between classes in a
hierarchy. b) Allowing a subclass to inherit properties from a superclass. c) Bundling data
(attributes) and the methods that operate on that data into a single unit.49 ... d) Creating
objects as instances of classes with unique identities.
45.
Methods in OOP are best described as: a) Data members that store the state of an object. b)
Mechanisms for creating new data types. c) Procedures defined within a class that can
manipulate the object's state.50 d) Techniques for storing objects beyond program execution.
46.
Persistence in the context of OOP refers to: a) The ability of an object to maintain its identity
throughout its lifecycle. b) The structure of an object defined by its attributes and methods. c)
The capability of an object to exist beyond the execution of a program.50 d) The
relationships between different classes in a type hierarchy.
47.
Type hierarchies in OOP are used to represent: a) The structure and behaviour of individual
objects. b) The mechanisms for creating new object types. c) The relationships between
classes, often organised as a tree.51 d) The encapsulation of data and methods within objects.
48.
Inheritance in OOP promotes code reusability by allowing: a) Objects of different classes to be
treated uniformly. b) The hiding of an object's internal state from the outside. c) A new class to
acquire the properties and behaviours of an existing class.51 ... d) The creation of objects
with unique identities independent of their state.
49.
A subclass that inherits from only one superclass demonstrates: a) Multiple inheritance52 b)
Multilevel inheritance52 c) Single inheritance52 d) Hierarchical inheritance
50.
Which type of inheritance involves a subclass inheriting from a superclass that itself is a subclass
of another superclass? a) Single inheritance52 b) Multiple inheritance52 c) Multilevel
inheritance52 d) Hybrid inheritance
51.
The parsing step in query processing primarily involves: a) Determining the most efficient
execution plan.15 ... b) Executing the optimised query against the database.16 ... c) Breaking the
query down into smaller components and checking its syntax.1 ... d) Rewriting the query to
improve its performance.17
52.
Query rewriting is performed to: a) Translate the query into relational algebra.3 ... b) Verify the
existence of tables and columns.4 c) Modify the query structure to potentially enhance
performance.17 d) Return the results of the query to the user.16
53.
Choosing the most efficient way to retrieve the required data, such as using an index or a full
table scan, is part of which query optimisation technique? a) Join Order Optimization17 b) Query
Transformation15 c) Index Selection15 d) Access Path Selection17
54.
Determining the optimal sequence in which to join multiple tables is known as: a) Access Path
Selection17 b) Query Transformation15 c) Index Selection15 d) Join Order Optimization17
55.
Modifying a query to reduce overhead or improve parallelism falls under the query optimisation
technique of: a) Access Path Selection17 b) Query Transformation15 c) Index Selection15 d)
Join Order Optimization17
56.
Considering factors like data distribution and query frequency to select the most beneficial
indexes is the goal of: a) Access Path Selection17 b) Query Transformation15 c) Index
Selection15 d) Join Order Optimization17
57.
Query optimisers that rely on a predefined set of rules to generate execution plans are called: a)
Cost-Based Optimizers15 ... b) Hybrid Optimizers15 ... c) Rule-Based Optimizers15 d)
Semantic Optimizers
58.
Optimisers that use estimated execution costs to find the most efficient query plan typically
employ: a) Rule-Based approaches15 b) Hybrid strategies15 ... c) Cost-Based approaches15 ...
d) Heuristic methods
59.
Query optimisers that integrate both predefined rules and cost-based analysis are known as: a)
Rule-Based Optimizers15 b) Cost-Based Optimizers15 ... c) Hybrid Optimizers15 ... d)
Semantic Optimizers
60.
Queries with numerous joins and nested subqueries often present a significant complexity
challenge to: a) Query parsing1 ... b) Query execution16 ... c) Query optimisation16 d) Query
rewriting17
61.
Poor query performance due to skewed indices can be a consequence of: a) High query
complexity16 b) Non-uniform data distributions16 c) Frequent changes in query load2 d)
Using outdated statistics2
62.
Suboptimal query plans can arise if the information the optimiser uses to estimate costs is: a) Too
detailed and comprehensive b) Gathered too frequently c) Inaccurate or outdated statistics2 ...
d) Based on a wide range of factors
63.
The need for adaptive optimisation strategies is often driven by: a) Simple and predictable
query workloads b) Static and unchanging data distributions c) Frequent changes in query load
or data distribution2 d) The use of very efficient indexing techniques
64.
The overall process encompassing parsing, validating, optimising, and executing a query is
termed: a) Data retrieval b) Database administration c) Query Processing2 d) Transaction
management
65.
Before a query can be processed, a database system needs to: a) Store the query in a temporary
location b) Translate the query into an internal, understandable format3 c) Obtain exclusive
locks on the involved tables d) Back up the database
66.
While SQL is well-suited for human interaction, which is considered more suitable for the
internal representation of a query within a DBMS? a) XML b) JSON c) Relational algebra4 d)
Python
67.
The initial step of translating a user's SQL query into an internal form is performed by the: a)
Optimiser1 ... b) Executor1 ... c) Parser4 d) Rewriter17
68.
During parsing, the system checks the syntax of the query and verifies: a) The estimated
execution cost b) The physical storage location of the data c) The existence of relations, tuples,
and attributes4 ... d) The transaction isolation level
69.
The parser generates an initial tree-like structure of the query, known as a: a) Execution plan b)
Relational algebra expression c) Parse tree5 d) Query graph
70.
Views used in a query are typically replaced with their underlying definitions during: a) Query
optimisation17 b) Query execution16 c) Parsing and translation5 d) Result retrieval
71.
The Projection operation in relational algebra is analogous to which clause in SQL? a) WHERE
b) GROUP BY c) HAVING d) SELECT (with attribute lists)53
72.
What is a key characteristic of the result of a Projection operation? a) It always has the same
number of tuples as the original relation. b) It may contain attributes not present in the original
relation. c) It removes duplicate tuples.54 d) Its degree (number of attributes) is always greater
than or equal to the original relation.
73.
Which statement about the Projection operation is true? a) It is always commutative.54 b) It
performs horizontal partitioning.7 c) πAttribute List 1(πAttribute List2(R)) = πAttribute List
1 (R) if Attribute List 1 is a subset of Attribute List 2.33 d) It is denoted by the sigma (σ)
symbol.9 ...
74.
The Selection operation in relational algebra corresponds to which SQL clause? a) SELECT b)
FROM c) WHERE9 d) ORDER BY
75.
The condition specified in a Selection operation is a: a) List of attributes to be retrieved b)
Target relation for the operation c) Boolean expression that tuples must satisfy9 d) Renaming
specification for the resulting relation
76.
A Selection operation results in a relation with: a) A different set of attributes compared to the
original relation. b) More tuples than the original relation. c) A subset of the tuples from the
original relation.9 d) Attributes reordered compared to the original relation.
77.
Which relational algebra operation combines all tuples from two relations that have the same
number and type of attributes? a) Intersection13 b) Difference34 c) Union35 d) Cartesian
product10
78.
For the Union operation (R ∪ S) to be valid, relations R and S must have: a) The same number
of tuples b) At least one common attribute c) The attribute of the same number and
compatible data types in corresponding positions.35 d) Different schema
79.
The Intersection operation (R ∩ S) yields tuples that are: a) In R but not in S b) In S but not in
R c) In both R and S13 d) In either R or S (excluding duplicates)
80.
The Set Difference operation (R - S) results in a relation containing tuples that are: a) In both R
and S b) In either R or S c) In R but not in S34 d) In S but not in R
81.
The Cartesian Product of two relations R and S (R X S) produces a relation with: a) Only the
common attributes of R and S b) Only the attributes that are unique to either R or S c) All
attributes of R followed by all attributes of S10 d) Tuples that satisfy a specific join condition
82.
If relation R has m tuples and n attributes, and relation S has p tuples and q attributes, what is the
cardinality (number of tuples) and degree (number of attributes) of R X S? a) Cardinality: m+p,
Degree: n+q b) Cardinality: mp, Degree: max(n, q)c) **Cardinality: mp, Degree: n+q**10 d)
Cardinality: max(m, p), Degree: min(n, q)
83.
The relational algebra symbol for the Rename operation is: a) σ (sigma)9 ... b) π (pi)7 ... c) ∪
(union)35 d) ρ (rho)11
84.
A Natural Join (R ⋈ S) combines tuples based on: a) An explicitly specified join condition b)
All attributes that are present in only one of the relations c) Equality on all common attribute
names12 d) The order in which tuples appear in the relations
85.
Which of the following is a key difference between a Natural Join and an Equi Join? a) Natural
Join always includes all tuples from both relations. b) Equi Join does not use the equality
operator in its join condition. c) Natural Join implicitly joins on all common attributes, while
Equi Join uses an explicit equality condition.12 ... d) Equi Join always removes duplicate
columns resulting from the join.
86.
Outer Join operations are used primarily to: a) Improve the performance of join queries. b)
Simplify complex join conditions. c) Deal with missing information by including tuples even
when there is no match in the other relation.36 d) Restrict the number of tuples returned by a
join.
87.
In a Left Outer Join (R ⟕ S), if a tuple in R has no matching tuple in S, the result will contain:
a) Only the attributes of R. b) The attributes of R and the matching attributes of S. c) The
attributes of R and NULL values for the attributes of S.14 d) The tuple will be excluded from
the result.
88.
In a Right Outer Join (R ⟖ S), if a tuple in S has no matching tuple in R, the result will
contain: a) Only the attributes of S. b) The attributes of S and the matching attributes of R. c)
The attributes of S and NULL values for the attributes of R.38 d) The tuple will be excluded
from the result.
89.
An Equi Join uses which comparison operator in its join condition? a) > (greater than)55 b) <
(less than)55 c) != (not equal to)55 d) = (equal to)37
90.
Translating SQL queries into relational algebra helps in: a) Presenting the query results to the
user. b) Defining the physical storage structure of the data. c) Formalising the query semantics
for optimisation and execution.56 d) Specifying user access privileges.
91.
The SQL SELECT * FROM Employees WHERE DeptID = 101; is equivalent to which
relational algebra expression? a) π(Employees)(DeptID = 101) b) Employees ⋈ (DeptID = 101)
c) σ(DeptID = 101)(Employees)27 d) Employees - (DeptID != 101)
92.
The SQL SELECT EmpName FROM Employees; corresponds to the relational algebra
expression: a) σ(EmpName)(Employees) b) Employees c) π(EmpName)(Employees)27 d)
RENAME(EmpName)(Employees)
93.
The SQL SELECT EmpName, DeptName FROM Employees JOIN Departments
ON Employees.DeptID = Departments.DeptID; translates to: a)
σ(Employees.DeptID = Departments.DeptID)(π(EmpName, DeptName)(Employees X
Departments)) b) (Employees ∪ Departments) WHERE Employees.DeptID =
Departments.DeptID c) π(EmpName, DeptName)(Employees ⨝ Departments)57 d)
σ(EmpName, DeptName)(Employees ∩ Departments)
94.
The Sequential Search algorithm's time complexity in the worst case for a table with N rows is:
a) O(log N)32 b) O(1) c) O(N)39 d) O(N log N)
95.
The Binary Search algorithm's efficiency relies on the data being sorted, and its time
complexity is typically: a) O(N^2) b) O(N)32 c) O(log N)32 d) O(1)
96.
Creating an index on a frequently queried column can significantly speed up: a) INSERT
operations b) DELETE operations c) UPDATE operations on other columns d) SELECT
operations that filter on that column30 ...
97.
A hash index is particularly effective for queries involving: a) Range conditions (e.g., >, <) b)
Sorted output c) Equality conditions (e.g., =)31 d) Pattern matching (e.g., LIKE)
98.
In a Nested Loop Join, the number of comparisons made is proportional to: a) The sum of the
sizes of the two tables. b) The logarithm of the product of the sizes of the two tables. c) The
product of the sizes of the two tables.29 d) The size of the larger table.
99.
Projection as a basic query operation involves: a) Selecting a subset of rows based on a
condition.9 b) Combining data from multiple tables.12 c) Selecting a subset of columns from a
table.7 d) Summarising data using aggregate functions.40
100.
Semantic query optimisation often requires a deeper understanding of: a) The physical storage
details of the database. b) The network latency between the client and the server. c) The
meaning of the data and the constraints defined on it.23 ... d) The specific SQL dialect being
used.
I. Study Notes:

I will go through each chapter and extract the key concepts, definitions, and processes. The notes
will be structured to provide a quick overview of the essential information for exam preparation.

II. Multiple-Choice Questions (Exam Format):

For each chapter, I will create multiple-choice questions covering:

 Key Definitions: Understanding of terms like parsing, optimization, access path, object
identity, encapsulation, inheritance, etc.
 Processes and Steps: Sequence of query processing, steps in optimization, etc.
 Techniques and Algorithms: Access path selection methods, join order optimization, types
of optimizers, join algorithms, etc.
 Challenges and Considerations: Factors affecting query optimization (complexity, data
distribution, statistics, etc.).
 Object-Oriented Concepts: Identity, structure, type constructors, encapsulation,
persistence, type hierarchies, inheritance.
 Heuristic and Semantic Optimization: Understanding the principles and examples of these
techniques.

Each question will have:

 A clear and concise stem (the question itself).


 Four plausible options (A, B, C, D), with only one correct answer.
 A brief explanation of why the correct answer is right and why the incorrect options are
wrong.

Here is a sample of what the study notes and questions will look like (this is just a small
fraction of the requested 100 questions):

Short Study Notes (Sample):

Chapter 2: Query Processing and Optimization

 Query Processing: The sequence of steps to execute a database query: Parsing,


Optimization, Query Rewriting, Execution.
 Query Optimization: The process of selecting the most efficient way to execute a query.
 Query Optimization Techniques:
o Access Path Selection (index scan vs. full table scan)
o Join Order Optimization (order of joining tables)
o Query Transformation (rewriting for better performance)
o Index Selection (choosing the best index)
 Query Optimizer Algorithms:
o Rule-Based Optimizers (using predefined rules)
o Cost-Based Optimizers (using estimated execution costs)
o Hybrid Optimizers (combining both)
 Common Challenges in Query Optimization: Complexity, Data Distribution, Statistics,
Workload Variability.
 Parsing and Translation: SQL query to relational algebra expression.
 Relational Algebra Operations (Key): Selection (σ), Projection (π), Join (various types),
Union (∪), Intersection (∩), Difference (-), Cartesian Product (×), Rename (ρ).
 Basic Algorithms for Query Execution: Sequential Search, Binary Search, Indexing,
Hashing, Nested Loop Join, Sort-Merge Join, Hash Join.
 Heuristic Query Optimization: Using rules of thumb (e.g., Predicate Pushdown, Join Order
Optimization).
 Selectivity and Cost Estimates: Using statistics to estimate the cost of operations.
 Semantic Query Optimization: Using knowledge of data and constraints to optimize (e.g.,
Redundant Join Removal).

Chapter On: Overview of Object-Oriented Concepts...

 Object Identity: Each object has a unique identity, independent of its state.
 Object Structure: Objects have attributes (data) and methods (behavior).
 Type Constructors: Mechanisms to create new data types (Classes, Enumerations,
Abstract Data Types).
 Encapsulation: Bundling data and methods, restricting direct access.
 Persistence: Ability of an object to exist beyond program execution.
 Type Hierarchies: Relationships between classes (often a tree). Enables Polymorphism.
 Inheritance: Subclasses inherit properties and behaviors from super classes (Single,
Multiple, Multilevel). Promotes code reuse.
 Basic Algorithms (OOP Context - less directly covered but principles apply): Concepts
of searching collections of objects, indexing based on object attributes.
 Heuristic in Query Optimization (OOP Databases): Similar principles apply to optimizing
queries on object data.
 Selectivity and Cost Estimates (OOP Databases): Estimating costs of operations on
objects.
 Semantic Query Optimization (OOP Databases): Utilizing relationships and constraints
between objects.

Multiple-Choice Questions (Sample Exam Questions):


Chapter 2: Query Processing and Optimization

1. Which of the following is the first step in query processing within a DBMS?
A) Optimization
B) Execution
C) Parsing
D) Query Rewriting
Answer: C) Parsing
Explanation: The query processing steps are Parsing, Optimization, Query Rewriting, and
Execution. Parsing involves breaking down the SQL query into its components.
2. The process of choosing the most efficient way to retrieve data requested by a query
is known as:
A) Query Execution
B) Query Parsing
C) Query Optimization
D) Query Rewriting
Answer: C) Query Optimization
Explanation: Query optimization analyzes different execution strategies and selects the one
with the lowest estimated cost.
3. Choosing whether to use an index or perform a full table scan is an example of which
query optimization technique?
A) Join Order Optimization
B) Query Transformation
C) Index Selection
D) Access Path Selection
Answer: D) Access Path Selection
Explanation: Access path selection involves determining the most efficient method to
access the required data, including the choice between using indexes or scanning the entire
table.
4. Which type of query optimizer uses predefined rules to determine the optimal
execution plan?
A) Cost-Based Optimizer
B) Hybrid Optimizer
C) Rule-Based Optimizer
D) Semantic Optimizer
Answer: C) Rule-Based Optimizer
Explanation: Rule-based optimizers follow a set of heuristics to generate execution plans
without explicitly calculating costs.
5. Non-uniform data distributions can pose a challenge to query optimization primarily
due to:
A) Increased parsing time
B) Difficulty in estimating execution costs accurately
C) Limitations in query rewriting techniques
D) Higher memory requirements during execution
Answer: B) Difficulty in estimating execution costs accurately
Explanation: Skewed data can lead to inaccurate cost estimations for different execution
plans, potentially resulting in suboptimal choices.
6. Translating an SQL query into a relational algebra expression occurs during which
stage of query processing?
A) Optimization
B) Execution
C) Parsing and Translation
D) Query Rewriting
Answer: C) Parsing and Translation
Explanation: During parsing, the SQL query is checked for syntax, and then it is translated
into an internal representation, often relational algebra.
7. Which relational algebra operation selects a subset of tuples based on a given
condition?
A) Projection (π)
B) Selection (σ)
C) Join ( )
D) Union (∪)
Answer: B) Selection (σ)
Explanation: The selection operator (sigma) filters rows from a relation that satisfy a
specified predicate.
8. A nested loop join algorithm works by:
A) Creating a hash table of one relation.
B) Sorting both relations and then merging them.
C) Iterating through each row of the outer table and, for each row, scanning the entire inner
table.
D) Dividing the relations into smaller partitions and joining them independently.
Answer: C) Iterating through each row of the outer table and, for each row, scanning the
entire inner table.
Explanation: Nested loop join is a basic join algorithm where the inner loop iterates through
the second table for each row in the first table.
9. Moving a WHERE clause closer to the table access in the execution plan is an
example of which heuristic optimization?
A) Join Ordering
B) Materialization
C) Predicate Pushdown
D) Index Selection
Answer: C) Predicate Pushdown
Explanation: Predicate pushdown aims to filter data as early as possible to reduce the
amount of data processed in subsequent operations like joins.
10. Estimating the fraction of rows returned by a predicate is known as:
A) Cost Analysis
B) Selectivity Calculation
C) Performance Tuning
D) Resource Allocation
Answer: B) Selectivity Calculation
Explanation: Selectivity quantifies how restrictive a predicate is, helping the optimizer
estimate the size of intermediate results.

Chapter On: Overview of Object-Oriented Concepts...

1. In Object-Oriented Programming, what distinguishes one object instance from


another, even if they have the same attribute values?
A) Object State
B) Object Class
C) Object Identity
D) Object Behavior
Answer: C) Object Identity
Explanation: Object identity ensures that each object is a unique entity in memory,
regardless of its current state.
2. The bundling of an object's data (attributes) and the methods that operate on that data
is known as:
A) Polymorphism
B) Inheritance
C) Encapsulation
D) Abstraction
Answer: C) Encapsulation
Explanation: Encapsulation hides the internal implementation details of an object and
provides controlled access through its methods.
3. Which of the following is a mechanism for creating new data types based on existing
ones in OOP?
A) Method Overriding
B) Type Constructor
C) Dynamic Binding
D) Message Passing
Answer: B) Type Constructor
Explanation: Type constructors like Classes and Enumerations allow developers to define
new, complex data types.
4. The ability of an object to persist beyond the execution of the program is referred to
as:
A) Serialization
B) Deserialization
C) Persistence
D) Instantiation
Answer: C) Persistence
Explanation: Persistence allows objects to be stored and retrieved later, maintaining their
state.
5. A hierarchical organization of classes where a subclass inherits properties and
behaviors from a superclass is called:
A) Polymorphism
B) Encapsulation
C) Type Hierarchy
D) Abstraction
Answer: C) Type Hierarchy
Explanation: Type hierarchies represent the "is-a" relationships between classes, often
visualized as a tree structure.
6. The mechanism by which a new class acquires the properties and methods of an
existing class is known as:
A) Polymorphism
B) Inheritance
C) Encapsulation
D) Instantiation
Answer: B) Inheritance
Explanation: Inheritance promotes code reuse and allows for the creation of specialized
classes based on more general ones.
7. In which type of inheritance does a subclass inherit from multiple superclasses?
A) Single Inheritance
B) Multilevel Inheritance
C) Multiple Inheritance
D) Hierarchical Inheritance
Answer: C) Multiple Inheritance
Explanation: Multiple inheritance allows a class to inherit features from more than one direct
parent class.
8. The ability of a method to operate on objects of different classes that share a common
parent class is known as:
A) Inheritance
B) Encapsulation
C) Polymorphism
D) Abstraction
Answer: C) Polymorphism
Explanation: Polymorphism allows objects of different classes to respond to the same
method call in their own specific way.
9. Storing an object's state in a file or database for later retrieval is known as:
A) Instantiation
B) Polymorphism
C) Serialization
D) Encapsulation
Answer: C) Serialization
Explanation: Serialization is the process of converting an object's state into a format that
can be stored or transmitted.
10. Reconstructing an object from its stored state is called:
A) Instantiation
B) Inheritance
C) Deserialization
D) Abstraction
Answer: C) Deserialization
Explanation: Deserialization is the reverse process of serialization, where a stored
representation of an object is used to recreate the object in memory.

Chapter 2: Query Processing and Optimization

1. Which phase of query processing focuses on breaking down the SQL query into tables,
columns, and conditions?
A) Optimization
B) Execution
C) Parsing
D) Rewriting
Answer: C) Parsing
Explanation: Parsing is the initial step of analyzing the query syntax and structure.
2. Which component of a DBMS is responsible for finding the most efficient execution strategy
for a given SQL query?
A) Query Executor
B) Query Parser
C) Query Optimizer
D) Transaction Manager
Answer: C) Query Optimizer
Explanation: The query optimizer's sole purpose is to minimize resource consumption and
execution time.
3. Why is query optimization a crucial aspect of database management systems?
A) Ensures data integrity
B) Enhances network security
C) Guarantees efficient query execution
D) Simplifies data modeling
Answer: C) Guarantees efficient query execution
Explanation: Without optimization, queries could take excessively long or consume
excessive resources.
4. Which of the following is NOT typically considered a technique used in query optimization?
A) Access Path Selection
B) Data Compression
C) Join Order Optimization
D) Query Transformation
Answer: B) Data Compression
Explanation: Data compression is a storage and bandwidth optimization technique, not a
direct query optimization technique.
5. When a query is rewritten to improve performance by reordering joins or removing
unnecessary operations, which step is being performed?
A) Query Parsing
B) Query Optimization
C) Query Rewriting
D) Query Execution
Answer: C) Query Rewriting
Explanation: Query rewriting aims to transform the query into an equivalent, but more
efficient, form.
6. What factors are considered when determining the optimal order in which to join tables?
A) The physical location of the tables
B) Only the size of the tables
C) Data distribution and indexing
D) Table creation dates
Answer: C) Data distribution and indexing
Explanation: Data distribution affects join performance, and indexing helps speed up data
retrieval during joins.
7. Which type of query optimizer relies on pre-defined rules for execution plan generation?
A) Cost-Based Optimizer
B) Heuristic Optimizer
C) Rule-Based Optimizer
D) Semantic Optimizer
Answer: C) Rule-Based Optimizer
Explanation: Rule-based optimizers follow predetermined strategies regardless of the
specific data characteristics.
8. What is a primary advantage of using cost-based query optimizers?
A) They are simpler to implement than rule-based optimizers.
B) They adapt to specific data and system characteristics.
C) They guarantee optimal execution plans in all cases.
D) They don't require database statistics.
Answer: B) They adapt to specific data and system characteristics.
Explanation: Cost-based optimizers leverage statistics to estimate costs and choose plans
tailored to the current database state.
9. Why can inaccurate or outdated statistics lead to suboptimal query plans?
A) The query optimizer might choose the wrong index.
B) They cause syntax errors during parsing.
C) They can't impact query performance.
D) They lead to incorrect data.
Answer: A) The query optimizer might choose the wrong index.
Explanation: Inaccurate statistics skew the cost estimates, causing the optimizer to make
poor decisions about index usage, join orders, etc.
10. Which of the following scenarios highlights the importance of access path selection?
A) Deciding the order in which to join multiple tables.
B) Choosing between an index scan and a full table scan.
C) Rewriting a complex query into simpler subqueries.
D) Applying security policies to sensitive data.
Answer: B) Choosing between an index scan and a full table scan.
Explanation: Access path selection directly affects how the DBMS retrieves the required
data from the storage.
11. Which relational algebra operation is used to select certain attributes from a relation,
discarding the rest?
A) Selection
B) Projection
C) Join
D) Union
Answer: B) Projection
Explanation: Projection removes columns, while selection removes rows.
12. What is the primary goal of the "predicate pushdown" optimization technique?
A) To reduce the size of intermediate results.
B) To minimize network traffic.
C) To improve data compression ratios.
D) To maximize CPU cache utilization.
Answer: A) To reduce the size of intermediate results.
Explanation: Filtering early reduces the amount of data processed by subsequent
operations.
13. In terms of query optimization, what does "selectivity" refer to?
A) The complexity of the query.
B) The number of users who can access the data.
C) The fraction of rows returned by a predicate.
D) The speed of the network connection.
Answer: C) The fraction of rows returned by a predicate.
Explanation: Selectivity is a measure of how restrictive a condition is, influencing the size of
result sets.
14. What is the purpose of semantic query optimization?
A) To reduce parsing time.
B) To enhance network security.
C) To rewrite queries based on knowledge of data and constraints.
D) To improve code reusability.
Answer: C) To rewrite queries based on knowledge of data and constraints.
Explanation: Semantic optimization uses database metadata and domain knowledge to
transform queries.
15. Which algorithm is most suitable for joining large tables when one table fits in memory?
A) Nested Loop Join
B) Sort-Merge Join
C) Hash Join
D) Cartesian Product
Answer: C) Hash Join
Explanation: Hash Join efficiently joins tables when at least one table is relatively small and
can fit in memory, making it useful in this context.

Chapter On: Object-Oriented Concepts

1. What is the key characteristic that distinguishes objects in OOP, even if they possess
identical states?
A) Class Membership
B) Attribute Values
C) Object Identity
D) Method Implementation
Answer: C) Object Identity
Explanation: Object identity guarantees each object is a distinct instance.
2. Which term best describes the bundling of data (attributes) and methods (operations) that
work on that data within a class?
A) Inheritance
B) Polymorphism
C) Encapsulation
D) Abstraction
Answer: C) Encapsulation
Explanation: Encapsulation provides data hiding and controls access to the object's internal
state.
3. What is a common purpose of a Type Constructor in OOP?
A) To define inheritance relationships.
B) To create new data types.
C) To manage object persistence.
D) To enforce data integrity.
Answer: B) To create new data types.
Explanation: Type constructors (e.g., Classes) define the structure and behavior of new
object types.
4. Which concept allows an object to maintain its state and data beyond the execution of the
program?
A) Polymorphism
B) Inheritance
C) Persistence
D) Encapsulation
Answer: C) Persistence
Explanation: Persistence ensures that object data survives program termination.
5. What is achieved through serialization and deserialization?
A) Dynamic method dispatch
B) Creation of new objects
C) Object persistence
D) Data validation
Answer: C) Object persistence
Explanation: Serialization converts objects to a storable format, and deserialization
reconstructs them.
6. Which OOP feature allows a new class to inherit properties and behaviors from an existing
class?
A) Polymorphism
B) Encapsulation
C) Inheritance
D) Abstraction
Answer: B) Inheritance
Explanation: Inheritance is a mechanism for code reuse and establishing "is-a"
relationships.
7. A class that inherits from multiple superclasses is exhibiting what type of inheritance?
A) Single Inheritance
B) Multilevel Inheritance
C) Hierarchical Inheritance
D) Multiple Inheritance
Answer: D) Multiple Inheritance
Explanation: Multiple inheritance enables a class to combine features from several parent
classes.
8. What is a superclass also known as?
A) Derived Class
B) Child Class
C) Base Class
D) Abstract Class
Answer: C) Base Class
Explanation: A base class provides the foundation for other classes to inherit from.
9. Which of these does polymorphism enable?
A) Data hiding within an object
B) Creating a single interface for multiple data types
C) Enforcing strict data types
D) Preventing unauthorized data access
Answer: B) Creating a single interface for multiple data types
Explanation: Polymorphism means "many forms" and allows objects of different classes to
respond to the same method call appropriately.
10. Which of the following primarily promotes code reusability?
A) Encapsulation
B) Polymorphism
C) Inheritance
D) Abstraction
Answer: C) Inheritance
Explanation: Inheritance minimizes code duplication by allowing new classes to inherit
functionality.
11. If class 'Dog' inherits from class 'Animal', what relationship is established?
A) A "has-a" relationship
B) A "uses-a" relationship
C) An "is-a" relationship
D) A "part-of" relationship
Answer: C) An "is-a" relationship
Explanation: Inheritance represents an "is-a" relationship (Dog is an Animal).
12. What is method overriding?
A) Hiding the implementation details of a method.
B) Providing a new implementation of an inherited method in a subclass.
C) Combining two methods into one.
D) Preventing a method from being called.
Answer: B) Providing a new implementation of an inherited method in a subclass.
Explanation: Overriding allows a subclass to customize the behavior of an inherited method.
13. What does a class represent in an object-oriented paradigm?
A) An instance of an object.
B) A blueprint for creating objects.
C) A data structure.
D) A program.
Answer: B) A blueprint for creating objects.
Explanation: A class defines the structure and behavior of objects.
14. The main purpose of data abstraction is:
A) To increase code complexity.
B) To hide unnecessary implementation details.
C) To expose data publicly.
D) To speed up data access.
Answer: B) To hide unnecessary implementation details.
Explanation: Abstraction simplifies interaction with objects by showing only necessary
information.
15. What is an abstract data type (ADT)?
A) Data that cannot be changed.
B) Encapsulating data and operations together.
C) A type that is used only for inheritance.
D) A visual representation of data.
Answer: B) Encapsulating data and operations together.
Explanation: ADTs encapsulate data and the operations that can be performed on that data.
16. Which of the following is an example of a type constructor?
A) A method in a class.
B) An attribute of an object.
C) A class definition.
D) A variable declaration.
Answer: C) A class definition.
Explanation: Class definition specifies the structure and behavior of objects.
17. Why is encapsulation useful in object-oriented programming?
A) It makes code harder to understand.
B) It directly speeds up program execution.
C) It reduces complexity and increases code robustness.
D) It is only for code optimization.
Answer: C) It reduces complexity and increases code robustness.
Explanation: Encapsulation minimizes code dependencies and promotes modularity.
18. Which statement about data persistence is generally true?
A) Data persistence is automatic in all programming languages.
B) Persistence is mainly used for temporary data storage.
C) Persistence is achieved through techniques like serialization to files or databases.
D) Persistence only applies to simple data types.
Answer: C) Persistence is achieved through techniques like serialization to files or
databases.
Explanation: Serializing allows complex objects to stored and retrieved later.
19. Which type of inheritance is shown when a class inherits from another class, which in turn
inherits from another base class?
A) Single Inheritance
B) Multiple Inheritance
C) Multilevel Inheritance
D) Hierarchical Inheritance
Answer: C) Multilevel Inheritance
20. What is the main benefits of code reuse in OOP ?
A) Reduce development time,
B) Reduce code complexity,
C) Reduced number of bugs
D) All of the above
Answer: D) All of the above
21. What does 'Is-A' refer to in OOP?
A) Inheritance
B) Polymorphism
C) Data Hiding
D) Abstraction

Answer: A) Inheritance
22. True or False:
In OOP, object identity is crucial in distinguishing between object instances in memory
A) True
B) False
Answer: A) True
23. Which of the following is NOT a characteristic of object-oriented programming?
A) Encapsulation
B) Inheritance
C) Polymorphism
D) Procedural programming
Answer: D) Procedural programming
24. Which of the following is an example of an ADT?
A) class
B) Abstract Data Types
C) Classes:
D) Enumerations
Answer: B) Abstract Data Types
25. What are Type Constructors?
A) Type constructors are mechanisms that allow the creation of new data types based on
existing ones.
B) Common types of constructors include:
C) Both A and B
D) None of these
Answer: C) Both A and B

Combined Questions:

1. Which of the following query optimization techniques is most closely related to the OOP
principle of encapsulation?
A) Predicate Pushdown
B) View Materialization
C) Data Abstraction
D) Using indices
Answer: C) Data Abstraction
Explanation: Data abstraction, allows optimization without needing to be coupled directly to
physical attributes of data.
2. How might inheritance be used to implement different access path strategies in a DBMS?
A) Base classes provide methods for general data access, while subclasses provide
optimized methods based on index types.
B) Super classes could implement only Rule-Based Optimizers, while Subclasses implement
Cost-Based Optimizers
C) With different algorithms in other parts of program
D)None
Answer: A) Base classes provide methods for general data access, while subclasses
provide optimized methods based on index types.
3. How does semantic knowledge of object relationships within an object database affect query
rewriting possibilities?
A) Not to have to create complex queries
B) It allows redundant join eliminations due to functional dependecies
C) To create new queries
D) Only use the available indexes
Answer: B) It allows redundant join eliminations due to functional dependecies
4. What's the best method to retrieve specific data from various indexes within a big memory?
A)Index-Based Access
B)Hash Join
C) Sequential Join
D) None
Answer: A)Index-Based Access
5. How Inheritance enables developers?
A) create more specialized subclasses that extend or override behaviors of the parent class
B) creates Polymorphism
C) None
D) Both A and B
Answer: D) Both A and B

46.Which part of processing are SQL translated?


A) Parsing and translation
B)Evaluation
C) Query rewriting
D) Execution
Answer: A) Parsing and translation

1. Which type of Query Optimization, Utilizes equivalent expressions to alter the form of the
SQL query without changing its result but improving execution efficiency?
A) Data Distribution Knowledge
B) Use of Integrity Constraints
C)Rewriting Queries:
D) View Replacement
Answer: C)Rewriting Queries:
2. Which of these statements is correct ?
A) The degree (number of attributes) of resulting relation from a Selection operation is same
as the degree of
the Relation given.
B) The cardinality (number of tuples) of resulting relation from a Selection operation is,
0 <= σc (R) <= |R|
C) Both A and B
D) None
Answer: C) Both A and B
3. True/False: Nested Loop Join: Go through each row of the first table and for each row,
search the second table.
A) True
B) False
Answer: A) True
4. What is a cost estimate:
A) Determine the estimated resource usage for different operations (CPU, I/O, memory).
B) Use information about the size of tables, distribution of data, and index availability.
C) Borth A and B
D) None
Answer: C) Borth A and B
Multiple Choice Questions on Relational Algebra
Operations
1. Which of the following symbol is used to denote the project operation in
relational algebra?

a. PI
b. Dollar
c. Omega
d. Sigma

Answer: a
Explanation:
The projection operation is denoted by a Greek capital letter PI and the attributes to be
retrieved appear as subscripts separated by commas and relation name are given in
parenthesis following the PI.

2. Which of the following is not a Traditional relational algebra operator?

a. UNION
b. Difference
c. Join
d. Intersection

Answer: c
Explanation:
Join is a special algebra operation.

3. The relational Algebra is which type of query language.

a. Procedural
b. Logical
c. Relational
d. Semantically

Answer: a
Explanation:
Relational Algebra is a procedural type of language.

4. The union, intersection and difference operations are


a. Ternary operations
b. Unary operations
c. Binary operations
d. Quartile operations

Answer: c
Explanation:
The union, intersection and difference operations are binary operations.

5. Which operation is knows as restriction operation in relational algebra?

a. Division operation
b. Projection operation
c. Join operation
d. Select operation

Answer: d
Explanation:
The selection operation also known as restriction operation results in a new relation that
contains only those rows of relation that satisfy a specified condition.

You might also like