Oracle Test Part-03

 

21. Which operator will be evaluated first in the following statement?
Select (2+3*4/2-8) from dual:

a. +

b. 

c. /

d. *

Answer: d.

22. Which of the following SELECT statements should be used to extract the year from the system date to display it in the format “2001”?

a. SELECT TO_CHAR(SYSDATE, ‘yyyy’) FROM dual;

b. SELECT TO_DATE(SYSDATE, ‘yyyy’) FROM dual;

c. SELECT DECODE(SUBSTR(SYSDATE, 8), ‘YYYY’) FROM dual;

d. SELECT DECODE(SUBSTR(SYSDATE, 8), ‘year’) FROM dual;

e. SELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),’yyyy’) FROM dual;

Answer: a.

23. Evaluate the following SQL*Plus command: COLUMN emp_name HEADING ‘NAME’ FORMAT A25
Which tasks will this command accomplish?

  1. It will set the EMP_NAME column heading to ‘NAME’
  2. It will center the column heading of the EMP_NAME column
  3. It will limit the EMP_NAME column heading to 25 characters
  4. It will set the display width of the EMP_NAME column to 25
  5. It will display the current settings for the EMP_NAME column

Answer: a, d.

24. A database was queried with the following command:

SELECT name FROM employee WHERE name LIKE ‘_a%’;

Which names will be displayed?

  1. Names starting with “a”
  2. Names containing “a” as any letter except the first
  3. Names containing “a” as the second letter
  4. Names containing “a” as any letter except the first

Answer: c.

25. Evaluate the SQL statement given below: SELECT ROUND (45.953, -1), TRUNC (45.936, 2) FROM dual;
Which of the following values will be displayed?

a. 46 and 45.93

b. 50 and 45.93

c. 50 and 45.9

d. 45 and 45.93

e. 45.95 and 45.93

Answer: b.

26. An outer join is used when:

a. The tables being joined have NOT NULL columns

b. The tables being joined have only matched data.

c. The columns being joined have NULL values

d. The tables being joined have only unmatched data

e. The tables being joined have both matched and unmatched data

Answer: c, e.

27. Which SQL statement accepts user input for the columns to be displayed, table name, and the WHERE condition?

a. SELECT &1, “&2″FROM &3 WHERE last_name = ‘&4’;

b. SELECT &1, ‘&2’ FROM &3 WHERE ‘&last_name = ‘&4”;

c. SELECT &1, &2 FROM &3 WHERE last_name = ‘&4’;

d. SELECT &1, ‘&2’ FROM EMP WHERE last_name = ‘&4’;

Answer: d.

28. The value 12* salary* commission_pct has to be calculated for all the employees in the EMP table. Which of the following statements ensures that a value is displayed in the calculated column for all the employees?

a. SELECT last_name, 12 * salary* commission_pct FROM emp;

b. SELECT last_name, 12 * salary* (commission_pct,0) FROM emp;

c. SELECT last_name, 12 * salary* (nvl(commission_pct,0) FROM emp;

d. SELECT last_name, 12 * salary* (decode(commission_pct,0)) FROM emp;

Answer: c.

29. The titles of all the books that meet the following criteria has to be displayed: 1. Purchased before Feb 21, 2002
2. Price is less than $500 or greater than $900

The result has to be sorted by the date of purchase, starting with the most recently bought book.
Which of the following statements should be used?

a. SELECT book_title FROM books WHERE price between 500 and 900 AND purchase_date < ’21-FEB-2002′ ORDER BY purchase_date

b. SELECT book_title FROM books WHERE price IN (500, 900) AND purchase_date< ’21-FEB-2002′ ORDER BY purchase date ASC

c. SELECT book_title FROM books WHERE price <>900 AND purchase_date DESC

d. SELECT Book_title FROM books WHERE price <>900 AND purchase_date<’21-FEB-2002′ ORDER BY purchase date DESC

Answer: d.

30. Which character function should be used to return a specified portion of a character string?

a. CONCAT

b. LENGTH

c. SUBSTR

d. INITCAP

 

Comments

comments

Leave a Comment

Time limit is exhausted. Please reload CAPTCHA.