wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL: Using Single-Row Functions

Total questions: 100

Worksheet time: 50mins

Name
Class
Date
1.

What will be the outcome of the following query?

SELECT ROUND(144.23,-1) FROM dual;
a)

140

b)

144

c)

150

d)

100

2.

You are currently located in New Jersey and have connected to a remote database in San Diego. You issue the following command.

SELECT ROUND (sysdate-hire_date,0) FROM employees WHERE (sysdate-hire_date)/180 = 2;


What is the outcome of this query?

a)

An error because the ROUND function cannot be used with Date arguments.

b)

An error because the WHERE condition expression is invalid.

c)

Number of days since the employee was hired based on the current San Diego date and time.

d)

Number of days since the employee was hired based on the current New Jersey date and time.

3.

You need to display the names of the employees who have the letter 's' in their first name and the letter 't' at the second position in their last name. Which query would give the required output?

a)
SELECT first_name, last_name FROM employees WHERE INSTR(first_name,'s') <> 0 AND SUBSTR(last_name,2,1) = 't';
b)
SELECT first_name, last_name FROM employees WHERE INSTR(first_name,'s') <> '' AND SUBSTR(last_name,2,1) = 't';
c)
SELECT first_name, last_name FROM employees WHERE INSTR(first_name,'e') IS NOT NULL AND SUBSTR(last_name,2,1) = 't';
d)
SELECT first_name, last_name FROM employees WHERE INSTR(first_name,'e') <> 0 AND SUBSTR(last_name,LENGTH(first_name),1) =  
't';
4.

Which of the following statements is true regarding the COUNT function? (Select all that apply)

a)

COUNT (*) counts duplicate values and NULL values in columns of any data type.

b)

COUNT function cannot work with DATE datatypes.

c)

COUNT (DISTINCT job_id) returns the number of rows excluding rows containing duplicates and NULL values in the job_id column.

d)

A SELECT statement using the COUNT function with a DISTINCT keyword cannot have a WHERE clause.

5.

Examine the structure of the EMPLOYEES table as given. What will be the outcome of the following query?



SELECT last_name, NVL(job_id, 'Unknown') 
FROM employees
WHERE last_name LIKE 'A%'
ORDER BY last_name;
a)

It will throw an ORA error on execution.

b)

It will list the job IDs for all employees from EMPLOYEES table.

c)

It will list the job IDs of all employees and substitute NULL job IDs with a literal 'Unknown'.

d)

It will display the last names for all the employees and their job IDs including the NULL values in the job ID.

6.

What will be the outcome of the following query? (Consider the structure of the EMPLOYEES table as given)

SELECT employee_id , NVL(salary, 0) FROM employees WHERE first_name like 'P%' ORDER BY first_name;
a)

It will display 0 in the salary column for all the employees whose first name starts with a 'P'

b)

It will display the salaries for the employees whose name start with a 'P' and 0 if the salaries are NU

c)

It will throw an ORA error as the ORDER BY clause should also contain the salary column.

d)

The NVL function should be correctly used as NVL (0, salary)

7.

What will be the outcome of the following query? (Consider the structure of the EMPLOYEES table as given)

SELECT NVL2(job_id,'Regular Employee','New Joinee') FROM employees;
a)

It will return the value 'Regular Employee' for all the employees who have NULL job IDs

b)

It will return the value 'New Joinee' for all the employees who have NULL job IDs

c)

It will return 'Regular Employee' if the job ID is NULL

d)

It will throw an ORA error on execution.

8.

Examine the structure of the EMPLOYEES table as given.

What will be the outcome of the query mentioned below?


SeLECT first_name, salary, NVL2(commission_pct,  salary + (salary * commission_pct), salary) "Income" 
FROM employees 
WHERE first_name like 'P%'  
ORDER BY first_name;
a)

Salary will be returned if the Commission for the employee is NOT NULL.

b)

Commission_pct will be returned if the Commission for the employee is NOT NULL.

c)

Employees with the first name starting with 'P' and salary+(salary*commission_pct) will be returned if the employee earns a commission.

d)

The query throws an error because a mathematical expression is written inside NVL2.

9.

Examine the structure of the EMPLOYEES table as given. You need to create a report from the HR schema displaying employees who have changed jobs since they were hired. You execute the query given below.


SELECT e.last_name, NULLIF(e.job_id, j.job_id,"Old Job ID")  
FROM employees e, job_history j  
WHERE e.employee_id = j.employee_id  
ORDER BY last_name;

What will be the outcome of the query given above?

a)

It will display the old job ID when the new job ID is NULL.

b)

It will execute successfully and produce the required output.

c)

It will display the new job ID if the new job ID is equal to the old job ID

d)

It will throw an ORA error on execution.

10.

Which of the following queries will give the same result as given in the query given below?

SELECT CONCAT(first_name, last_name) FROM employees;

(Select all that apply)

a)

SELECT first_name||last_name FROM employees;

b)

SELECT first_name||' ' || last_name FROM employees;

c)

SELECT last_name||', '||first_name FROM employees;

d)

SELECT first_name||','||last_name FROM employees;

11.

What will be the outcome of the following query?

SELECT 'The job id for '||upper(last_name) ||' is a '||lower(job_id) FROM employees;

a)

The job id for ABEL is a sa_rep

b)

The job id forABEL is a sa_rep

c)

The job id for abel is SA_REP

d)

The job id for abel is sa_rep

12.

Assuming the last names of the employees are in a proper case in the table employees, what will be the outcome of the following query?

SELECT employee_id, last_name, department_id  FROM employees WHERE last_name = 'smith';
a)

It will display the details of the employee with the last name as Smith

b)

It will give no result.

c)

It will give the details for the employee having the last name as 'Smith' in all Lower case.

d)

It will give the details for the employee having the last name as 'Smith' in all INITCAP case.

13.

Examine the structure of the EMPLOYEES table as given. What will be the outcome of the following query?


SELECT upper(&jobid) FROM employees;

a)

It results in an error as substitution variables cannot be used with single row functions

b)

It prompts the user to input the jobid on each execution and then displays the job id in UPPER case

c)

It gives the jobid as it is present in the table EMPLOYEES without making any change

d)

It will not ask the user to input the job id and will convert all the job IDs in the table in UPPER case

14.

Examine the structure of the EMPLOYEES table as given here. You need to display the last name of all employees which starts with the letter 'A'. Which of the following queries will yield the required result? (Select all that apply)

a)
SELECT INITCAP (last_name||' works as a '||job_id "Job Description" FROM employees WHERE initcap (last_name) like 'A%';
b)
SELECT INITCAP (last_name) ||INITCAP(' works as a: ')|| INITCAP(job_id) "Job Description" FROM employees WHERE initcap (last_name) like 'A 
%';
c)
SELECT INITCAP (last_name||' works as a '||INITCAP(job_id)) "Job Description" FROM employees WHERE initcap (last_name) = 'A';
d)
SELECT UPPER (LOWER (last_name||' works as a '||job_id)) "Job Description" FROM employees WHERE lower (last_name) = 'A';
15.

Examine the structure of the EMPLOYEES table as given here. You need to generate a report which shows the first name, last name and the salary for all the employees in the department 100. The report should show the results in the form 'Andy Smith earns 50000'. Which of the following queries will give the required output? (Select all that apply)

a)

SELECT concat (first_name,concat (' ', concat(last_name, concat(' earns ', SALARY)))) Concat_String FROM employees WHERE department_id =

100;

b)

SELECT concat (first_name, last_name||' '|| salary) FROM employees WHERE department_id = 100;

c)

SELECT concat (first_name, concat(last_name, ' '))||earns||salary FROM employees WHERE department_id = 100;

d)

SELECT concat (first_name, concat(last_name, 'earns salary') FROM employees WHERE department_id = 100;

16.

You need to extract a consistent 15 character string based on the SALARY column in the EMPLOYEES table. If the SALARY value is less than 15 characters long, zeros must be added to the left of the value to yield a 15 character string. Which query will fulfill this requirement?

a)
SELECT rpad(salary, 15,0) FROM employees;
b)
SELECT lpad(salary,15,0) FROM employees;
c)
SELECT ltrim(salary,15,0) FROM employees;
d)
SELECT trim(salary,15,0) FROM employees;
17.

You need to display the last 2 characters from the FIRST_NAME column in the EMPLOYEES table without using the LENGTH function. Which of the following queries can fulfill this requirement? (Select all that apply)

a)

SELECT SUBSTR(first_name, 2) FROM employees;

b)

SELECT SUBSTR(first_name, -2) FROM employees;

c)

SELECT RTRIM(first_name, 2) FROM employees;

d)

SELECT TRIM(first_name, 2) FROM employees;

18.

Examine the structure of the EMPLOYEES table as given here. You need to retrieve the first name, last name (separated by a space) and the formal names of employees where the combined length of the first name and last name exceeds 15 characters. A formal name is formed by the first letter of the First Name and the first 14 characters of the last name. Which of the following queries will fulfill this requirement? (Select all that apply)

a)

SELECT first_name, last_name ,SUBSTR(first_name, 1,1)||' '||SUBSTR(last_name, 1,14) formal_name FROM employees;

b)

SELECT first_name, last_name ,SUBSTR(first_name, 1,14)||' '||SUBSTR(last_name, 1,1) formal_name FROM employees WHERE length

(first_name) + length(last_name) < 15;

c)

SELECT first_name, last_name ,SUBSTR(first_name, 1,1)||' '||SUBSTR(last_name, 1,14) formal_name FROM employees WHERE length

(first_name) + length(last_name) =15;

d)

SELECT first_name, last_name ,SUBSTR(first_name, 1,1)||' '||SUBSTR(last_name, 1,14) formal_name FROM employees WHERE length

(first_name) + length(last_name) > 15;

19.

Examine the structure of the EMPLOYEES table as given below. You need to allocate the first 12 employees to one of the four teams in a round-robin manner. The employee IDs start with a 100. Which of the following queries will fulfill the requirement? (Select all that apply)

a)

SELECT * FROM employees WHERE employee_id between 100 and 111 ORDER BY employee_id;

b)

SELECT first_name, last_name, employee_id, mod(employee_id, 4) Team# FROM employees WHERE employee_id between 100 and 111

ORDER BY employee_id;

c)

SELECT first_name, last_name,mod(employee_id, 2) Team# FROM employees WHERE employee_ID <> 100;

d)

SELECT first_name, last_name, mod(employee_id, 4) Team# FROM employees WHERE employee_ID = 100;

20.

Which of the following commands is used to count the number of rows and non-NULL values in Oracle database? (Select all that apply)

a)

NOT NULL

b)

INSTR

c)

SUBSTR

d)

COUNT

21.
What will be the outcome of the query given below? SELECT 100+NULL+999 FROM dual;
a)
100
b)
999
c)
NULL
d)
1099
22.

Which of the following statements are true regarding the single row functions? (Select all that apply)

a)

They accept only a single argument.

b)

They can be nested only to two levels.

c)

Arguments can only be column values or constants.

d)

They can return a data type value different from the one that is referenced.

23.

Which of the below queries will format a value 1680 as $16,80.00? (Select all that apply)

a)

SELECT TO_CHAR(1680.00,'$99G99D99') FROM dual;

b)

SELECT TO_CHAR(1680.00,'$9,999V99') FROM dual;

c)

SELECT TO_CHAR(1680.00,'$9,999D99') FROM dual;

d)

SELECT TO_CHAR(1680.00,'$99G999D99') FROM dual;

24.
Determine the output of the below query. SELECT RPAD(ROUND('78945.45'),10,'*') FROM dual;
a)
78945*****
b)
**78945.45
c)
The function RPAD cannot be nested with other functions
d)
78945.45****
25.

Which of the following commands allows you to substitute a value whenever a NULL or non-NULL value is encountered in an SQL query? (Select all that apply)

a)

NVL

b)

NVLIF

c)

NVL2

d)

LNNVL

26.

Which of the following type of single-row functions cannot be incorporated in Oracle DB? (Select all that apply)

a)

Character

b)

Numeric

c)

Conversion

d)

None of the above

27.

Out of the below clauses, where can the single-row functions be used?

a)

SELECT

b)

WHERE

c)

ORDER BY

d)

All of the above

28.

What is true regarding the NVL function in Oracle DB? (Select all that apply)

a)

The syntax of NVL is NVL (exp1, exp2) where exp1 and exp2 are expressions.

b)

NVL (exp1, exp2) will return the value of exp2 if the expression exp1 is NULL.

c)

NVL (exp1, exp2) will return the value of the expression exp2 if exp1 is NOT NULL.

d)

NVL (exp1, exp2) will return exp1 if the expression exp2 is NULL.

29.
What will the outcome of the following query? SELECT NVL (NULL,'1') FROM dual;
a)
NULL
b)
1
c)
0
d)
Gives an error because NULL cannot be explicitly specified to NVL function
30.

Which of the following statements is true regarding the NVL statement? SELECT NVL (arg1, arg2) FROM dual; (Select all that apply)

a)

The two expressions arg1 and arg2 should only be in VARCHAR2 or NUMBER data type format.

b)

The arguments arg1 and arg2 should have the same data type

c)

If arg1 is VARCHAR2, then Oracle DB converts arg2 to the datatype of arg1 before comparing them and returns VARCHAR2 in the character set of arg1.

d)

An NVL function cannot be used with arguments of DATE datatype.

31.

Which of the following is true for the statement given as under. NVL2 (arg1, arg2, arg3) (Select all that apply)

a)

Arg2 and Arg3 can have any data type

b)

Arg1 cannot have the LONG data type

c)

Oracle will convert the data type of expr2 according to Arg1

d)

If Arg2 is a NUMBER, then Oracle determines the numeric precedence, implicitly converts the other argument to that datatype, and returns that datatype.

32.

What is true about the NULLIF function in Oracle DB? (Select all that apply)

a)

NULLIF(expr1,expr2) will return expr2 if the two expressions are NOT NULL.

b)

NULLIF(expr1,expr2) will return 0 if the two expressions are NULL.

c)

NULLIF(expr1,expr2) will return NULL if the two expressions are equal.

d)

Expr1 can be NULL in NULLIF(expr1, expr2)

33.

Pick the correct answer(s) given after the statement shown as under. NULLIF (arg1,arg2) (Select all that apply)

a)

Arg1 and Arg2 can be of different data types.

b)

Arg1 and Arg2 have to be equal in order to be used in the NULLIF function.

c)

There is no internal conversion of data types if NULLIF used as in the case of NVL and NVL2.

d)

This is equivalent to CASE WHEN Arg1 = Arg22 THEN NULL ELSE Arg1 END.

34.

Which of the following is not a property of functions? (Select all that apply)

a)

Perform calculations on data

b)

Convert column data types

c)

Modify individual data items

d)

None of the above

35.
What is the most appropriate about single row functions?
a)
They return no value
b)
They return one result per row and operate on all the rows of a table.
c)
They return one result per row with input arguments
d)
They return one result per set of rows and operate on multiple rows.
36.
What among the following is a type of Oracle SQL functions?
a)
Multiple-row functions
b)
Single column functions
c)
Single value functions
d)
Multiple columns functions
37.
What among the following is a type of single-row function? (Select all that apply)
a)
VARCHAR2
b)
Character
c)
LONG
d)
NULLIF
38.
What is the most appropriate about Multiple Row Functions?
a)
They return multiple values per each row. 
b)
They return one result per group of rows and can manipulate groups of rows. 
c)
They return one result per row and can manipulate groups of rows. 
d)
They return multiple values per a group of row.
39.
Which of the following are also called Group functions?
a)
Single row functions
b)
Multi group functions
c)
Multiple row functions
d)
Single group functions.
40.
Which of the following is true about Single Row Functions?
a)
They can be nested
b)
They accept arguments and return more than one value.
c)
They cannot modify a data type
d)
They cannot accept expressions as arguments.
41.
What is the number of arguments Single Row functions accept?
a)
0
b)
Only 1
c)
Only 2
d)
1 or more than 1
42.
Which of the following can be an argument for a Single Row Function?
a)
Data types
b)
SELECT statements
c)
Expression
d)
Table name
43.
What is true about Character functions?
a)
They return only character values
b)
They accept NUMBER values
c)
They accept character arguments and can return both character and number values
d)
They accept values of all data type
44.
What is true about Number functions?
a)
They return both Character as well as Number values
b)
They can't accept expressions as input
c)
Number functions can't be nested.
d)
They accept Number arguments and return Number values only.
45.
Which of the following is an exception to the return value of a DATE type single-row function?
a)
TO_DATE
b)
SYSDATE
c)
MONTHS_BETWEEN
d)
TO_NUMBER
46.
Which of the following is not a Conversion type Single Row function?
a)
TO_CHAR
b)
TO_DATE
c)
NVL
d)
TO_NUMBER
47.
Which of the following is a Case-Conversion Character function?
a)
CONCAT
b)
SUBSTR
c)
INITCAP
d)
REPLACE
48.
What will be the outcome of the following query? SELECT lower('HI WORLD !!!') FROM dual;
a)
Hi World !!!
b)
Hi WORLD !!!
c)
hi world !!!
d)
HI WORLD !!!
49.
What will be the outcome of the following query? SELECT lower(upper(initcap('Hello World') )) FROM dual;
a)
Hello World
b)
HELLO world
c)
hello World
d)
hello world
50.
What is true about the CONCAT function in Oracle DB?
a)
It can have only characters as input.
b)
It can have only 2 input parameters.
c)
It can have 2 or more input parameters
d)
It joins values by putting a white space in between the concatenated strings by default.
51.
What is true about the SUBSTR function in Oracle DB?
a)
It extracts a string of determined length
b)
It shows the length of a string as a numeric value
c)
It finds the numeric position of a named character
d)
It trims characters from one (or both) sides from a character string
52.
What will be the outcome of the following query? SELECT length('hi') FROM dual;
a)
2
b)
3
c)
1
d)
hi
53.
What is the difference between LENGTH and INSTR functions in Oracle DB?
a)
They give the same results when operated on a string.
b)
LENGTH gives the position of a particular character in a string
c)
INSTR gives the position of a particular character in a string while LENGTH gives the length of the string.
d)
LENGTH and INSTR can be used interchangeably.
54.
What is false about the table DUAL in Oracle database?
a)
It is owned by the user SYS and can be access by all the users.
b)
It contains only one column and one row.
c)
The value in the DUMMY column of the DUAL table is 'X'
d)
The DUAL table is useful when you want to return a value only once
55.
What will be the result of the following query? SELECT sysdate+4/12 FROM dual;
a)
The query produces error.
b)
No of hours to a date with date as the result.
c)
Sysdate arithmetic is ignored.
d)
Returns the system date as result.
56.
What will be the outcome of the following query? SELECT lower (100+100) FROM dual;
a)
100
b)
100+100
c)
ORA error
d)
200
57.
What will be the outcome of the following query if the SYSDATE = 20-MAY-13? SELECT upper (lower (sysdate)) FROM dual;
a)
20-may-2013
b)
ORA error as LOWER and UPPER cannot accept date values.
c)
20-MAY-13
d)
20-May-13
58.
What is the result of the following query? SELECT INITCAP (24/6) FROM dual;
a)
4
b)
24
c)
24/6
d)
No result
59.
Assuming the SYSDATE is 20-FEB-13, What will be the outcome of the following query? SELECT CONCAT ('Today is :', SYSDATE) FROM dual;
a)
Today is : 20-feb-13
b)
The query throws error of incompatible type arguments.
c)
Today is : 20-Feb-13
d)
Today is : 20-FEB-13
60.
What will be the result pattern of the following query? SELECT CONCAT(first_name, CONCAT (last_name, job_id)) FROM dual;
a)
First_namelast_namejob_id
b)
First_name, last_name, job_id
c)
Error as CONCAT cannot be nested
d)
First_namelast_name, job_id
61.
What will the following query show as a result? SELECT LENGTH('It is a lovely day today!') FROM dual;
a)
25
b)
19
c)
20
d)
0
62.
You need to display the country name from the COUNTRIES table. The length of the country name should be greater than 5 characters. Which of the following queries will give the required output?
a)
SELECT country_name FROM countries WHERE LENGTH (country_name)= 5;
b)
SELECT country_name FROM countries WHERE length (country_name)> 5;
c)
SELECT SUBSTR(country_name, 1,5) FROM countries WHERE length (country_name)< 5;
d)
SELECT country_name FROM countries WHERE length (country_name) <> 5;
63.
How does the function LPAD works on strings?
a)
It aligns the string to the left hand side of a column
b)
It returns a string padded with a specified number of characters to the right of the source string
c)
It aligns character strings to the left and number strings to right of a column
d)
It returns a string padded with a specified number of characters to the left of the source string
64.
Which of the following options is true regarding LPAD and RPAD functions?
a)
The character strings used for padding include only characters.
b)
The character strings used for padding include only literals
c)
The character strings used for padding cannot include expressions.
d)
The character strings used for padding include literals, characters and expressions.
65.
What is the maximum number of input arguments in LPAD and RPAD functions?
a)
1
b)
2
c)
3
d)
0
66.
What will be the outcome of the following query? SELECT lpad (1000 +300.66, 14, '*') FROM dual;
a)
*******1300.66
b)
1300*******
c)
1300.66
d)
****1300.66
67.
What is true regarding the TRIM function?
a)
It is similar to SUBSTR function in Oracle
b)
It removes characters from the beginning or end of character literals, columns or expression
c)
TRIM function cannot be applied on expressions and NUMBERS
d)
TRIM function can remove characters only from both the sides of a string.
68.
You need to remove the occurrences of the character '.' and the double quotes '"' from the following titles of a book present in the table MAGAZINE. "HUNTING THOREAU IN NEW HAMPSHIRE" THE ETHNIC NEIGHBORHOOD." Which of the following queries will give the required result?
a)
SELECT LTRIM(Title,'"') FROM MAGAZINE;
b)
SELECT LTRIM(RTRIM(Title,'."'),'"') FROM MAGAZINE;
c)
SELECT LTRIM (Title,'"THE') FROM MAGAZINE;
d)
SELECT LTRIM(RTRIM(Title,'."THE'),'"') FROM MAGAZINE;
69.
Which of the following queries will give the required result? SELECT INSTR('James','x') FROM dual;
a)
1
b)
2
c)
0
d)
3
70.
What will be the outcome of the following query? SELECT INSTR('1$3$5$7$9$','$',3,4)FROM dual;
a)
2
b)
10
c)
7
d)
4
71.
What will be the result of the following query? SELECT INSTR('1#3#5#7#9#', -3,2) FROM dual;
a)
#5
b)
#3
c)
#7
d)
#9
72.
Assuming the SYSDATE is 13-JUN-13, what will be the outcome of the following query? SELECT SUBSTR(sysdate,10,7) FROM dual;
a)
3
b)
N-13
c)
0
d)
NULL
73.
Which of the following is used to replace a specific character in a given string in Oracle DB?
a)
LTRIM
b)
TRIM
c)
TRUNC
d)
REPLACE
74.
What will be the outcome of the following query? SELECT replace(9999.00-1,'8',88) FROM dual;
a)
999
b)
9998
c)
99988
d)
9999.88
75.
What will be the outcome of the following query? SELECT round(148.50) FROM dual;
a)
148.50
b)
140
c)
150
d)
149
76.
Assuming the sysdate is 10-JUN-13, What will be the outcome of the following query? SELECT trunc (sysdate,'mon') FROM dual;
a)
10-JUN-13
b)
1-JUN-13
c)
ORA error as the TRUNC function can't have an input parameter when used with dates.
d)
31-JUN-13
77.
What will be the result of the following query? SELECT trunc(1902.92,-3) FROM dual;
a)
2000
b)
1000
c)
1901
d)
1901.00
78.
What is the syntax of the MOD function in Oracle DB?
a)
Mod(divisor,dividend)
b)
MOD(divisor,1)
c)
MOD(dividend,divisor)
d)
None of the above
79.
What will be outcome of the following query? SELECT mod(100.23,-3) FROM dual;
a)
ORA error
b)
1.23
c)
100
d)
0
80.
Which of the following functions are used to differentiate between even or odd numbers in Oracle DB?
a)
ROUND
b)
TRUNC
c)
MOD
d)
REPLACE
81.
What will be the outcome of the following query? SELECT SUBSTR('Life is Calling',1) FROM dual;
a)
ORA error as there should be minimum 3 arguments to the SUBSTR function.
b)
Life is Calling
c)
NULL
d)
Life
82.
What is the default data format for the sysdate in SQL Developer?
a)
DD-MON-YY
b)
DD-MON-RR
c)
DD/MON/RR
d)
DD/MON/YYYY
83.
Assuming the SYSDATE to be 10-JUN-2013 12:05pm, what value is returned after executing the below query? SELECT add_months(sysdate,-1) FROM dual;
a)
09-MAY-2013 12:05pm
b)
10-MAY-2013 12:05pm
c)
10-JUL-2013 12:05pm
d)
09-JUL-2013 12:05pm
84.
What value will be returned after executing the following statement? Note that 01-JAN-2013 occurs on a Tuesday. SELECT next_day('01-JAN-2013','friday') FROM dual;
a)
02-JAN-2013
b)
Friday
c)
04-JAN-2013
d)
None of the above
85.
What is the maximum number of parameters the ROUND function can take?
a)
0
b)
1
c)
2
d)
3
86.
Assuming the present date is 02-JUN-2007, what will be the century returned for the date 24-JUL-2004 in the DD-MON-RR format?
a)
19
b)
21
c)
20
d)
NULL
87.
Assuming the present date is 02-JUN-2007, what will be the century returned for the date 24-JUL-94 in the DD-MON-RR format
a)
19
b)
21
c)
20
d)
NULL
88.
Assuming the present date is 02-JUN-1975, what will be the century returned for the date 24-JUL-94 in the DD-MON-RR format?
a)
19
b)
21
c)
20
d)
NULL
89.
Assuming the present date is 02-JUN-1975, what will be the century returned for the date 24-JUL-07 in the DD-MON-RR format?
a)
19
b)
21
c)
20
d)
NULL
90.
How many parameters does the SYSDATE function take?
a)
1
b)
2
c)
4
d)
0
91.
What is true about the SYSDATE function in Oracle DB?
a)
It returns only the system date
b)
It takes 2 parameters at least.
c)
The default format is DD-MON-YY
d)
The default format of SYSDATE is DD-MON-RR and it returns the date and time of the system according to the database server.
92.
What will be the datatype of the result of the following operation? "Date3 = Date1-Date2"
a)
Date
b)
Num1
c)
0
d)
NULL
93.
What will be the datatype of the result of the following operation? "Date2 = Date1-Num1"
a)
Date
b)
Num2
c)
1
d)
NULL
94.
What does a difference between two dates represent in Oracle DB?
a)
The number of days between them
b)
Difference in dates in not possible in Oracle DB
c)
A date
d)
NULL
95.
What will be the outcome of the following query? SELECT months_between('21-JUN-13','19-JUN-13') FROM dual;
a)
ORA error
b)
A positive number
c)
A negative number
d)
0
96.
What can be deduced if the result of MONTHS_BETWEEN (start_date,end_date) function is a fraction?
a)
It represents the difference in number between the start date and end date.
b)
The result cannot be a fractional number, it has to be a whole number.
c)
NULL
d)
It represents the days and the time remaining after the integer difference between years and months is calculated and is based on a 31-day month.
97.
You are connected to a remote database in Switzerland from India. You need to find the Indian local time from the DB. Which of the following will give the required result?
a)
SELECT sysdate FROM dual;
b)
SELECT round(sysdate) FROM dual;
c)
SELECT trunc (sysdate) FROM dual;
d)
SELECT current_date FROM dual;
98.
What will be the outcome of the following query? SELECT months_between (to_date ('29-feb-2008'), to_date ('29-feb-2008 12:00:00','dd-mon-yyyy hh24:mi:ss'))*31 FROM dual;
a)
Approximately 0
b)
1
c)
The query will throw an ORA error
d)
0.5 days
99.
What will be the outcome of the following query? SELECT add_months ('31-dec-2008',2.5) FROM dual;
a)
31-feb-2009
b)
28-feb-2009
c)
31-mar-2009
d)
15-jan-2009
100.
You need to identify the date in November when the staff will be paid. Bonuses are paid on the last Friday in November. Which of the following will fulfill the requirement?
a)
SELECT next_day ('30-nov-2012' , 'Friday') FROM dual;
b)
SELECT next_day ('30-nov-2012' , 'Friday') -7 FROM dual;
c)
SELECT last_day ('01-nov-2012' ) FROM dual;
d)
SELECT next_day ('30-nov-2012' , 'sat') -1 FROM dual;