wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Prelim Exam - CC105 - Information Management (Database 2)

Total questions: 51

Worksheet time: 31mins

Name
Class
Date
1.

Scenario: You need to add a "MiddleName" column to an existing "Students" table. Which command is correct?

a)

UPDATE Students ADD COLUMN MiddleName VARCHAR(50);

b)

ALTER TABLE Students ADD COLUMN MiddleName VARCHAR(50);

c)

CREATE COLUMN MiddleName IN Students;

d)

INSERT INTO Students (MiddleName) VALUES ('VARCHAR');

2.

Evaluation: Which of the following best justifies the use of "Stored Procedures" in a PostgreSQL environment?

a)

To make the database structure harder to read.

b)

To encapsulate business logic and reduce network traffic between the app and the DB.

c)

To replace the need for the SELECT command.

d)

To store physical images, texts, numbers, and other important information inside the database.

3.

Synthesis: If a database designer chooses to use "Composite Keys," what are they essentially doing?

a)

Using a single auto-incrementing integer as a key.

b)

Using two or more columns together to uniquely identify a row.

c)

Avoiding the use of primary keys entirely.

d)

Linking the database to an external API.

4.

Evaluation: How does PostgreSQL handle "ACID" properties compared to basic NoSQL systems?

a)

PostgreSQL prioritizes performance over ACID.

b)

PostgreSQL guarantees strict ACID compliance for reliable transactions.

c)

NoSQL systems are generally more ACID compliant than PostgreSQL.

d)

ACID properties are only relevant to NoSQL.

5.

Synthesis: You are tasked with migrating a local database to a cloud-based PostgreSQL instance. What is the most critical first step in terms of security?

a)

Designing the tables.

b)

Configuring roles, permissions, and firewall settings.

c)

Writing SQL queries.

d)

Installing a GUI like pgAdmin.

6.

Evaluation: If a non-key attribute depends on another non-key attribute (Transitive Dependency), the table is failing which normal form?

a)

1NF

b)

b) 2NF

c)

3NF

d)

4NF

7.

Scenario: You need to add a "MiddleName" column to an existing "Students" table. Which command is correct?

a)

UPDATE Students ADD COLUMN MiddleName VARCHAR(50);

b)

ALTER TABLE Students ADD COLUMN MiddleName VARCHAR(50);

c)

CREATE COLUMN MiddleName IN Students;

d)

INSERT INTO Students (MiddleName) VALUES ('VARCHAR');

8.

Synthesis: A university database has a Students table and a Grades table. To see a student's name alongside their grade, what operation must be performed?

a)

UNION

b)

JOIN

c)

AGGREGATE

d)

INTERSECT

9.

Evaluation: In a database design, "Redundancy" is generally avoided. However, in what scenario might it be acceptable?

a)

When storage space is very expensive.

b)

To improve read performance in specific high-traffic analytical systems.

c)

When the developer is lazy.

d)

It is never acceptable under any circumstances.

10.

Synthesis: Design a query to find categories that have an average product price greater than $100.

a)

SELECT CategoryID FROM Products WHERE AVG(Price) > 100;

b)

SELECT CategoryID FROM Products GROUP BY CategoryID HAVING AVG(Price) > 100;

c)

SELECT CategoryID FROM Products GROUP BY CategoryID WHERE Price > 100;

d)

SELECT AVG(Price) FROM Products GROUP BY CategoryID;

11.

Evaluation: Why is using SELECT * considered bad practice in production applications?

a)

It is technically illegal in PostgreSQL.

b)

It can return unnecessary data, wasting bandwidth and memory.

c)

It prevents the database from using indexes.

d)

It automatically deletes data after fetching.

12.

Synthesis: You need to ensure that no "Order" can be created for a "ProductID" that doesn't exist. Which database concept enforces this?

a)

Entity Integrity (Primary Key)

b)

Referential Integrity (Foreign Keys)

c)

Data Atomicity

d)

Normalization

13.

Evaluation: What is the primary risk of "Denormalization"?

a)

It makes queries slower.

b)

It increases data redundancy and risk of data inconsistency.

c)

It makes the database schema too simple and elegant than normalization.

d)

It prevents the use of SQL.

14.

Synthesis: If you need to generate a report showing the total number of orders placed by each customer, which combination of SQL features is required?

a)

SELECT, WHERE, and SUM

b)

SELECT, COUNT, and GROUP BY

c)

SELECT, MAX, and ORDER BY

d)

INSERT and SELECT

15.

Evaluation: A table is in 1NF but has "Partial Functional Dependencies" (attributes depending on only part of a composite primary key). Which Normal Form should it be converted to next?

a)

2NF

b)

3NF

c)

BCNF

d)

4NF

16.

Synthesis: You are designing a database for a library. A "Book" can have multiple "Authors," and an "Author" can write multiple "Books." What is the best way to model this?

a)

Put a list of authors in a text column in the Book table.

b)

Put a list of books in a text column in the Author table.

c)

Create a third "Join Table" with foreign keys to both.

d)

Create a one-to-many relationship from Author to Book.

17.

Evaluation: When is a NoSQL database a better choice than a Relational database?

a)

When data is highly structured and requires strict consistency.

b)

When handling massive amounts of unstructured data with a need for horizontal scaling.

c)

When complex JOIN operations are the primary requirement.

d)

Always; NoSQL is the modern replacement for RDBMS.

18.

Analysis: What happens if you try to INSERT a NULL value into a column defined as NOT NULL?

a)

PostgreSQL converts it to an empty string.

b)

PostgreSQL throws an error and stops the insertion.

c)

PostgreSQL ignores the constraint.

d)

The value is inserted as 0.

19.

Application: Which query correctly calculates the average age of users in a "Users" table?

a)

SELECT AVG(age) FROM Users;

b)

SELECT SUM(age)/COUNT(age) FROM Users;

c)

Both a and b are logically correct.

d)

SELECT MEAN(age) FROM Users;

20.

Analysis: In a One-to-Many relationship between "Department" and "Employees," where does the Foreign Key usually reside?

a)

In the Department table.

b)

In the Employees table.

c)

In both tables.

d)

In a separate join table.

21.

Application: Which operator is used to search for a specific pattern in a column (e.g., names starting with 'A')?

a)

MATCH

b)

CONTAINS

c)

LIKE

d)

=

22.

Analysis: If a table has 10 rows and you run INSERT for 2 more rows but the transaction fails/rolls back, how many rows are in the table?

a)

12

b)

13

c)

10

d)

11

23.

10. Scenario: A user is connected to PostgreSQL via terminal and wants to list all available tables. Which command is used?

a)

\list

b)

 \dt

c)

\d

d)

SELECT * FROM tables;

24.

Application: Write the query to find the cheapest item in the "Inventory" table.

a)

SELECT MIN(price) FROM Inventory;

b)

SELECT SMALL(price) FROM Inventory;

c)

SELECT price FROM Inventory ORDER BY price DESC LIMIT 1;

d)

SELECT COUNT(price) FROM Inventory;

25.

Analysis: What is the main difference between DELETE and DROP?

a)

DELETE removes the table, DROP removes data.

b)

DELETE removes data, DROP removes the table structure.

c)

There is no difference.

d)

DELETE is DDL, DROP is DML.

26.

Scenario: To ensure no two employees have the same EmployeeID, which constraint should be applied during CREATE TABLE?

a)

NOT NULL

b)

DEFAULT

c)

PRIMARY KEY

d)

CHECK

27.

Application: You want to find the total revenue from a "Sales" table. Which function do you use?

a)

COUNT(price)

b)

MAX(price)

c)

SUM(price)

d)

AVG(price)

28.

Analysis: Which data type is most appropriate for a column storing exact currency values for an e-commerce site?

a)

REAL

b)

VARCHAR

c)

DECIMAL or NUMERIC

d)

INTEGER

29.

Scenario: You accidentally typed "Barger" instead of "Burger" in the product_name column. How do you fix this?

a)

INSERT INTO Food_Products (product_name) VALUES ('Burger');

b)

ALTER TABLE Food_Products SET product_name = 'Burger';

c)

RENAME 'Barger' TO 'Burger';

d)

UPDATE Food_Products SET product_name = 'Burger' WHERE product_name = 'Barger';

30.

Analysis: What will be the result of SELECT COUNT(*) FROM Products; if the table is empty?

a)

NULL

b)

0

c)

Error

d)

1

31.

Application: Which SQL statement removes all records for products with a price higher than 500?

a)

NULLDROP FROM Products WHERE price > 500;

b)

DELETE FROM Products WHERE price > 500;

c)

REMOVE FROM Products WHERE price > 500;

d)

ALTER TABLE Products DELETE price > 500;

32.

The process of organizing data in a database to reduce redundancy and improve data integrity.

(a)  

33.

A database type that stores data in tables consisting of rows and columns, linked by defined relationships.

(a)  

34.

The subset of SQL commands used for managing data within schema objects (e.g., INSERT, UPDATE).

(a)  

35.

A function that performs a calculation on a set of values and returns a single value (e.g., SUM, AVG).

(a)  

36.

An object, person, or concept about which data is stored in a database.

(a)  

37.

The subset of SQL commands used to define or modify the database structure (e.g., CREATE, ALTER).

(a)  

38.

The interactive terminal-based command-line interface used to manage and query PostgreSQL databases.

(a)  

39.

In data modeling, this represents a characteristic or property of an entity.

(a)  

40.

A type of database that provides a mechanism for storage and retrieval of data modeled in means other than the tabular relations used in relational databases.

(a)  

41.

A unique identifier for a record in a relational database table.

(a)  

42.

PostgreSQL is an open-source object-relational database management system.

a)

TRUE

b)

FALSE

43.

SELECT is the most commonly used DML command for retrieving data.

a)

TRUE

b)

FALSE

44.

PostgreSQL does not support custom data types.

a)

TRUE

b)

FALSE

45.

The ALTER command allows you to add or delete columns in an existing table.

a)

TRUE

b)

FALSE

46.

A database is essentially an organized collection of structured information or data.

a)

TRUE

b)

FALSE

47.

In a NoSQL database, data must always follow a rigid, predefined schema.

a)

TRUE

b)

FALSE

48.

A "Relationship" in data modeling defines how two entities are connected or associated.

a)

TRUE

b)

FALSE

49.

Aggregate functions like SUM() can be used on columns containing text data types.

a)

TRUE

b)

FALSE

50.

Normalization typically involves dividing large tables into smaller, related tables.

a)

TRUE

b)

FALSE

51.

The DROP command is used to remove specific rows from a table.

a)

TRUE

b)

FALSE