Q1
True / FalsePostgreSQL uses tablespaces to define the physical location of database files on disk.
In PostgreSQL, tablespaces allow users to specify the location on disk where the database objects are stored.
Q2
True / FalseIn PostgreSQL, a schema is a logical container for database objects like tables and views
Schemas in PostgreSQL are used to organize and group database objects, providing a namespace to avoid naming conflicts.
Q3
True / Falsedatabase cluster in PostgreSQL refers to a collection of databases managed by a single server instance.
database cluster in PostgreSQL includes all databases managed by a single PostgreSQL server instance and is created when PostgreSQL is initialized.
Q4
True / FalsePostgreSQL uses "roles" to manage permissions and authentication for users and groups.
Roles in PostgreSQL are used to manage access permissions and can represent either individual users or groups of users.
Q5
True / FalseIn PostgreSQL, a table can have multiple indexes, but an index can only be associated with one table.
PostgreSQL allows multiple indexes on a single table to optimize different types of queries, but each index is tied to a specific table.
Q6
True / FalsePostgreSQL's "pg_catalog" schema contains the system catalog tables and views that store metadata about the database.
The "pg_catalog" schema in PostgreSQL includes system catalog tables and views that provide information about the database's structure and objects.
Q7
True / FalsePostgreSQL supports Foreign Data Wrappers (FDWs) to access and query data from external data sources as if they were part of the PostgreSQL database.
Foreign Data Wrappers in PostgreSQL allow users to interact with data from external databases or data sources, providing a unified view within PostgreSQL.
Q8
True / FalsePostgreSQL's Write-Ahead Logging (WAL) feature is used to ensure data integrity by logging changes before they are applied to the database.
Write-Ahead Logging (WAL) in PostgreSQL ensures data integrity by writing changes to a log before committing them to the database.
Q9
True / FalsePostgreSQL uses MVCC (Multi-Version Concurrency Control) to handle concurrent transactions and maintain consistency.
PostgreSQL employs Multi-Version Concurrency Control (MVCC) to manage simultaneous transactions and ensure that each transaction sees a consistent view of the database.
Q10
True / FalseIn PostgreSQL, a TOAST table is used to store large data values that do not fit in the standard table storage area.
TOAST (The Oversized-Attribute Storage Technique) in PostgreSQL is used to handle large data values by compressing and storing them in a separate table when they exceed certain size limits.
Q21
Multiple ChoiceWhich 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
);
This query creates a 'users' table, which is a fundamental component of a database, representing the entity where user data is stored.
Q26
Multiple ChoiceIdentify 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
);
This query creates an 'error_logs' table to store error messages and their occurrence times, which is a crucial component for tracking errors in the application.
Q29
Multiple ChoiceWhich 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;
This set of SQL commands initiates a transaction, inserts data into the 'users' table, and then into the 'orders' table, finally committing the transaction.