0% found this document useful (0 votes)
1 views17 pages

SQL Questions Sample 2020

Uploaded by

nasreen
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
Download as xlsx, pdf, or txt
0% found this document useful (0 votes)
1 views17 pages

SQL Questions Sample 2020

Uploaded by

nasreen
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1/ 17

QUESTION_ID QUESTION IMAGE_PATH

1 Which of the following is incorrect cursor attribute.


2 Cursor attribue %ROWCOUNT returns.
3 Cursor attribue %ISOPEN returns.
4 Cursor attribue %FOUND returns.
5 Cursor attribue %NOTFOUND returns.
6 When did cursor attribute %ROWCOUNT assigned a value.
7 When did cursor attribute %ISOPEN assigned a value.
8 Function retun the value.
9 Stored Procedure return the values
10 Which of the following is incorrect Predefined Exception.
11 BEGIN
DBMS_OUTPUT.PUT_LINE(TRUE);
END;
/

12 BEGIN
DBMS_OUTPUT.PUT_LINE('TRUE');
END;
/

13 BEGIN
DBMS_OUTPUT.PUT_LINE('My First Program');
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('Error');
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('Error');
END;
/

14 PL/SQL provides a feature to handle the Exceptions which occur in a


PL/SQL Block known as exception Handling.
15 Which Exception is also known as Oracle named exception handler?

16 Which Package lets you use database triggers to alert an application


when specific database values change?
17 Which statement lets you create standalone functions that are stored in
an Oracle database?
18 Which parameter acts like a constant inside the subprogram?
19 Which of the following is used to define code that is executed / fired
when certain actions or event occur?
20 How many attributes does every explicit cursor and cursor variable have?

21 How many nested IF clauses can be included within an IF clause?


22 PL/SQL stands for
23 BEGIN
IF NULL = NULL THEN
DBMS_OUTPUT.PUT_LINE('First statment');
ELSE
DBMS_OUTPUT.PUT_LINE('Second statement');
END IF;
END;
/

24 Which of the following statements is true about implicit cursors?


25 Which of the following is not a feature of a cursor FOR loop?
26 A developer would like to use referential datatype declaration on a
variablE. The variable name is EMPLOYEE_LASTNAME, and the
corresponding table and column is EMPLOYEE, and LNAME, respectively.
How would the developer define this variable using referential
datatypes?

27 Which three of the following are implicit cursor attributes?


28 If left out, which of the following would cause an infinite loop to occur in
a simple loop?
29 What happens when rows are found using a FETCH statement
30 Which of the following can be used as an argument for a procedure
parameter?
31 If you don’t specify a mode for a parameter, what is the default mode?

32 Which kind of parameters cannot have a DEFAULT value?


33 What are the three parameter modes for procedures?
34 Which one of the following statements about formal and actual
parameters is true?
35 DECLARE
l_count NUMBER;
BEGIN
SELECT count(1) into l_count FROM EMP WHERE 1=2;
DBMS_OUTPUT.PUT_LINE(l_count);
END;
/

36 DECLARE
l_count NUMBER;
BEGIN
SELECT count(1) into l_count FROM EMP WHERE 1=1;
DBMS_OUTPUT.PUT_LINE(l_count);
END;
/
37 SET SERVEROUTPUT on;
DECLARE
CURSOR emp_cur
IS SELECT * FROM EMP;
emp_rec emp%ROWTYPE;
BEGIN

OPEN emp_cur;

LOOP
FETCH emp_cur INTO emp_rec;
DBMS_OUTPUT.PUT_LINE(emp_rec.empno);
END LOOP;
CLOSE emp_cur;
END;
/

38 DECLARE
CURSOR emp_cur
IS SELECT * FROM EMP;
emp_rec emp%ROWTYPE;
BEGIN

OPEN emp_cur;

LOOP
FETCH emp_cur INTO emp_rec;
DBMS_OUTPUT.PUT_LINE(emp_rec.empno);
EXIT WHEN emp_cur%NOTFOUND;
END LOOP;
CLOSE emp_cur;
END;
/

39 BEGIN
UPDATE EMP
SET SAl=SAL*10
WHERE 734=734
;
DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT);
END;
/
40 SET SERVEROUTPUT on;
DECLARE
l_number NUMBER;
BEGIN
l_number:='Hello';
DBMS_OUTPUT.PUT_LINE(l_number);
END;
/

41 DECLARE
l_number NUMBER:=2;
BEGIN
l_number:=3;
DBMS_OUTPUT.PUT_LINE(l_number);
END;
/

42 SET SERVEROUTPUT on;


DECLARE
l_number NUMBER:=2;
BEGIN
DECLARE
l_number NUMBER;
BEGIN

l_number:=3;
END;
DBMS_OUTPUT.PUT_LINE(l_number);
END;
/

43 SET SERVEROUTPUT on;


DECLARE
l_number NUMBER:=2;
BEGIN
BEGIN

l_number:=3;
END;
DBMS_OUTPUT.PUT_LINE(l_number);
END;
/

44 PL SQL Architecture contains


45 Which one of the following is not PL SQL data type.
46 Select the incorrect variable declaration.
47 Where do you declare an explicit cursor in the PL/SQL language.
48 Which one of the named block called in SELECT statement.
49 Which one of the named block, we cannot use COMMIT.
50 Types of triggers in Oracle
OPTION1 (A) OPTION2 (B) OPTION3 © OPTION4 (D) OPTION5 (E)
%FOUND %ISOPEN %OPEN %NOTFOUND
Integer String Boolean Null
Integer String Boolean Null
Integer String Boolean Null
Integer String Boolean Null
DDL command executTCL command executio DML command executAll the three commands execution.
Cursor declaration Cursor open Cursor close None of these
31-Dec-1899 FALSE May be None of these
31-Dec-1899 FALSE May be None of these
NO_DATA_FOUND INVALID_NUMBER TOO_MANY_ROWS INVALID_STRING
31-Dec-1899 NULL compilation error None of these

31-Dec-1899 NULL compilation error None of these

Null My First Program compilation error None of these

31-Dec-1899 0

Predefined Exception Internal Exception User defined Exceptio None of the above

DBMS_OUTPUT DBMS_ALERT DBMS_PIPE All mentioned abov

SQL CREATE PROCEDUSQL CREATE FUNCTION Both A & B None of the above

IN OUT Both A & B None of the above


Replace Keyword Trigger Cursor

2-Jan-1900 2 4 5

31-Dec-1899 0 15 Any number


Programming LanguagProcedural Language/S Portable Language/SQNone of the above
First statment Second statement NULL None of the above

Implicit cursors are Developers should use imImplicit cursors are us Implicit cursors are no longer a feature in Oracle
Record type declarati Opening and parsing of Fetches records from cRequires exit condition to be defined
Use employeE.lname Use employeE.lname%rLook up datatype for Declare it to be type LONG

%found %too_many_rows %notfound %rowcount


LOOP END LOOP IF-THEN EXIT

It causes the cursor toIt causes the cursor to It loads the current ro It creates the variables to hold the current row values
The name of a variablA literal value An expression All of the above None of the above

OUT IN COPY DEFAULT

OUT IN CONSTANT
IN OUT IN OUT All the three
Formal and actual pa Formal and actual paramA formal parameter is An actual parameter is declared within the called proc

Total records count in1 0 NULL

Total records count in1 0 NULL


Total records count inZero records displayed One record displayes Infinate loop

Total records count inZero records displayed One record displayes Infinate loop

Total records count in0 1 734


Hello l_number Null Compilation error

2 3 5 Null

2 3 5 0

2 3 5 0

PL SQL Block PL SQL Engine Database Server All the three


Scalar LOB Composite Integer
l_name varchar2(20); l_number number; l_name cha(20); l_name varchar2(5):='Ramesh';
Executable section Exception section Declaration section All the three
Procedure Function Trigger Package
Procedure Function Trigger Package
1 2 3 4
CORRECT_OPTION SECTION COMPLEX CREATION_DATE CREATED_BY
PL SQL Simple
PL SQL Medium
PL SQL Medium
PL SQL Medium
PL SQL Medium
ds execution. PL SQL High
PL SQL High
PL SQL Medium
PL SQL Medium
PL SQL Medium
PL SQL High

PL SQL High

PL SQL High

PL SQL Medium

PL SQL Simple

PL SQL Simple

PL SQL Simple

PL SQL Simple
PL SQL Simple

PL SQL Simple

PL SQL Medium
PL SQL Simple
PL SQL High

o longer a feature in Oracle PL SQL Medium


n to be defined PL SQL Medium
PL SQL Medium

PL SQL Medium
PL SQL Medium

s to hold the current row values PL SQL Medium


ne of the above PL SQL Medium

PL SQL Simple

PL SQL Medium
PL SQL Medium
s declared within the called proc PL SQL Medium

PL SQL Medium

PL SQL Medium
PL SQL High

PL SQL High

PL SQL Medium
PL SQL High

PL SQL Simple

PL SQL Medium

PL SQL Medium

PL SQL Simple
PL SQL Simple
PL SQL Simple
PL SQL Simple
PL SQL Simple
PL SQL Simple
PL SQL Simple
CATEGORY

You might also like