Oracle PL/SQL and SQL Fundamentals
A comprehensive quiz covering Oracle PL/SQL syntax, SQL statements, cursor operations, loop constructs, NULL handling, and database concepts.
Questions
Which clause in a query limits the rows selected?
- ORDER BY
- FROM
- SELECT
- WHERE
The INTO clause is mandatory for SELECT statements within PL/SQL blocks.
- True
- False
PL/SQL blocks may be nested within exception block.
- True
- False
The following block statement will run successfully SCOTT.EMP.EMPNO := 1234;
- True
- False
5 + NULL evaluates to 5 and ‘PL/’ || NULL || ‘SQL’ evaluates to ‘PL/SQL’
- True
- False
what is the concatenation operator in dbms_output.put_line() function
- +
- |
- ||
- .
what will be the output of the following block: set serveroutput on; declare a int; b int; begin a:=NULL; b:=NULL; if a< b then dbms_output.put_line('y'); else dbms_output.put_line('n'); end if; end;
- y
- n
- error
- no output
which statement is used to break a loop in pl/sql
- exit
- break
- stop
- continue
which of the following lines is invalid: FOR i IN 1…256 LOOP --Line 1 x := x + i ; --Line 2 i := I + 5; --Line 3 END LOOP; --Line 4
- line 1
- line 2
- line 3
- line 4
which of the following is not an explicit cursor attribute
- %notfound
- %rowcount
- %isopen
- %isclose
DUP_VAL_ON_INDEX corressponds to which of the following error.
- ORA-01427
- ORA-01476
- ORA-00001
- ORA-01001
Which Database is oldest database in world ?
- fox pro
- oracle
- db2
- sql server
Which of the following statements contains an error?
- SELECT * FROM emp WHERE empid = 493945;
- SELECT empid FROM emp WHERE empid= 493945;
- SELECT empid FROM emp;
- SELECT empid WHERE empid = 56949 AND lastname = ‘SMITH’;
The user issues the following statement. What will be displayed if the EMPID selected is 60494? SELECT DECODE(empid,38475, “Terminated”,60494, “LOA”, “ACTIVE”) FROM emp;
- ACTIVE
- LOA
- TERMINATED
- 38475
The default character for specifying runtime variables in SELECT statements is :-
- percentage sign
- Quotation marks
- Ampersand
- Ellipses
Creating a foreign-key constraint between columns of two tables defined with two different datatypes will produce an error.
- True
- False
SELECT (TO_CHAR(NVL(SQRT(59483), “INVALID”)) FROM DUAL is a valid SQL statement.
- True
- False
Which function below can best be categorized as similar in function to an IF-THEN-ELSE statement?
- NEW_TIME
- Decode
- ROWIDTOCHAR
- SQRT
MAXVALUE is a valid parameter for sequence creation.
- True
- False
Dropping a table has which of the following effects on a nonunique index created for the table?
- No effect
- The index will be rendered invalid
- The index will be dropped
- The index will contain NULL values.