Oracle SQL Functions and Queries

Tests knowledge of Oracle SQL string functions (TRANSLATE, REPLACE, INSTR), numeric operations, set operations (UNION ALL, MINUS), and error handling with DUAL table queries.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

How many rows records the following query will display.. select * from TEMP where rownum in (1,3,3,2) N.R. Temp table has 30 records

  1. NULL
  2. 1 row
  3. 3 rows
  4. 4 rows
  5. 0 row
Question 2 Multiple Choice (Single Answer)

select '1'+'1' from dual ; The o/p would be..

  1. 2
  2. 1+1
  3. Error: invalid number
  4. Error: invalid Character
  5. Error: invalid identifier
Question 3 True/False

The o/p of the below two queries would be same.. 1.select '1'+1 from dual; 2.select 1+1 from dual;

  1. True
  2. False
Question 4 Multiple Choice (Single Answer)

O/p of the below query ?? select 'a''a' from dual;

  1. aa
  2. a a
  3. a'a
  4. Error: invalid identifier
  5. Error: invalid character
Question 5 Multiple Choice (Single Answer)

select "aa" from dual ?

  1. Error: "aa":invalid identifier
  2. aa
  3. "aa"
  4. Error: invalid character
Question 6 Multiple Choice (Single Answer)

select dummy from dual ?

  1. NULL
  2. Error: invalid identifier
  3. X
  4. Error: invalid SQL Statemet
  5. A
Question 7 Multiple Choice (Single Answer)

select * from dual ?

  1. A
  2. X
  3. NULL
  4. Error: Invalid SQL statement
  5. Error: Invalid Identifier
Question 8 Multiple Choice (Single Answer)

select dummy from dual minus select * from dual what would be output ?

  1. No rows returned
  2. Error: invalid SQL statement
  3. Error: invalid identifier
  4. Error: syntax error
  5. 1 row
Question 9 Multiple Choice (Single Answer)

select version from dual ;

  1. Error: "VERSION": invalid identifier
  2. Error: "VERSION": invalid character
  3. Error: invalid SQL statement
  4. shows oracle database version
  5. Null
Question 10 Multiple Choice (Single Answer)

select expr(1/0) from dual; The o/p would be ..

  1. 0
  2. Error: divisor is equal to zero
  3. Error: Invalid Identifier
  4. NULL
Question 11 True/False

Output of the below two queries will be same.. 1.select nvl('abc','a') from dual; 2.select nvl('abc',0) from dual;

  1. True
  2. False
Question 12 Multiple Choice (Single Answer)

The o/p of the below query would be.. select nvl('abc','a') from dual union all select nvl('abc',0) from dual minus select replace('abc','a','a') from dual

  1. No rows returned
  2. abc
  3. Two rows of value 'abc'
  4. Error: Syntax error
Question 13 Multiple Choice (Single Answer)

select instr('Hi Partha Sarathi Ojha','a',6,-1) from dual; The output would be..

  1. Error: Syntax error
  2. 0
  3. 5
  4. Error: Argument '-1' is out of range
Question 14 Multiple Choice (Single Answer)

select instr('Hi Partha Sarathi Ojha','a',5) from dual; The o/p would be...

  1. 5
  2. 9
  3. 22
  4. 0
Question 15 Multiple Choice (Single Answer)

Want to search character 'a' from last in the string 'Hi Partha Sarathi Ojha'. So what would be the query...

  1. select instr('Hi Partha Sarathi Ojha',last,'a') from dual
  2. select instr('Hi Partha Sarathi Ojha','a',-1) from dual
  3. select instr('Hi Partha Sarathi Ojha',left,'a') from dual
  4. select instr('Hi Partha Sarathi Ojha',-1,'a') from dual
  5. select instr('Hi Partha Sarathi Ojha','-a') from dual
Question 16 Multiple Choice (Single Answer)

select translate('abcda','ab','ef') from dual; The o/p would be...

  1. efcda
  2. efcde
  3. ef
  4. ab
  5. 1
Question 17 Multiple Choice (Single Answer)

select replace('abcda','ab','ef') from dual ; The o/p would be..

  1. efcda
  2. efcde
  3. ef
  4. ab
  5. 1
Question 18 True/False

The o/p of the below two queries will be same ? 1.select translate('abcd','a','d') from dual; 2.select replace('abcd','a','d') from dual;

  1. True
  2. False
Question 19 Multiple Choice (Single Answer)

The o/p of the below query.. select 1/0 from dual ;

  1. Error: Syntax error
  2. INFINITY
  3. NULL
  4. 0
  5. Error: divisor is equal to zero
Question 20 Multiple Choice (Single Answer)

The o/p of the below query.. select 0/1 from dual group by dummy;

  1. 0
  2. 1
  3. NULL
  4. Error: divisor is equal to zero
  5. Error: Not a GROUP BY clause