Chapter 10 - Selected Single-Row Functions

Arguments

Values listed inside parentheses are known as __________.

Single-row functions

Which of the following returns one row of results for each row processed?
A. Single-row function
B. multiple-row function
C. Aggregate function
D. All of the above

Multiple-row functions

Returns only one result per group or category of rows processed.

Character functions

What type of functions changes the case of characters?

Case conversion functions

What type of functions alters the case of a character string?

B. Function

A predefined block of code that accepts arguments.
A. Argument
B. Function
C. Expression
D. Conversion

C. UPPER

Which of the following is a case conversion function?
A. ROUND
B. TRUNC
C. UPPER
D. INSTR

D. NEXT_DAY

Which of the following is a date function?
A. MONTHS_BEFORE
B. LAST_DATE
C. CURRENT_DAY
D. NEXT_DAY

C. LOWER

Which of the following is used to convert all characters to lowercase?
A. INITCAP
B. UPPER
C. LOWER
D. LOW

C. INITCAP

Which function will capitalize the first letter of each word?
A. LOWER
B. UPPER
C. INITCAP
D. INITIALCAP

A. True

Character manipulation functions manipulate string data by extracting substrings, counting the number of characters, or replacing strings.
A. True
B. False

B. INSTR

Which of the following functions searches a string for a specified set of characters or a substring, and then returns a numeric value representing the first character position in which the substring is found?
A. SUBSTR
B. INSTR
C. RPAD
D. LPAD

B. LPAD

Which of the following functions is used to pad, or fill in, a character string to a fixed width?
A. INSTR
B. LPAD
C. LTRIM
D. REPLACE

C. RTRIM

Which of the following functions is used to remove a specific string of characters?
A. LPAD
B. REPLACE
C. RTRIM
D. RPAD

A. TO_CHAR

Which function allows you to display numeric data and dates in a specific format?
A. TO_CHAR
B. CASE
C. DECODE
D. SOUNDEX

A. 0

What is the default position for the ROUND function?
A. 0
B. 2
C. -1
D. 1

D. SYSDATE

Which function returns the current date and time set on an operating system where the database resides?
A. LAST_MONTH
B. TRUNC
C. CURRENT_DATE
D. SYSDATE

D. NVL

Which function substitutes a value for a NULL value?
A. NULL
B. TO_CHAR
C. DECODE
D. NVL

C. SELECT TO_CHAR (SYSDATE, 'Month DD, YYYY')
FROM dual;

Which of the following is a valid SQL statement?
A. SELECT SYSDATE
B. SELECT UPPER (Hello) FROM DUAL'
C. SELECT TO_CHAR (SYSDATE, 'Month DD, YYYY')
FROM dual;
D. All of the above
E. None of the above

C. SUBSTR

Which of the following functions can be used to extract a portion of a character string?
A. EXTRACT
B. TRUNC
C. SUBSTR
D. INITCAP

a

Which of the following determines how long ago orders that haven't shipped were received?
A. SELECT order#, shipdate-orderdate delay
FROM orders;
B. SELECT order#, SYSDATE-orderdate
FROM orders
WHERE shipdate IS NULL;
C. SELECT order#, NVL (shipdate, 0)
F

a

Which of the following SQL statements produces "Hello World" as the output?
A. SELECT "Hello World" FROM DUAL;
B. SELECT INITCAP ('HELLO WORLD') FROM dual;
C. SELECT LOWER ('HELLO WORLD') FROM dual;
D. Both a and b
E. None of the above

a

Which of the following functions can be used to substitute a value for a NULL value?
A. NVL
B. TRUNC
C. NVL2
D. SUBSTR
E. both a and d
F. both a and c

a

Which of the following is not a valid format argument for displaying the current time?
A. 'HH:MM:SS'
B. 'HH24:SS'
C. 'HH12:MI:SS'
D. All of the above are valid

a

Which of the followings lists only the last four digits of the contact person's phone number at American Publishing?
A. SELECT EXTRACT (phone, -4, 1)
FROM publisher
WHERE name='AMERICAN PUBLISHING';
B. SELECT SUBSTR (phone, -4, 1)
FROM publisher
WHERE nam

a

Which of the following functions can be used to determine how many months a book has been available?
A. MONTH
B. MON
C. MONTH_BETWEEN
D. none of the above

a

Which of the following displays the order date for order 1000 as 3/31?
A. SELECT TO_CHAR (orderdate, 'MM/DD')
FROM orders
WHERE order#=1000;
B. SELECT TO_CHAR (orderdate, 'Mth/DD')
FROM orders
WHERE order#=1000;
C. SELECT TO_CHAR (orderdate, 'MONTH/YY')
F

a

Which of the following functions can produce different results, depending on the value of a specified column?
A. NVL
B. DECODE
C. UPPER
D. SUBSTR

b

Which of the following SQL statements is not valid?
A. SELECT TO_CHAR (orderdate, '99/9999')
FROM orders;
B. SELECT INITCAP (firstname), UPPER (lastname)
FROM customers;
C. SELECT cost, retail, TO_CHAR (retail-cost, '999.99') profit
FROM books;
D. all of

b

Which function can be used to add spaces to a column until it's a specific width?
A. TRIML
B. PADL
C. LWIDTH
D. none of the above

b

Which of the following SELECT statements returns 30 as the result?
A. SELECT ROUND (24.37, 2) FROM dual;
B. SELECT TRUNC (29.99, 2) FROM dual;
C. SELECT ROUND (29.01, -1) FROM dual;
D. SELECT TRUNC (29.99, -1) FROM dual;

b

Which of the following is a valid SQL statement?
A. SELECT TRUNC (ROUND(125.38, 1), 0) FROM dual;
B. SELECT ROUND (TRUNC(125.38,0) FROM dual;
C. SELECT LTRIM (LPAD(state, 5, ' '), 4, -3, "*") FROM dual;
D. SELECT SUBSTR (ROUND(14.87, 2, 1), -4, 1) FROM du

B. Lower

Which of the following functions can't be used to convert the letter case of a character string?
A. UPPER
B. LOWER
C. INITIALCAP
D. All of the above

b

Which of the following format elements causes months to be displayed as a three-letter abbreviation?
A. MMM
B. MONTH
C. MON
D. none of the above

b

Which of the following SQL statements displays a customer's name in all uppercase characters:
A. SELECT UPPER ('firstname', 'lastname')
FROM customers;
B. SELECT UPPER (firstname, lastname)
FROM customers;
C. SELECT UPPER (lastname, ', 'firstname)
FROM cu

b

Which of the following functions can be used to display the character string FLORIDA in the query results whenever FL is entered in the State field?
A. SUBSTR
B. NVL2
C. REPLACE
D. TRUNC
E. none of the above

B. DUAL

What's the name of the table provided by Oracle 11g for competing queries that don't involve a table?
A. DUMDUM
B. DUAL
C. ORAC
D. SYS

C. a NULL value

If an integer is multiplied by a NULL value, the result is:
A. an integer
B. a whole number
C. a NULL value
D. None of the above -- a syntax error message is returned.

C. When the LOWER function is used in a SELECT clause, the function stays in effect for the duration of that SQL statement

Which of the following is an accurate statement?
A. When the LOWER function is used in a SELECT clause, it will automatically store the data in lower-case letters in the database table.
B. When the LOWER function is used in a SELECT clause, the function s

A. LTRIM

Which of the following functions can be used to remove a specific set of characters from the left side of a set of data values?
A. LTRIM
B. RTRIM
C. FULLTRIM
D. both a and b

B. REPLACE

Which of the following can be used to replace a specific set of characters with another set of characters?
A. SUBSTR
B. REPLACE
C. FNDRPLCE
D. none of the above

A. CONCAT

Which of the following functions is similar to using the (| |) symbol to combine the contents of two character strings?
A. CONCAT
B. CAT
C. CONCATENATION
D. CONCATEN

A. two

What is the maximum number of columns or character strings that can be combined through a single CONCAT function?
A. two
B. four
C. three
D. eight

D. ROUND(34.21, 0)

Which of the following functions will round the numeric data to no decimal places?
A. ROUND(34.21, 1)
B. ROUND(34.21, -1)
C. ROUND(34.21, NONE)
D. ROUND(34.21, 0)

A. SELECT ROUND(21.12, 1) FROM dual;

Which of the following statements will produce the value 21.1?
A. SELECT ROUND(21.12, 1) FROM dual;
B. SELECT ROUND(21.12, -1) FROM dual;
C. SELECT ROUND(21.12, 0) FROM dual;
D. none of the above

B. TRUNC

Which of the following functions will truncate a numeric value to a specific position?
A. TRUNCATE
B. TRUNC
C. TRUND
D. none of the above

B. Julian date

Which of the following represents the number of days that have passed since January 1, 4712 B.C.?
A. Cartesian date
B. Julian date
C. Extended date
D. none of the above

C. MONTHS_BETWEEN

Which of the following functions is used to determine the number of months between two date values?
A. MONTH_BETWEEN
B. MTH_BETWEEN
C. MONTHS_BETWEEN
D. MNTH_BETWEEN

C. ADD_MONTHS

Which of the following functions can be used to determine the date one month after a specified date?
A. ADD_MONTH
B. ONE_MONTH
C. ADD_MONTHS
D. NEXT_MONTH

B. NEXT_DAY

Which of the following functions can be used to determine the next occurrence of a specific day of the week after a given date?
A. NEXT_DATE
B. NEXT_DAY
C. DATE_NEXT
D. NEXT_DDD

D. DATE

Which of the following functions can be used to change the format of a date that has been entered by a user to the default storage format use by Oracle11g?
A. TO_CHAR
B. DEFAULT
C. TO_DATE
D. DATE

A. NVL

Which of the following functions can be used to substitute another value for a NULL value during calculations?
A. NVL
B. NULVAL
C. NULLVAL
D. NLV

D. NVL2

Which of the following functions allows for different options, depending upon whether a NULL value exists?
A. NVL
B. IFNVL
C. IFNL
D. NVL2

A. single quotation marks

When a format argument is included in a function, it must be enclosed in ____.
A. single quotation marks
B. parentheses
C. double quotation marks
D. percent signs

D. TO_CHAR

The ____ function can be used to convert dates and numbers to a formatted character string.
A. TO_DATE
B. FORMATMODEL
C. CONVERT
D. TO_CHAR

B. numeric and date

The TO_CHAR function can be used to format what types of data?
A. numeric
B. numeric and date
C. date
D. no formatting can be performed

C. 0009999

Which of the following format elements will display insignificant leading zeros?
A. $999
B. 99.999
C. 0009999
D. 9,999.990

C. SSSS

Which of the following format argument elements will display the number of seconds past midnight?
A. SS
B. MI:SS
C. SSSS
D. MI

B. HH24

Which of the following format elements will display 1:00 p.m. as 13?
A. HH
B. HH24
C. HR
D. 24

B. SP

Which of the following format model elements can be used to spell out a number?
A. TH
B. SP
C. STRING
D. SP#

A. DECODE

Which of the following functions can be used to specify a list of alternative actions that should be taken depending upon a stated value?
A. DECODE
B. IFTHEN
C. DCD
D. SELECTIF

B. SOUNDEX

The phonetic representation of a character string can be determined using the ____ function.
A. SOUND
B. SOUNDEX
C. PHONETIC
D. SOUNDINDEX

B. inner

When functions are nested, the ____ function is solved first.
A. single-row
B. inner
C. multiple-row
D. outer

D. outer

When functions are nested, the ____ function is solved last.
A. multiple-row
B. inner
C. single-row
D. outer

A. TO_CHAR

If a SELECT statement includes SUBSTR(TO_CHAR(SYSDATE, 'fmMONTH DD, YYYY'), -4, 4) in the SELECT clause, which of these functions will be executed first?
A. TO_CHAR
B. MONTH
C. SUBSTR
D. YYYY

C. SYSDATE

Which of the following keywords will return the value of the date according to the computer?
A. SYSTEMDATE
B. DATE
C. SYSDATE
D. DATESYS

B. DUAL

Which of the following is a table provided in Oracle which can be helpful for testing functions?
A. DUMMY
B. DUAL
C. DUM
D. EMPTY

C. NULL

If the two values compared by the NULLIF function are equal, what value does the function return?
A. The first value in the comparison
B. The second value in the comparison
C. NULL
D. Both values in the comparison

B. SELECT LOWER(firstname) || ' ' || LOWER(lastname) FROM customers;

Which of the following will display the name of each customer in lower-case
characters based upon the contents of the CUSTOMERS table?
A. SELECT LOWER(name) FROM customers;
B. SELECT LOWER(firstname) || ' ' || LOWER(lastname) FROM customers;
C. None of th

A. SELECT INITCAP(CONCAT(city, CONCAT(', ', CONCAT(state,
CONCAT(' ', zip))))) FROM customers;

Based upon the contents of the CUSTOMERS table, which of the following will display the shipping location as: City, State Zip.
A. SELECT INITCAP(CONCAT(city, CONCAT(', ', CONCAT(state,
CONCAT(' ', zip))))) FROM customers;
B. SELECT INITCAP(CONCAT(city,','

B. SELECT customer#, city, REPLACE(state, 'FL', 'FLORIDA') FROM customers
WHERE state = 'FL';

Which of the following statements will display the value of FL assigned to the state column as FLORIDA?
A. SELECT customer#, city, SUBSTR( 'FL', 'FLORIDA') FROM customers
WHERE state = 'FL';
B. SELECT customer#, city, REPLACE(state, 'FL', 'FLORIDA') FROM

D. none of the above

Which of the following SQL statements will return an error message, based upon the contents of the CUSTOMERS table?
A. SELECT CONCAT(firstname, lastname) FROM customers;
B. SELECT INITCAP(lastname), INITCAP(firstname) FROM customers;
C. SELECT LENGTH(cust

C. SELECT customer#, NVL2(referred, 'Referred', 'Not Referred') FROM customers;

Which of the following is a valid SQL statement based upon the contents of the CUSTOMERS table?
A. SELECT INITCAP(firstname, lastname) FROM customers;
B. SELECT LENGTH (city, state, zip) FROM customers;
C. SELECT customer#, NVL2(referred, 'Referred', 'Not

A. SELECT order#, TO_CHAR(shipdate-orderdate, '99') FROM orders
WHERE shipdate IS NOT NULL;

Based upon the contents of the ORDERS table, which of the following SQL statements will display the number of days between the date an order was placed and the date it was shipped?
A. SELECT order#, TO_CHAR(shipdate-orderdate, '99') FROM orders
WHERE ship

D. SELECT order# FROM orders
WHERE SUBSTR(shipzip, 1, 3) = 323;

Based upon the contents of the ORDERS table, which of the following SQL statements will display only those orders shipped to the zip code zone that begins with 323?
A. SELECT order#, SUBSTR(shipzip, 1, 323)
FROM orders;
B. SELECT order#, SUBSTR(shipzip, 1

B.SELECT INITCAP(CONCAT(shipcity, CONCAT(', ', CONCAT(shipstate, CONCAT
(' ', shipzip)))))FROM orders;

Based upon the contents of the ORDERS table, which of the following will display the shipping location as: Shipcity, Shipstate Shipzip
A. SELECT INITIALCAP(CONCAT(shipcity, shipstate, shipzip))
FROM orders;
B.SELECT INITCAP(CONCAT(shipcity, CONCAT(', ', C

A. SELECT order#, TO_CHAR(shipdate, 'Month DD, YYYY') FROM orders;

Based upon the contents of the ORDERS table, which of the following SQL statements will display the ship date for order 1006 as April 2, 2002?
A. SELECT order#, TO_CHAR(shipdate, 'Month DD, YYYY') FROM orders;
B. SELECT order#, TO_DATE(shipdate, 'Month DD