These PostgreSQL multiple-choice questions and their answers will help you strengthen your grip on the subject of PostgreSQL. You can prepare for an upcoming exam or job interview with these PostgreSQL MCQs.
So scroll down and start answering.
A. True
B. FALSE
A. The value is not relevant for this particular row.
B. The value is undetermined
C. The value is undetermined at this time
D. All of these
A. False
B. True
A. Workstation
B. Thin Client
C. Interface
D. Client
A. newdb
B. add_DB
C. NEW_DB
D. createdb
A. SELECT FROM
B. \dt
C. \i<filename>
D. ORDER BY
A. An open-source ORDBMS developed at UC Berkley, which supports many modern features.
B. Enterprise-class proprietary software developed at Bell Labs, with a basic set of features.
C. A NoSQL solution.
D. An open-source SMTP server.
A. an XML database management system.
B. a network-type database management system.
C. a hierarchical database management system.
D. a relational database management system.
A. SQL Sub-selects
B. All of the above
C. Views
D. Complex SQL queries
A. from the source code
B. from Linux binaries
C. on a Windows computer via the PostgreSQL installer
D. All of these
A. Windows only
B. all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows.
C. on all UNIX versions except Solaris.
D. Linux and Windows only.
A. Use function calls (APIs) to prepare and execute SQL statements, scan result sets, and perform updates from a large variety of different programming languages.
B. Embed SQL directly into your application
C. Use a command-line application to execute SQL statements
D. All of these
A. All of the above
B. DELETE statements
C. INSERT statements
D. UPDATE statements
A. UPDATE
B. ADD
C. SELECT
D. INSERT
A. VALUES
B. INSERT INTO
C. SELECT
D. GROUP BY
A. Write
B. Send
C. Execute
D. Insert
A. Schema
B. View
C. Diagram
D. Trigger
A. Commit
B. Send
C. Apply
D. Execute
A. IN
B. DISTINCT
C. LIKE
D. BETWEEN
A. table management
B. Views
C. temporary tables
D. Foreign Key Constraints
A. The purpose of a particular database.
B. A cluster's purpose.
C. A server's purpose within a cluster.
D. A template for authorization to various database objects.
A. \do
B. \h
C. \dT
D. \dt
A. True - This was addressed in version 9.0
B. False - This was addressed in version 9.0
A. Write Anywhere List
B. Write Anywhere Logging
C. Write Ahead Log
D. Write Ahead List
A. Two users try to access the same table at the same time.
B. Two users are connected to the same database at the same time.
C. Data is being written to the same cell by separate processes at the same time.
D. Two transactions hold exclusive locks on resources they both need.
A. False
B. True
A. Allow an administrator to designate specific locations in a file system where database objects can be stored.
B. Are a fancy name for table.
C. Are the width, or number of columns, of a particular table.
D. Are the amount of disk space a table is using.
A. in ascending order
B. in a random order
C. grouped together by field type
D. in descending order
A. True
B. False
A. right outer
B. left outer
C. union
D. self
A. False
B. True
A. False
B. True
A. VB and VB.NET interfaces
B. The C and embedded C interfaces
C. Ruby and PHP interfaces
D. C++ and Java interfaces
A. All of these
B. To recover or reuse disk space occupied by updated or deleted rows.
C. To update data statistics used by the PostgreSQL query planner.
D. To protect against loss of very old data due to transaction ID wraparound.
A. False
B. True
A. Optional
B. Text
C. Required
D. Integers
A. psql> describe table_name
B. psql> \D table_name
C. psql> DESCRIBE table_name
D. psql> \d table_name
A. debug_print_parse
B. All of these
C. debug_print_rewritten
D. debug_print_plan
A. Backslash character (\)
B. Dollar sign ($)
C. Question mark (?)
D. Forwardslash character (/)
A. the special CREATETBL privilege
B. have a script do it.
C. be a superuser.
D. be an admin
A. Nothing, it's invalid SQL
B. Creates a non-write-locking index
C. Modifies an index in place to be lowercase
D. Creates a new index with a special operator class 'lower' for case insensitive comparisons.
E. Creates an index for efficient case-insensitive searches on the titles column within the books table
A. \ed
B. edit sql #go
C. \edit
D. \e
A. 4 billion transactions
B. 3 billion transactions
C. 2 billion transactions
D. 5 billion transactions
A. May cause recent transactions to be lost
B. None of these
C. All of these
D. Allow transactions to complete more quickly
A. Takes the output of the parser, one query tree, and the user-defined rewrite rules, which are also query trees with some extra information, and creates zero or more query trees as result.
B. Operates between the parser and the planner.
C. None of these
D. All of these
A. False
B. True
A. \start time
B. \timing
C. \on timing
D. \time start
A. A client is connected, and the server is awaiting input.
B. The server is idle, awaiting a client connection.
C. A transaction is possibly hung.
D. A user issued an IDLE statement to the database.
A. max_connections
B. None of these
C. max_locks_per_transaction
D. All of these
A. Collations
B. Index
C. Data Types
D. Database
A. True
B. False
A. n'in CHARACTER(n) represents the number of bytes.
B. A large object data type can be used to store data of unlimited size.
C. There is a non-standard PostgreSQL data type, called Geometric data type, which handles 2-dimensional data.
D. Only the INTEGER type can be declared as an array.
A. False
B. True
A. Massive Checkpoint Vault
B. Many Common Variables
C. Most Common Variables
D. Most Common Values
A. $ psql -F database_dump.psql database_name
B. $ psql -f database_dump.psql database_name
C. $ psql -R database_dump.psql database_name
D. $ psql -r database_dump.psql database_name
A. -l
B. -A
C. -E
D. -a
A. pg_log
B. pg-xlog
C. pg_xlog
D. pg-log
A. Indexing too many tables, resulting in inefficient database performance.
B. No-longer-needed keys in an index aren't reclaimed, therefore increasing space required to store an index, as well as time it takes to scan.
C. Indexing inefficiently, like choosing to index timestamps in a table.
D. Index filling up with keys.
A. Partial functional indexes of arrays are supported on Btree, GiST, and GIN indexes.
B. GiST indexes can be used to select arrays for specific values.
C. GIN indexes can search for arrays containing specific elements.
D. By default PostgreSQL indexes arrays so that inner elements can be searched.
E. BTree indexes can search for array elements as long as the match begins with the beginning of the array.
A. host partners bob 10.5.34.8/32 krb5
B. host partners bob 10.5.34.8 kerb5
C. host partners bob 10.5.34.8/24 krb5
D. host partners bob 10.5.34.8/32 kerb5
A. INNER JOIN, OUTER JOIN
B. MERGE, INNER JOIN, OUTER JOIN
C. MERGE, JOIN
D. Nested Loop Join, Merge Join, Hash Join
A. pg_mv -h server1 database | pgsql -h server2 database
B. pg_dump -h server1 database > pgsql -h server2 database
C. pg_dump -h server1 database | psql -h server2 database
D. pg_copy -h server1 database | psql -h server2 database
A. False
B. True
A. '{1,3,4,5,6,7}'
B. '{{1,2},{1,3},{1,4},{2,5}}'
C. '{}'
D. '{1,3,4,5,{6,7}}'
E. '{{1,2,3,4,5,6}}'
A. DO prepares a statement and EXECUTE executes it
B. No difference - they both need a preparation for execution
C. No difference - they both can execute a code without preparation
D. EXECUTE statement executes only prepared code, and DO can execute without PREPARE statement
E. DO lets you execute some plPgSql code without saving it to database and EXECUTE lets you execute DDL or DML only
A. pg_lock system table
B. pg_locks system view
C. pg_lock system logs
D. pg_locks system logs
A. True
B. False
A. False
B. True
A. True
B. False
A. # index database_name.table_name
B. # \i table_name
C. # \d table_name
D. # index table_name
A. A domain can be used as a column type when defining a table.
B. When defining a domain, you can add a default value and constraints to the original data.
C. A domain is created by 'CREATE DOMAIN'.
D. Domain is a namespace existing between databases and objects such as tables.
A. pgcrypto
B. crypto
C. pgcrypt
D. pgencrypt
A. A file containining transactions which were unsuccessfully completed due to errors.
B. A list of clients not allowed to connect to the database.
C. A file containing values too wide to fit comfortably in the main table
D. A file storing data that was unable to be written to the database, and will be expunged once the server shuts down.
A. createdb -E UTF-8 -O user database_name
B. createdb -C UTF8 database_name
C. createdb -C UTF8 -O user database_name
D. createdb -E UTF8 -O user database_name
A. False
B. True
A. Functions marked IMMUTABLE can have their output indexed
B. They can be written in various different languages
C. They can perform most database management tasks
D. They can return multiple result sets via refcursors
E. They can initiate subtransactions
A. It is statically set within the source code.
B. By the administrator at runtime, or through the startup script.
C. By the wal_segment_size configuration parameter in postgresql.conf
D. By the configure script at compile time
A. hierarchical
B. structured
C. relational
D. network
A. command
B. standard
C. surrogate
D. unique
A. False
B. True
A. True
B. False
A. Yes
B. No
A. create table foo (bar int array);
B. create table foo (bar integer[]);
C. create table foo (bar array int);
D. create table foo (bar[] int);
E. None of the above
A. True
B. False
A. A-tree
B. B-tree
C. GiST
D. Hash
E. GIN
F. None of the above
A. psql -f filename dbname
B. psql -Fc filename dbname
C. pg_restore filename dbname
D. pg_restore -d dbname filename
E. None of the above
A. File synchronization will be deactivated
B. fsync is not a valid configuration option
C. PostgreSQL will not enforce write ahead log flush
D. It will turn off fast synchronization
E. None of the above
A. Hash
B. A-tree
C. B-tree
D. GIN
E. GiST
A. Trust
B. PAM
C. LDAP
D. Radius
E. Password
A. You cannot
B. Leave a superuser connected all the time
C. Set superuser_reserved_connections in postgresql.conf
D. Kill postmaster and connect to it
E. None of the above
A. ts_highlight
B. ts_tag
C. ts_headline
D. ts_select
E. None of the above
A. 256
B. 1024
C. 1
D. No limit (It will be equivalent to the text)
E. None of the above
A. True
B. False
A. True
B. False
A. 5000
B. 541
C. 5432
D. 63
E. None of the above
A. Per-row triggers
B. Per-table triggers
C. Per-database triggers
D. Per-statement triggers
A. *
B. $
C. %
D. &
E. None of the above
A. 4 numeric values with up to 3 digits to the right of the decimal point.
B. A numeric value with up to 7 digits in total, 3 of which can be to the right of the decimal point.
C. A numeric value with up to 4 digits in total, 3 of which can be to the right of the decimal point.
D. A numeric value with at least 4 digits, 3 of which must be to the right of the decimal point.
A. By ID
B. By insertion date
C. By name
D. The ordering is unknown if not specified
E. None of the above
A. SELECT random() * FROM tab LIMIT 1;
B. SELECT * FROM tab ORDER BY random() LIMIT 1;
C. SELECT * FROM tab RANDOM LIMIT 1 ;
D. SELECT RANDOM 1 from tab;
E. None of the above