Q1
True / FalseIn PostgreSQL, the INTEGER data type can store both positive and negative whole numbers.
The INTEGER data type in PostgreSQL is a 4-byte integer that can store values ranging from -2147483648 to 2147483647.
Q2
True / FalsePostgreSQL's CHAR data type is used for fixed-length character strings.
The CHAR data type in PostgreSQL is used for fixed-length character strings, meaning that the storage size is determined by the defined length and it pads the string with spaces if the input is shorter.
Q3
True / FalseThe BOOLEAN data type in PostgreSQL can store the values TRUE, FALSE, and NULL.
The BOOLEAN data type in PostgreSQL can store TRUE, FALSE, and NULL, representing true, false, and unknown states, respectively.
Q4
True / FalsePostgreSQL's NUMERIC data type is used for storing exact numeric values and allows specifying precision and scale.
The NUMERIC (or DECIMAL) data type in PostgreSQL is used for storing exact numeric values, and you can specify both precision (total number of digits) and scale (number of digits to the right of the decimal point).
Q5
True / FalseIn PostgreSQL, the TIMESTAMP data type can only store date and time without timezone information.
PostgreSQL offers two types of TIMESTAMP data types: TIMESTAMP WITHOUT TIME ZONE and TIMESTAMP WITH TIME ZONE. The latter includes timezone information.
Q6
True / FalseThe UUID data type in PostgreSQL is a 128-bit identifier used for unique identification across tables and databases.
The UUID (Universally Unique Identifier) data type in PostgreSQL is a 128-bit identifier that is used to uniquely identify information without relying on sequences or other methods.
Q7
True / FalsePostgreSQL supports the ARRAY data type, allowing the storage of arrays of any built-in or user-defined base type.
PostgreSQL supports the ARRAY data type, which allows the creation and storage of arrays for any built-in or user-defined base type.
Q8
True / FalseIn PostgreSQL, the JSON data type is only used for storing JSON objects, not arrays.
The JSON data type in PostgreSQL can store both JSON objects and JSON arrays, allowing for versatile JSON data handling.
Q9
True / FalseThe HSTORE data type in PostgreSQL is used for storing sets of key-value pairs within a single PostgreSQL value.
The HSTORE data type in PostgreSQL is designed to store sets of key-value pairs within a single PostgreSQL value, useful for semi-structured data.
Q10
True / FalseIn PostgreSQL, the CIDR data type is used for storing IPv4 and IPv6 networks.
The CIDR (Classless Inter-Domain Routing) data type in PostgreSQL is used for storing both IPv4 and IPv6 networks, providing a way to represent network addresses and their subnet masks.
Q25
Multiple ChoiceWhich 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
);
This command creates a 'tasks' table where the 'completed' column is defined as BOOLEAN, allowing only true or false values.
Q27
Multiple ChoiceWhich 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
);
This command creates a custom ENUM type 'status_enum' and then defines the 'order_status' column in the 'orders' table to use this ENUM type, restricting the column to specific values.
Q29
Multiple ChoiceWhich 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
);
This command creates an 'audit_logs' table where the 'log_timestamp' column is defined as TIMESTAMP, storing both date and time information.
Q30
Multiple ChoiceWhich 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
);
This command creates a 'files' table where the 'file_data' column is defined as BYTEA, allowing storage of binary data like files.