Elance PostgreSQL Test Answers



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

True
FALSE

 

 

A meta-command always begins with what?

Forwardslash character (/)
Dollar sign ($)
Backslash character (\)
Question mark (?)

 

 

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

union
right outer
left outer
self

 

 

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

True - This was addressed in version 9.0
False - This was addressed in version 9.0

 

 

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

False
True

 

 

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

Workstation
Client
Thin Client
Interface

 

 

Which of the following best describes a role:

A server's purpose within a cluster.
The purpose of a particular database.
A cluster's purpose.
A template for authorization to various database objects.

 

 

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

Insert
Write
Execute
Send

 

 

The basic psql command to list tables is?

\do
\dT
\h
\dt

 

 

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

Trigger
View
Diagram
Schema

 

 

The heart of SQL is the __________ statement.

GROUP BY
INSERT INTO
SELECT
VALUES

 

 

PostgreSQL is

a relational database management system.
a hierarchical database management system.
a network-type database management system.
an XML database management system.

 

 

PostgreSQL is:

An open-source SMTP server.
A NoSQL solution.
Enterprise-class proprietary software developed at Bell Labs, with a basic set of features.
An open-source ORDBMS developed at UC Berkley, which supports many modern features.

 

 

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

\dt
ORDER BY
SELECT FROM
\i<filename>

 

 

We add data to PostgreSQL by using which statement?

INSERT
ADD
UPDATE
SELECT

 

 

PostgreSQL used what model of communication?

Client/Server
Network
Peer-to-Peer
Push Model

 

 

With PostgreSQL, you can access data by

Use function calls (APIs) to prepare and execute SQL statements, scan result sets, and perform updates from a large variety of different programming languages.
Use a command-line application to execute SQL statements
All of these
Embed SQL directly into your application

 

 

PostgreSQL has many modern features including:

Complex SQL queries
SQL Sub-selects
All of the above
Views

 

 

The SQL condition for pattern matching is?

IN
LIKE
DISTINCT
BETWEEN

 

 

What is the wrapper around the SQL command CREATE DATABASE?

newdb
add_DB
NEW_DB
createdb

 

 

PostgreSQL runs on:

all major operating systems, including Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows.
on all UNIX versions except Solaris.
Linux and Windows only.
Windows only

 

 

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

Apply
Execute
Commit
Send

 

 

PostgreSQL can be installed?

on a Windows computer via the PostgreSQL installer
from Linux binaries
All of these
from the source code

 

 

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

Views
temporary tables
Foreign Key Constraints
table management

 

 

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

All of the above
INSERT statements
UPDATE statements
DELETE statements

 

 

WAL stands for:

Write Ahead Log
Write Ahead List
Write Anywhere List
Write Anywhere Logging

 

 

Deadlocks occur when:

Two users are connected to the same database at the same time.
Two transactions hold exclusive locks on resources they both need.
Two users try to access the same table at the same time.
Data is being written to the same cell by separate processes at the same time.

 

 

Tablespaces:

Allow an administrator to designate specific locations in a file system where database objects can be stored.
Are a fancy name for table.
Are the amount of disk space a table is using.
Are the width, or number of columns, of a particular table.

 

 

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

in ascending order
grouped together by field type
in a random order
in descending order

 

 

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

False
True

 

 

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

False
True

 

 

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

False
True

 

 

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

False
True

 

 

A VACUUM operation is used:

To recover or reuse disk space occupied by updated or deleted rows.
To protect against loss of very old data due to transaction ID wraparound.
To update data statistics used by the PostgreSQL query planner.
All of these

 

 

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

True
False

 

 

The core PostgreSQL source code includes what interfaces?

Ruby and PHP interfaces
C++ and Java interfaces
The C and embedded C interfaces
VB and VB.NET interfaces

 

 

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

Required
Optional
Integers
Text

 

 

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

debug_print_parse
debug_print_plan
All of these
debug_print_rewritten

 

 

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

psql> \D table_name
psql> describe table_name
psql> DESCRIBE table_name
psql> \d table_name

 

 

The value NULL, in database terminology, means?

All of these
The value is undetermined at this time
The value is undetermined
The value is not relevant for this particular row.

 

 

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

be an admin
have a script do it.
be a superuser.
the special CREATETBL privilege

 

 

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

Modifies an index in place to be lowercase
Creates a new index with a special operator class 'lower' for case insensitive comparisons.
Creates an index for efficient case-insensitive searches on the titles column within the books table
Nothing, it's invalid SQL
Creates a non-write-locking index

 

 

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

\ed
edit sql #go
\e
\edit

 

 

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

2 billion transactions
5 billion transactions
4 billion transactions
3 billion transactions

 

 

The rule system:

Operates between the parser and the planner.
None of these
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.
All of these

 

 

Asynchronous Commits:

None of these
All of these
Allow transactions to complete more quickly
May cause recent transactions to be lost

 

 

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?

The server is idle, awaiting a client connection.
A transaction is possibly hung.
A user issued an IDLE statement to the database.
A client is connected, and the server is awaiting input.

 

 

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

True
False

 

 

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

Collations
Index
Data Types
Database

 

 

Which statement is true about PostgreSQL data types?

A large object data type can be used to store data of unlimited size.
Only the INTEGER type can be declared as an array.
n'in CHARACTER(n) represents the number of bytes.
There is a non-standard PostgreSQL data type, called Geometric data type, which handles 2-dimensional data.

 

 

What command turns on timing?

\on timing
\start time
\time start
\timing

 

 

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

All of these
None of these
max_connections
max_locks_per_transaction

 

 

To restore a PostgreSQL backup created with pg_dump, the following may be used:

$ psql -F database_dump.psql database_name
$ psql -R database_dump.psql database_name
$ psql -f database_dump.psql database_name
$ psql -r database_dump.psql database_name

 

 

In order to echo all input from script, you use the ________ psql command.

-a
-A
-l
-E

 

 

True or False? Dynamic Tracing is enabled by default at compile time.

False
True

 

 

Bob works for StegaCorp. His workstation's IP address is 10.5.34.8. He needs access to a database called "partners" directly from his workstation. Which of the following is the correct entry in pg_hba.conf?

host partners bob 10.5.34.8/24 krb5
host partners bob 10.5.34.8/32 kerb5
host partners bob 10.5.34.8 kerb5
host partners bob 10.5.34.8/32 krb5

 

 

What does MCV stand for?

Massive Checkpoint Vault
Most Common Values
Most Common Variables
Many Common Variables

 

 

By default, in what subdirectory of the database data directory are WAL logs contained?

pg-xlog
pg-log
pg_log
pg_xlog

 

 

Which is NOT true of array indexes?

Partial functional indexes of arrays are supported on Btree, GiST, and GIN indexes.
By default PostgreSQL indexes arrays so that inner elements can be searched.
GIN indexes can search for arrays containing specific elements.
BTree indexes can search for array elements as long as the match begins with the beginning of the array.
GiST indexes can be used to select arrays for specific values.

 

 

True or False? PostgreSQL supports Index Only Scans.

False
True

 

 

What is "index bloat"?

Index filling up with keys.
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.
Indexing inefficiently, like choosing to index timestamps in a table.
Indexing too many tables, resulting in inefficient database performance.

 

 

What are the join strategies available to the postgreSQL planner when a SELECT query contains two or more relations?

Nested Loop Join, Merge Join, Hash Join
MERGE, JOIN
INNER JOIN, OUTER JOIN
MERGE, INNER JOIN, OUTER JOIN

 

 

To copy a database from server1 to server2, you might use which of the following:

pg_mv -h server1 database | pgsql -h server2 database
pg_dump -h server1 database > pgsql -h server2 database
pg_copy -h server1 database | psql -h server2 database
pg_dump -h server1 database | psql -h server2 database

 

 

Which of the following is not a valid integer array?

'{}'
'{1,3,4,5,{6,7}}'
'{{1,2},{1,3},{1,4},{2,5}}'
'{1,3,4,5,6,7}'
'{{1,2,3,4,5,6}}'

 

 

What is the difference between DO 'some code...' and EXECUTE 'some code...' statements?

DO lets you execute some plPgSql code without saving it to database and EXECUTE lets you execute DDL or DML only
EXECUTE statement executes only prepared code, and DO can execute without PREPARE statement
No difference - they both need a preparation for execution
DO prepares a statement and EXECUTE executes it
No difference - they both can execute a code without preparation

 

 

True or False? To increase server performance, automated CHECKPOINT operations should be setup in cron or Task Scheduler.

True
False

 

 

The syntax to view the indexes of an existing postgreSQL table is:

# index database_name.table_name
# \d table_name
# \i table_name
# index table_name

 

 

Locks are recorded in:

pg_lock system logs
pg_locks system view
pg_locks system logs
pg_lock system table

 

 

True or false? Hash indexes are not crash-safe

True
False

 

 

True or False? When restoring a database backed up with pg_dump, it's generally a good idea to enable WAL.

True
False

 

 

True or false: When a table is created which uses a table name as a column type, not null constraints on the column type's table definition are honored by the including table.

False
True

 

 

Which statement is not true about a PostgreSQL domain?

A domain is created by 'CREATE DOMAIN'.
A domain can be used as a column type when defining a table.
Domain is a namespace existing between databases and objects such as tables.
When defining a domain, you can add a default value and constraints to the original data.

 

 

The extension used for data encryption/decryption within PostgreSQL is:

crypto
pgcrypt
pgcrypto
pgencrypt

 

 

Which of the following is NOT a feature of user defined functions?

They can be written in various different languages
Functions marked IMMUTABLE can have their output indexed
They can return multiple result sets via refcursors
They can perform most database management tasks
They can initiate subtransactions

 

 

To create a database that supports UTF-8, the following command can be used:

createdb -E UTF-8 -O user database_name
createdb -E UTF8 -O user database_name
createdb -C UTF8 database_name
createdb -C UTF8 -O user database_name

 

 

What is a TOAST file?

A list of clients not allowed to connect to the database.
A file storing data that was unable to be written to the database, and will be expunged once the server shuts down.
A file containing values too wide to fit comfortably in the main table
A file containining transactions which were unsuccessfully completed due to errors.

 

 

True or False: PostgreSQL allows you to implement table inheritance. This should be defined with the special keyword INHERITIS in the table design.

False
True

 

 

WAL segment size is determined:

By the configure script at compile time
By the wal_segment_size configuration parameter in postgresql.conf
By the administrator at runtime, or through the startup script.
It is statically set within the source code.

 

 

The __________ database model has the advantage of being able to quickly discover all of the records of one type that are related to a specific record of another type by following the pointers from the starting record.

relational
network
hierarchical
structured

 

 

When identifying rows uniquely, we use__________keys.

command
surrogate
standard
unique

 

 

True or false: With table inheritance child tables inherit primary and foreign key definitions from their parents

False
True

 

 

True or False? To enable continuous archiving, all you have to do is set archive_mode to 'on' in postgresql.conf

True
False