PostgreSQL MCQs

PostgreSQL MCQs

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.

1: PostgreSQL can be used from just about any major programming language, including C, C++, Perl, Python, Java, Tcl, and PHP.

A.   True

B.   FALSE

2: The value NULL, in database terminology, means?

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

3: True or false: With table inheritance, not null and check constraints are inherited.

A.   False

B.   True

4: What do you call the application that makes requests of the PostgreSQL server?

A.   Workstation

B.   Thin Client

C.   Interface

D.   Client

5: What is the wrapper around the SQL command CREATE DATABASE?

A.   newdb

B.   add_DB

C.   NEW_DB

D.   createdb

6: When retrieving data in a particular table, we use the_____________ statement.

A.   SELECT FROM

B.   \dt

C.   \i<filename>

D.   ORDER BY

7: PostgreSQL is:

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.

8: PostgreSQL is

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.

9: PostgreSQL has many modern features including:

A.   SQL Sub-selects

B.   All of the above

C.   Views

D.   Complex SQL queries

10: PostgreSQL can be installed?

A.   from the source code

B.   from Linux binaries

C.   on a Windows computer via the PostgreSQL installer

D.   All of these

11: PostgreSQL runs on:

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.

12: With PostgreSQL, you can access data by

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

13: Triggers can be configured to execute when which of the following operations are performed:

A.   All of the above

B.   DELETE statements

C.   INSERT statements

D.   UPDATE statements

14: We add data to PostgreSQL by using which statement?

A.   UPDATE

B.   ADD

C.   SELECT

D.   INSERT

15: The heart of SQL is the __________ statement.

A.   VALUES

B.   INSERT INTO

C.   SELECT

D.   GROUP BY

16: The most common method to get data into a table is to use what command?

A.   Write

B.   Send

C.   Execute

D.   Insert

17: In PostgreSQL, a named collection of tables is called what?

A.   Schema

B.   View

C.   Diagram

D.   Trigger

18: What command tells PostgreSQL that all of the changes you made to a database should become permanent?

A.   Commit

B.   Send

C.   Apply

D.   Execute

19: The SQL condition for pattern matching is?

A.   IN

B.   DISTINCT

C.   LIKE

D.   BETWEEN

20: ____________ allow us to define formally in the database how different tables relate to each other.

A.   table management

B.   Views

C.   temporary tables

D.   Foreign Key Constraints

21: Which of the following best describes a role:

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.

22: The basic psql command to list tables is?

A.   \do

B.   \h

C.   \dT

D.   \dt

23: True or False? VACUUM FULL shrinks indexes, optimizing database performance.

A.   True - This was addressed in version 9.0

B.   False - This was addressed in version 9.0

24: WAL stands for:

A.   Write Anywhere List

B.   Write Anywhere Logging

C.   Write Ahead Log

D.   Write Ahead List

25: Deadlocks occur when:

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.

26: True or False? When using a SELECT statement on a table, or group of tables, those resources are locked exclusively.

A.   False

B.   True

27: Tablespaces:

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.

28: If you don’t specify ASC or DESC, PostgreSQL will assume you want to see results:

A.   in ascending order

B.   in a random order

C.   grouped together by field type

D.   in descending order

29: True or False: A tablespace is the place where database objects are stored on disk.

A.   True

B.   False

30: When you want to use a join between columns that are in the same table, you use what type of join?

A.   right outer

B.   left outer

C.   union

D.   self

31: True or False? Within a table, a single column may be encrypted.

A.   False

B.   True

32: True or False? ALTER TABLE may be issued while a VACUUM process is running.

A.   False

B.   True

33: The core PostgreSQL source code includes what interfaces?

A.   VB and VB.NET interfaces

B.   The C and embedded C interfaces

C.   Ruby and PHP interfaces

D.   C++ and Java interfaces

34: A VACUUM operation is used:

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.

35: True or False? PostgreSQL is so lightweight that performance and reliability are not affected by hardware.

A.   False

B.   True

36: Unless you specify NOT NULL, PostgreSQL will assume that a column is:

A.   Optional

B.   Text

C.   Required

D.   Integers

37: To describe a table in PostgreSQL which of the following is correct:

A.   psql> describe table_name

B.   psql> \D table_name

C.   psql> DESCRIBE table_name

D.   psql> \d table_name

38: Query trees can be viewed in the server logs as long as which of the following configuration parameters are enabled?

A.   debug_print_parse

B.   All of these

C.   debug_print_rewritten

D.   debug_print_plan

39: A meta-command always begins with what?

A.   Backslash character (\)

B.   Dollar sign ($)

C.   Question mark (?)

D.   Forwardslash character (/)

40: To create a database in PostgreSQL, you must have the special CREATEDB privilege or

A.   the special CREATETBL privilege

B.   have a script do it.

C.   be a superuser.

D.   be an admin

41: What does the following statement do? CREATE INDEX lower_title_idx ON books ((lower(title)));

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

42: What command allows you to edit PostgreSQL queries in your favorite editor ?

A.   \ed

B.   edit sql #go

C.   \edit

D.   \e

43: To prevent transaction wraparound, a VACUUM operation should be run on every table no less than once every:

A.   4 billion transactions

B.   3 billion transactions

C.   2 billion transactions

D.   5 billion transactions

44: Asynchronous Commits:

A.   May cause recent transactions to be lost

B.   None of these

C.   All of these

D.   Allow transactions to complete more quickly

45: The rule system:

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

46: True or False? Only the administrator can make use of tablespaces.

A.   False

B.   True

47: What command turns on timing?

A.   \start time

B.   \timing

C.   \on timing

D.   \time start

48: When looking at 'ps' output on a unix system, you see the following: postgres 1016 0.1 2.4 6532 3080 pts/1 SN 13:19 0:00 postgres: tgl regression [local] idle in transaction What does "idle in transaction" mean?

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.

49: Advisory locks are allocated out of a shared memory pool whose size is defined by the configuration variables....

A.   max_connections

B.   None of these

C.   max_locks_per_transaction

D.   All of these

50: This is used to determine how text is stored and sorted within PostgreSQL?

A.   Collations

B.   Index

C.   Data Types

D.   Database