PostgreSQL Database Quiz Questions

Course Name:PostgreSQL
Chapter Name:Chapter 5 - DDL (Data Definition Language)
Lesson Content Link:Data Types
Current Quiz Count:30
Progress
0%
Q1
True / False

In PostgreSQL, the INTEGER data type can store both positive and negative whole numbers.

Q2
True / False

PostgreSQL's CHAR data type is used for fixed-length character strings.

Q3
True / False

The BOOLEAN data type in PostgreSQL can store the values TRUE, FALSE, and NULL.

Q4
True / False

PostgreSQL's NUMERIC data type is used for storing exact numeric values and allows specifying precision and scale.

Q5
True / False

In PostgreSQL, the TIMESTAMP data type can only store date and time without timezone information.

Q6
True / False

The UUID data type in PostgreSQL is a 128-bit identifier used for unique identification across tables and databases.

Q7
True / False

PostgreSQL supports the ARRAY data type, allowing the storage of arrays of any built-in or user-defined base type.

Q8
True / False

In PostgreSQL, the JSON data type is only used for storing JSON objects, not arrays.

Q9
True / False

The HSTORE data type in PostgreSQL is used for storing sets of key-value pairs within a single PostgreSQL value.

Q10
True / False

In PostgreSQL, the CIDR data type is used for storing IPv4 and IPv6 networks.

Q11
Single Choice

Which MySQL data type is best suited for storing true/false values?

Q12
Single Choice

Which MySQL data type would you use to store a fixed-length string?

Q13
Single Choice

Given the SQL statement below, what is the maximum length of the username column?

SQL Code
CREATE TABLE users (
 username VARCHAR(50)
);
Q14
Single Choice

What is the difference between TEXT and BLOB data types in MySQL?

Q15
Single Choice

What MySQL data type would you use to store large integers greater than BIGINT?

Q16
Single Choice

Given the following SQL statement, what is the purpose of DECIMAL(10, 2)?

SQL Code
CREATE TABLE orders (
 price DECIMAL(10, 2)
);
Q17
Single Choice

What MySQL data type would you use to store date and time, with fractional seconds up to microseconds?

Q18
Single Choice

Given the SQL statement below, what is the maximum value that can be stored in the age column?

SQL Code
CREATE TABLE person (
 age TINYINT UNSIGNED
);
Q19
Single Choice

Which MySQL data type should be used for a column that stores IP addresses in the most optimized way?

Q20
Single Choice

Which MySQL data type is best suited for storing geographic coordinates such as latitude and longitude?

Q21
Multiple Choice

Which SQL command defines a column with a VARCHAR data type in PostgreSQL?

SQL Code
CREATE TABLE customers (
 customer_id SERIAL PRIMARY KEY,
 customer_name VARCHAR(100) NOT NULL
);
Q22
Multiple Choice

Which SQL command defines a column with a NUMERIC data type in PostgreSQL?

SQL Code
CREATE TABLE transactions (
 transaction_id SERIAL PRIMARY KEY,
 amount NUMERIC(10, 2) NOT NULL
);
Q23
Multiple Choice

Which SQL command correctly defines a DATE data type column in PostgreSQL?

SQL Code
CREATE TABLE events (
 event_id SERIAL PRIMARY KEY,
 event_date DATE NOT NULL
);
Q24
Multiple Choice

Which SQL command defines a JSONB column in PostgreSQL?

SQL Code
CREATE TABLE logs (
 log_id SERIAL PRIMARY KEY,
 log_data JSONB NOT NULL
);
Q25
Multiple Choice

Which SQL command defines a BOOLEAN data type column in PostgreSQL?

SQL Code
CREATE TABLE tasks (
 task_id SERIAL PRIMARY KEY,
 task_name VARCHAR(100) NOT NULL,
 completed BOOLEAN NOT NULL
);
Q26
Multiple Choice

Which SQL command defines an ARRAY data type column in PostgreSQL?

SQL Code
CREATE TABLE orders (
 order_id SERIAL PRIMARY KEY,
 product_ids INT[] NOT NULL
);
Q27
Multiple Choice

Which SQL command defines a column using the ENUM data type in PostgreSQL?

SQL Code
CREATE TYPE status_enum AS ENUM ('pending', 'shipped', 'delivered');
CREATE TABLE orders (
 order_id SERIAL PRIMARY KEY,
 order_status status_enum NOT NULL
);
Q28
Multiple Choice

Which SQL command defines a column with a UUID data type in PostgreSQL?

SQL Code
CREATE TABLE devices (
 device_id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
 device_name VARCHAR(100) NOT NULL
);
Q29
Multiple Choice

Which SQL command defines a column with a TIMESTAMP data type in PostgreSQL?

SQL Code
CREATE TABLE audit_logs (
 log_id SERIAL PRIMARY KEY,
 log_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
 log_details TEXT NOT NULL
);
Q30
Multiple Choice

Which SQL command defines a column using the BYTEA data type in PostgreSQL?

SQL Code
CREATE TABLE files (
 file_id SERIAL PRIMARY KEY,
 file_name VARCHAR(255) NOT NULL,
 file_data BYTEA NOT NULL
);