PostgreSQL Database Quiz Questions

Course Name:PostgreSQL
Chapter Name:Chapter 2 - Introduction to Software Applications
Lesson Content Link:Database Components
Current Quiz Count:30
Progress
0%
Q1
True / False

PostgreSQL uses tablespaces to define the physical location of database files on disk.

Q2
True / False

In PostgreSQL, a schema is a logical container for database objects like tables and views

Q3
True / False

database cluster in PostgreSQL refers to a collection of databases managed by a single server instance.

Q4
True / False

PostgreSQL uses "roles" to manage permissions and authentication for users and groups.

Q5
True / False

In PostgreSQL, a table can have multiple indexes, but an index can only be associated with one table.

Q6
True / False

PostgreSQL's "pg_catalog" schema contains the system catalog tables and views that store metadata about the database.

Q7
True / False

PostgreSQL supports Foreign Data Wrappers (FDWs) to access and query data from external data sources as if they were part of the PostgreSQL database.

Q8
True / False

PostgreSQL's Write-Ahead Logging (WAL) feature is used to ensure data integrity by logging changes before they are applied to the database.

Q9
True / False

PostgreSQL uses MVCC (Multi-Version Concurrency Control) to handle concurrent transactions and maintain consistency.

Q10
True / False

In PostgreSQL, a TOAST table is used to store large data values that do not fit in the standard table storage area.

Q11
Single Choice

Which of the following is a primary component of MySQL responsible for storing database schema definitions and metadata?

Q12
Single Choice

Which MySQL component handles the interpretation and execution of SQL queries?

Q13
Single Choice

What is the role of the MySQL Storage Engine in database components?

Q14
Single Choice

Consider the following SQL statement:

SQL Code
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'sales_db';
What does the above query return?
Q15
Single Choice

Which MySQL storage engine provides transaction support and foreign key constraints?

Q16
Single Choice

In MySQL, which component is responsible for managing communication between the database server and clients?

Q17
Single Choice

Given the following query:

SQL Code
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'company_db';
What will this query return?
Q18
Single Choice

Which MySQL component optimizes query performance by storing frequently accessed data in memory?

Q19
Single Choice

How does the MySQL Query Optimizer contribute to query execution?

Q20
Single Choice

Consider the following MySQL components: Information Schema, Query Processor, Storage Engine, and Query Cache. Which of the following components interact most directly when executing a SELECT statement?

Q21
Multiple Choice

Which of the following SQL queries creates a table representing a fundamental database component in PostgreSQL?

SQL Code
CREATE TABLE users (
 user_id SERIAL PRIMARY KEY,
 username VARCHAR(50) NOT NULL,
 email VARCHAR(100) UNIQUE NOT NULL,
 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Q22
Multiple Choice

Identify the PostgreSQL command that correctly sets up a relationship between two database components.

SQL Code
ALTER TABLE orders
ADD CONSTRAINT fk_user
FOREIGN KEY (user_id)
REFERENCES users(user_id);
Q23
Multiple Choice

Which SQL query correctly indexes a column to improve the performance of searches within a database component?

SQL Code
CREATE INDEX idx_email
ON users(email);
Q24
Multiple Choice

Choose the correct SQL command that modifies a database component by adding a new column for storing additional data.

SQL Code
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP;
Q25
Multiple Choice

Which PostgreSQL statement removes a database component that is no longer needed in the application?

SQL Code
DROP TABLE logs;
Q26
Multiple Choice

Identify the correct SQL query that creates a new database component for logging error messages.

SQL Code
CREATE TABLE error_logs (
 error_id SERIAL PRIMARY KEY,
 error_message TEXT NOT NULL,
 error_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Q27
Multiple Choice

Which SQL command correctly updates a record in a fundamental database component?

SQL Code
UPDATE users
SET email = 'new_email@example.com'
WHERE user_id = 1;
Q28
Multiple Choice

Select the correct SQL query that retrieves information about database components related to user data.

SQL Code
SELECT username, email
FROM users
WHERE created_at > '2024-01-01';
Q29
Multiple Choice

Which PostgreSQL statement correctly handles a transaction involving multiple database components?

SQL Code
BEGIN;
INSERT INTO users (username, email)
VALUES ('new_user', 'user@example.com');
INSERT INTO orders (user_id, order_date)
VALUES (1, CURRENT_TIMESTAMP);
COMMIT;
Q30
Multiple Choice

Choose the correct SQL command that creates a composite index on multiple columns of a database component.

SQL Code
CREATE INDEX idx_user_order
ON orders (user_id, order_date);