0% found this document useful (0 votes)
16 views

DBMS2

The document discusses differences between procedural and declarative DML, definitions of centralized databases and transaction management components, query processing diagrams, ACID principles, relational algebra queries, SQL queries, and database concepts including keys, schemas, and triggers.

Uploaded by

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

DBMS2

The document discusses differences between procedural and declarative DML, definitions of centralized databases and transaction management components, query processing diagrams, ACID principles, relational algebra queries, SQL queries, and database concepts including keys, schemas, and triggers.

Uploaded by

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

Chapter 1:

1-What is the fundamental difference between Procedural DML (Data


Manipulation Language) and Declarative DML?
A) Procedural DML requires the user to specify the steps of how data should be obtained
and processed, whereas Declarative DML specifies only what data is desired without
dictating how to obtain it.
B) Declarative DML does not allow the user to modify data in the database, but Procedural DML
supports such modifications.

C) Procedural DML is used only for adding data operations, while Declarative DML is used solely for
querying data.

D) Declarative DML requires specific algorithms to process data in the database, while Procedural
DML does not require any algorithms.

2-Which of the following best defines a Centralized Database?


A) A system where a single server machine executes work on behalf of multiple client machines.

B) A system with many core shared memory, shared disk, or shared nothing architectures.

C) A system that is geographically distributed and may involve schema/data heterogeneity.

D) A system that typically has one to a few cores and shared memory used to manage the
database.

3- In a database system architecture, the component responsible for enforcing


ACID properties to ensure data integrity and handling transactions is known
as:
A) Storage Manager

B) Query Processor

C) Transaction Management Component


D) Database Administrator
4- Below is the query processing diagram:

Which of the following pairs should be placed where there is a "?" sign?

A) 1- Parser and translator, 2-Query Engine

B) 1- Query Engine, 2- Optimization Engine

C) 1- Parser and translator, 2- Evaluation Engine


D) 1- Evaluation Engine, 2- Query Engine

5- Which statement correctly describes the difference between two-tier and


three-tier architectures?
A) Two-tier directly connects clients to the database, three-tier uses an intermediate
application server.
B) Three-tier allows direct database access, two-tier does not.

C) Two-tier includes an application server, three-tier does not.

D) Both have two layers; three-tier uses a complex network.

6- Which of the following options best defines the ACID principles in database
systems?
A) Allocation, Consistency, Isolation, Durability - essential for resource management.

B) Atomicity, Consistency, Isolation, Durability - essential for transaction reliability.


C) Accuracy, Concurrency, Isolation, Data-binding - essential for data integrity.

D) Authentication, Confidentiality, Integrity, Distribution - essential for security.


Chapter 2:
7-Consider the following relational algebra query:
X = π_department="Physics" (σ_salary > 90,000 (instructor))
Which of the following queries is equivalent to query X?
A) σ_department="Physics" ∧ salary > 90,000 (instructor)
B) σ_department="Physics" (σ_salary > 90,000 (instructor))

C) σ_department="Physics" (instructor) ∪ σ_salary > 90,000 (instructor)

D) σ_department="Physics" (instructor) ⨝ σ_salary > 90,000 (teaches)

8-

Using the given instructor and teaches tables, which relational algebra expression would you use to
find all instructors from the "Comp. Sci." department who taught in the Fall 2017 semester?

A) σ_dept_name="Comp. Sci." (instructor) ⨝ σ_semester="Fall" ∧ year=2017 (teaches)

B) σ_dept_name="Comp. Sci." ∧ semester="Fall" ∧ year=2017 (instructor ⨝ teaches)

C) π_name(σ_dept_name="Comp. Sci." (instructor)) ∪ π_name(σ_semester="Fall" ∧ year=2017


(teaches))

D) π_name(σ_dept_name="Comp. Sci." ∧ semester="Fall" ∧ year=2017 (instructor ⨝


teaches))

9- To combine the course offerings from two different years into a single list,
which relational algebra operator would you use, assuming the tables have
identical columns for course details?
A) Select (σ)

B) Project (Π)

C) Union (⋃) D) Cartesian product (×)


10- In the context of relational databases, which of the following statements
is true regarding keys?
a) A superkey is a set of attributes that can uniquely identify all tuples in any possible
relation.
b) A candidate key must contain additional attributes that are not strictly necessary to identify a tuple
uniquely.

c) A primary key can be a composite of all the attributes in the relation.

d) A foreign key constraint requires that the value in one relation must be different from the values in
another relation.

11- Which of the following establishes a top-to-bottom relationship among


the items?
a) Relational schema

b) Network schema

c) Hierarchical schema
d) All of the mentioned

12 -The logical design, and the snapshot of the data at a given instant in time
is known as?
a) Instance & Relation

b) Relation & Schema

c) Domain & Schema

d) Schema & Instance

Chapter 3 and chapter 5:


13. Why do database programmers need access to a general-purpose
programming language?
a) To create and manage databases

b) To express queries not possible in SQL


c) To enhance the security of the database

d) To increase the processing speed of the database


14. The Connection object is created by using __________ method of
DriverManager class. DriverManager is the factory for connection.
A. createConnection()

B. setConnection()

C. getConnection()
D. Connect()

15. Relational tables can include ___ primary keys.


a. Only 1
b. Only 2

c. More than 2

d. As many as you want

16. . Why the following statement is erroneous?


SELECT dept_name, ID, avg (salary)
FROM instructor
GROUP BY dept_name;

a) Dept_id should not be used in group by clause


b) Group by clause is not valid in this query

c) Avg(salary) should not be selected

d) None

17. SELECT * FROM employee WHERE dept_name="Comp Sci";


In the SQL given above there is an error . Identify the error.
a) Dept_name

b) Employee

c) “Comp Sci”
d) From
18. Which SQL table creation query contains an error?
A) CREATE TABLE department (

dept_name VARCHAR(20) PRIMARY KEY,

building VARCHAR(15),

budget DECIMAL(12, 2)

);

B) CREATE TABLE instructor (

ID VARCHAR(5),

name VARCHAR(20),

dept_name VARCHAR(20),

salary DECIMAL(8, 2),

PRIMARY KEY (ID),

FOREIGN KEY (dept_name) REFERENCES department(dept_name)

);

C) CREATE TABLE student (


ID VARCHAR(5) PRIMARY KEY,
name VARCHAR(20),
dept_name REFERENCES department(dept_name)
);
D) CREATE TABLE enrollment (

ID VARCHAR(5),

course_id VARCHAR(8),

PRIMARY KEY (ID, course_id),

FOREIGN KEY (ID) REFERENCES student(ID),

FOREIGN KEY (course_id) REFERENCES course(course_id)

);
19.The ________ clause is used to list the attributes desired in the result of a
query.
a) Where
b) Select
c) From
d) Distinct

20. Select * from employee where salary>10000 and dept_id=101;


Which of the following fields are displayed as output?
a) Salary, dept_id
b) Employee
c) Salary
d) All the field of employee relation

21. SELECT name


FROM instructor
WHERE salary <= 100000 AND salary >= 90000;
This query can be replaced by which of the following ?
a) SELECT name
FROM instructor WHERE salary BETWEEN 90000 AND 100000;

B) SELECT name
FROM employee
WHERE salary <= 90000 AND salary>=100000;
c) SELECT name
FROM employee
WHERE salary BETWEEN 90000 AND 100000;
d) SELECT name
FROM instructor
WHERE salary BETWEEN 100000 AND 90000;

22. CREATE TABLE employee (id INTEGER,name VARCHAR(20),salary NOT


NULL);
INSERT INTO employee VALUES (1005,Rach,0);
INSERT INTO employee VALUES (1007,Ross, );
INSERT INTO employee VALUES (1002,Joey,335);
Some of these insert statements will produce an error. Identify the statement.
a) Insert into employee values (1005,Rach,0);
b) Insert into employee values (1002,Joey,335);
c) Insert into employee values (1007,Ross, );
d) None of the mentioned

23. Which of the following should be used to find all the courses taught in the
Fall 2009 semester but not in the Spring 2010 semester .
a) SELECT DISTINCT course id
FROM SECTION
WHERE semester = ’Fall’ AND YEAR= 2009 AND
course id NOT IN (SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010);

b) SELECT DISTINCT course_id


FROM instructor
WHERE name NOT IN (’Fall’, ’Spring’);

c) (SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
d) SELECT COUNT (DISTINCT ID)
FROM takes
WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id, semester, YEAR
FROM teaches
WHERE teaches.ID= 10101);

24. DriverManager.getConnection(_______ , ______ , ______)


What are the two parameters that are included?
a) URL or machine name where server runs, Password, User ID
b) URL or machine name where server runs, User ID, Password
c) User ID, Password, URL or machine name where server runs
d) Password, URL or machine name where server runs, User ID

25. CREATE DOMAIN YearlySalary NUMERIC(8,2)


CONSTRAINT salary VALUE test __________;
In order to ensure that an instructor’s salary domain allows only values
greater than a specified value use:
a) Value>=30000.00
b) Not null;
c) Check(value >= 29000.00);
d) Check(value)

26. Delete from r where P;


The above command
a) Deletes a particular tuple from the relation
b) Deletes the relation
c) Clears all entries from the relation
d) All of the mentioned
27. Which of the following is used to insert a tuple from another relation?
a) INSERT INTO course (course id, title, dept name, credits)
VALUES (’CS-437’, ’DATABASE Systems’, ’Comp. Sci.’, 4);
b) INSERT INTO instructor
SELECT ID, name, dept name, 18000
FROM student
WHERE dept name = ’Music’ AND tot cred > 144;
c) INSERT INTO course VALUES (’CS-437’, ’DATABASE Systems’, ’Comp. Sci.’, 4);
d) Not possible

28. SELECT name


FROM instructor
WHERE salary IS NOT NULL;
Selects
a) Tuples with null value
b) Tuples with no null values
c) Tuples with any salary
d) All of the mentioned

29. The union operation automatically __________ unlike the select clause.
a) Adds tuples
b) Eliminates unique tuples
c) Adds common tuples
d) Eliminates duplicate
30. __________ is a special kind of a store procedure that executes in
response to certain action on the table like insertion, deletion or updation of
data.
a) Procedures
b) Triggers
c) Functions
d) None of the mentioned

31. The __________ function that does not create gaps in the ordering.
a) Intense_rank()
b) Continue_rank()
c) Default_rank()
d) Dense_rank()

Chapter 6:
32.What is the primary goal of the database design process?
A. To optimize data retrieval speed.
B. To minimize storage space usage.
C. To organize data in a way that meets the information needs of the organization.
D. To ensure the scalability of the database system.

33.Why is it essential to involve stakeholders in the initial stages of the


database design process?
A. To ensure a faster design process.
B. To gather requirements and understand the information needs.
C. To minimize the use of complex attributes.
D. To foster collaboration and gain diverse perspectives.
34.In the Entity-Relationship (ER) model, what does an entity represent?
A. A database table.
B. A unique instance of data.
C. A relationship between tables.
D. A collection of attributes.

35.What is the purpose of relationships in the ER model?


A. To represent data types.
B. To enforce data constraints
C. To define complex attributes.
D. To establish connections between entities.

36.Which of the following is an example of a complex attribute?


A. Age
B. Address
C. Phone Number
D. Date of Birth

37.How can complex attributes be represented in a relational database?


A. By creating separate tables for each complex attribute.
B. By incorporating them directly into the table as composite attributes.
C. By avoiding their use due to potential redundancy.
D. By using them as primary keys.

38.What does cardinality describe in the context of a relationship in the ER


model?
A. The complexity of attributes in an entity.
B. The number of instances of one entity that can be associated with another entity.
C. The primary key of an entity.
D. The naming conventions of attributes.

39.In a one-to-many (1:N) relationship, what does "many" signify?


A. The entity with multiple instances related to one instance of another entity.
B. The entity with a unique identifier.
C. The complexity of attributes.
D. The entity with the fewest instances.

40.What is the purpose of a primary key in a relational database?


A. To ensure referential integrity.
B To enforce data types.
C. To define complex attributes.
D. To uniquely identify each record in a table.

41.In the context of a primary key, what is referential integrity?


A. Ensuring the uniqueness of data values.
B. Maintaining consistency between related tables.
C. Defining relationships between entities.
D. Ensuring the accuracy of complex attributes.

42.What is an example of an extended E-R feature?


A. Subtypes and supertypes.
B. Composite attributes.
C. Mapping cardinalities.
D. Circular dependencies.
43.How does the Unified Modeling Language (UML) contribute to database
design?
A. By providing a standardized notation for visualizing and documenting system models.
B. By eliminating the need for primary keys.
C. By reducing the need for relationships between entities.
D. By automating the normalization process.

Chapter 8:
44. What is table inheritance in an object-relational database?
A)Creating tables that have a many-to-many relationship with other tables

B)Creating tables that have a hierarchical structure

D)Creating tables that have a one-to-one relationship with other tables

D)Creating tables that inherit attributes from other tables

45. Which data model's requirement of atomic data types may be considered
an overkill for storing complex data?
A. Hierarchical model

B. Relational model
C. Object-oriented model

D. Network model

46.In database systems, what does TF-IDF stand for?


A) Time-Frequency Inverse Data Function

B) Term Frequency-Inverse Document Frequency


C) Total Field-Index Data Formula

47. What is an object-relational mapping (ORM) system used for?


A. Mapping between programming language objects and database tuples
B. Mapping between programming language objects and JSON data
C. Mapping between programming language objects and RDF triples

D. Mapping between programming language objects and XML documents

48. What does JSON stand for?


A) Java Source Object Notation

B) JavaScript Object Notation


C) Java Serialized Object Network

49. What is an object-relational database?


A. A database that provides richer type system
B. A database that supports semi-structured data

C. A database that supports relational data

D. A database that supports object-oriented programming

50. What is the main purpose of RDF (Resource Description Format) in


databases?
- a) Data normalization

- b) Representation of facts and inference rules


- c) Structuring relational data

- d) Improving data security

51.What is a reference type in object-relational database?


A. A type that represents a reference to an object

B. A type that refers to another type


C. A type that represents a reference to a table

D. A type that represents a reference to a database


52.How can n-ary relationships be represented in RDF?
A) Using nested data types

B) Using artificial entities


C) Using arrays

D) Using quads with context entity

What is PageRank primarily used for in the context of databases?


A) Data normalization

B) Query optimization

C) Measuring the importance of web pages based on hyperlinks


D) Ensuring data integrity

Chapter 9:
53.Which component acts as the user interface in a database system,
providing forms, graphical user interfaces, and often web-based interfaces?
A) Backend

B) Middle layer

C) Front-end
D) Query language

54.What technology has become the de-facto standard user interface for
databases, allowing large numbers of users to access databases from
anywhere without the need for downloading/installing specialized code?
A)Web browsers
B) Flash

C) Java

D) Python
55.What mechanism is commonly used to address the connectionless nature
of the HTTP protocol, allowing servers to retain user authentication and other
information across multiple requests within a session?
A) Sessions

B) Tokens

C) Encryption

D) Cookies

56. What is a cookie in the context of web communication, and what purpose
does it serve in maintaining user-related information between a server and a
browser?
A) A small piece of cake exchanged between the server and the browser for user satisfaction.

B) A small piece of text containing identifying information exchanged between the server
and the browser.
C) A security feature to prevent unauthorized access.

D) A file stored on the server to enhance data storage capacity.

57. What does the Java Servlet specification define, and how does it facilitate
communication between the Web/application server and the application
program?
A) It defines methods for cooking and baking in a server environment.

B) It defines an API for communication between the server and a servlet, allowing handling of HTTP
requests and responses.

C) It specifies rules for naming variables in Java programs.

D) It defines a protocol for inter-server communication.


58. How does server-side scripting simplify the task of connecting a database
to the web, and what are examples of server-side scripting languages?
A) It involves embedding HTML forms directly into the server, eliminating the need for scripting
languages.

B) It requires users to manually input code/SQL queries in the HTML document for database
connection.

C) It involves defining an HTML document with embedded executable code/SQL queries,


where input values from HTML forms can be used directly.
D) It relies on client-side scripting languages like JavaScript for database connectivity.

59. What is the role of the "model" in the model-view-controller (MVC)


architecture for the presentation or user interface layer of an application?
A) It provides a high-level view of data and actions on data.

B) It presents data depending on the display device.

C) It receives events and executes actions.

D) It interfaces between the business logic layer and the underlying database.

60. Which layer in the application architecture provides the mapping from the
object model of the business logic layer to the relational model of the
database?
A) Presentation or user interface layer

B) Business-logic layer

C) Data access layer

D) Model-view-controller layer

You might also like