Upload
srinivas-gangavarapu
View
216
Download
0
Embed Size (px)
Citation preview
7/31/2019 OracleQP
1/32
P a g e | 1
ORACLE SQL & PL/SQL
Duration : 1hr 30min.
***************************************************************************
1) SQL is a
a) Non-Procedural Language
b) Procedural Language
c) Built in Language
d) User defined Language
2) TCL Stands for
a) TRASFORMASSION CONTROL LANGUAGE
b) TRANSACTION CONTROL LANGUAGE
c) TRANSACTION COLUMN LANGUAGE
3) SAVEPOINT comes under
a) DDL
b) DML
c) TCL
d) DCL
Examine the structure of the Employee table
EMPLOYEE_NO NUMBER,
EMPLOYEE_NAME VARCHAR2(20)
DEPARTMENT VARCHAR2(30)
SALARY NUMBER
4) To insert data into the above table which of the below
statements is correct?
7/31/2019 OracleQP
2/32
P a g e | 2
a) Insert in to employee (1,Sunitha,Software development,5000)
b) Insert in to employee values(1,Sunitha,Software
development,5000)
c) Insert into employee (employee_no,employee_name,salary)
values (1,Sunitha,5000)d) Insert into employee (employee_no,employee_name,salary)
values (1,Sunitha,Software Development)
5) Which Statement updates the Employee table without any error
for the employee_no 2
a) Update table Employee set Department=SD where
employee_no=2;
b) Update table Employee set Department=SD havingemployee_no=2
c) Update Employee set Department=SD Where employee_no=2;
d) Update Empoyee set Department=SD ;
6) Which Select Statement is correct for displaying the records
department wise?
a) Select * from employee group by dept
b) Select dept from employee group by dept
c) Select dept from employee;
d) Select dept from employee group by deptwise
7) What is the command to retrieve the records which belong
neither to the SD department nor to the Chennai City.
a) select * from employee where department =SD AND
City=Chennai
b) select * from employee where department =SD OR
City=Chennai
c) select * from employee where department =SD OR
City!=Chennai
d) select * from employee where department !=SD AND
City!=Chennai
7/31/2019 OracleQP
3/32
P a g e | 3
8) Which below statement will create a table without any error?
a) Create table employee (empno number,ename varchar2,deptid
number);
b) Create employee (empno number,ename varchar,deptid number);
c) Create employee (empno number,ename varchar2(50),deptidnumber);
d) Create table employee (empno number,ename
varchar2(50),deptid number DEFAULT 1);
9) To Drop a SALARY column in a Employee table which statement
is correct?
a) Alter table Drop column Employee.Salary;
b) Alter table Employee Drop salary;c) Alter table Employee Drop column salary;
d) Drop Employee.Salary;
10) What Select statement will fetch the records where
first_name starts with any character and second character
should be N and followed by any character?
a) Select * from employee where first_name =_N%;
b) Select * from employee where first_name like %N%
c) Select * from employee where first_name like _N%
d) Select * from employee where first_name like N%
11) What is the query to return records with first_name as
Neena or Steven?
a) Select * from employee where first_name like Neena or Steven
b) Select * from employee where first_name like (Neena , Steven)
c) Select * from employee where first_name in ( Neena , Steven)
d) Select * from employee where first_name in Neena , Steven
12) Which statement will list the employee names
alphabetically?
a) Select * from employee where employee_name asc
7/31/2019 OracleQP
4/32
P a g e | 4
b) Select * from employee order by employee_name
c) Select * from employee order by employee_name desc
d) Select employee_name from employee
13) Which statement retrieves salary with NULL Values?
a) Select * from employee where salary = Null
b) Select * from employee where salary IS NULL
c) Select * from employee where salary = IS NULL
d) Select * from employee where salary = -
14) You want to display the name,annual salary multiplied bycommission for all employees. For records that have a Null
Commision value, a 0 must be displayed against the calculated
column.
Which SQL Statement displays the desired result?
a) SELECT name,salary * commission from employees;
b) SELECT name,salary * ISNULL(commission,0) from employees;
c) SELECT name,salary * NVL2(commission,0) from employees;
d) SELECT name,salary * NVL(commission,0) from employees;
15) What is the output of Select CEIL(53.4) from dual?
a) 53
b) 54
c) 53.4
d) 60
16) What is the output of Select ROUND(533.27) from dual?
a) 533.27
b) 534
c) 533
d) 533.3
7/31/2019 OracleQP
5/32
P a g e | 5
17) What is the output of select SUBSTR(HELLO,2,3) FROM
DUAL?
a) HELLO
b) EL
c) ELLd) ELLO
18) What is the output of select INSTR('HELLO','L',1,2) FROM
DUAL
a) 1
b) 3
c) 2
d) 4
19) select MONTHS_BETWEEN('01-MAY-11','01-MAR-2011')
from dual
a) 2
b) 1
c) 01-APR-11
d) 01-may-11
20) Which below commands will replace NULL by some value?
a) NVL2(String/Column value,value1,value2)
b) Decode(String/Column value,searchvalue,replacevalue)
c) NVL(String/Column value,Value)
d) NULLIF(String/Column value,value)
21) Case Expression is similar to which below commands
a) SUBSTR
b) DECODE
c) IF THEN ELSIF..END IF
d) COALESCE
7/31/2019 OracleQP
6/32
P a g e | 6
Examine the table data and answer accordingly
EMPNO ENAME DEPARTMENT SALARY1 Anitha SD 50002 Mehta FIN 45003 Sneha SD 23004 Yaminee SD 35005 Shruthy HR 5500
22) SELECT EMPNO,ENAME, (CASE
when SD THEN SOFTWARE DEVELOPMENT
when FIN THEN FINANCEWhen HR THEN HUMAN RESOURCES
) DEPART,SALARY
FROM EMPLOYEE;
What is the output of the above query?
a)
EMPNO ENAME DEPART SALARY
1 Anitha SOFTWAREDEVELOPMENT
5000
2 Mehta FINANCE 4500
3 SnehaSOFTWAREDEVELOPMENT
2300
4 YamineeSOFTWAREDEVELOPMENT
3500
5 Shruthy HUMAN RESOURCES 5500
b)
EMPNO ENAME DEPART SALARY1 Anitha SD 50002 Mehta FIN 45003 Sneha SD 2300
7/31/2019 OracleQP
7/32
P a g e | 7
4 Yaminee SD 35005 Shruthy HR 5500
c)
EMPNO ENAME DEPART SALARY
1 AnithaSOFTWAREDEVELOPMENT
5000
2 Mehta FIN 4500
3 SnehaSOFTWAREDEVELOPMENT
2300
4 Yaminee HR 35005 Shruthy HR 5500
23) TRUNCATE TABLE EMP;
DELETE FROM EMP;
Will the outputs of the above two commands differ?
a) Yes
b) No
24) Which Clause is used to display row number with records?
a) Rowid
b) Row num
c) Rownum
d) Rownumber
25) Pick the Aggregate functions listed belowa) COUNT()
b) MAXIMUM()
c) GREATEST()
d) MIN()
7/31/2019 OracleQP
8/32
P a g e | 8
Examine the table data and answer accordingly
EMPNO ENAME DEPARTMENT SALARY1 Anitha SD 5000
2 Mehta FIN 45003 Sneha FIN 40004 Yaminee SD 35005 Shruthy HR 5500
26) Which Select statement selects the department wise
maximum salary having the maximum salary greater than 4000
a) SELECT MAXIMUM(SALARY) FROM EMPLOYEE WHERE
SALARY >4000 GROUP BY DEPARTMENTb) SELECT DEPARTMENT,MAX(SALARY) FROM EMPLOYEE
GROUP BY DEPARTMENT HAVING MAX(SALARY) >4000
c) SELECT DEPARTMENT,MAX(SALARY) FROM EMPLOYEE
GROUP BY DEPARTMENT WHERE MAX(SALARY) >4000
d) SELECT DEPARTMENT,MAX(SALARY) FROM EMPLOYEE
WHERE MAX(SALARY) >4000 GROUP BY DEPARTMENT
27) Which options are all Pseudocolumnsa) ROWID
b) CURRVAL
c) NULL
d) COUNT
28) Which option is to display the current date
a) CURRENT_DATE
b) CURDATEc) SYSTEM_DATE
d) SYSDATE
29) RDBMS Stands for
7/31/2019 OracleQP
9/32
P a g e | 9
a) Relational Database Management System
b) Rational Database Management System
c) Relational Database Mainframe System
d) Rational Database Modeling System
30) What operator performs pattern matching?
a) IN
b) ANY
c) ALL
d) LIKE
31) Which SET Operator returns all the distinct rows from the
first query which is not in the second query
a) UNION
b) UNION ALL
c) INTERSECT
d) MINUS
Examine the table data and answer accordingly
EMPNO ENAME DEPARTMENT SALARY
1 Anitha SD 50002 Mehta FIN 45003 Sneha FIN 40004 Yaminee SD 35005 Shruthy HR 5500
7/31/2019 OracleQP
10/32
P a g e | 10
32) Which query is used to display all the rows from SD
Department where the salary is greater than all the salary in FIN
Department
a) SELECT * FROM EMPLOYEE WHERE DEPARTMENT =SD
AND SALARY ANY (SELECT SALARY FROM EMPLOYEE)b) SELECT * FROM EMPLOYEE WHERE DEPARTMENT =SD
AND SALARY > (SELECT SALARY FROM EMPLOYEE WHERE
DEPARTMENT=FIN)
c) SELECT * FROM EMPLOYEE WHERE DEPARTMENT =SD
AND SALARY IN (SELECT SALARY FROM EMPLOYEE
WHERE DEPARTMENT=FIN)
d) SELECT * FROM EMPLOYEE WHERE DEPARTMENT =SD
AND SALARY > ALL (SELECT SALARY FROM EMPLOYEEWHERE DEPARTMENT=FIN)
33) Consider Table A and Table B exists. Which Join should be
used to display all the records from Table A and common
records between both A and B.
a) LEFT OUTER JOIN
b) RIGHT OUTER JOIN
c) NATURAL JOIN
d) FULL OUTER JOIN
34) What is the syntax for creating a PRIMARY KEY constraint
a) Alter table tablename ADD CONSTRAINT CONSTRAINTNAME
PRIMARY KEY
COLUMNNAME1,COLUMNNAME2,COLUMNNAME3
b) ADD CONSTRAINT CONSTRAINTNAME PRIMARY KEY
TABLENAME(COLUMNNAME1,COLUMNNAME2,COLUMNNAM
E3)
7/31/2019 OracleQP
11/32
P a g e | 11
c) ADD CONSTRAINT CONSTRAINTNAME PRIMARY KEY
TABLENAME(COLUMNNAME1,COLUMNNAME2,COLUMNNAM
E3)
d) Alter table tablename ADD CONSTRAINT CONSTRAINTNAMEPRIMARY KEY
(COLUMNNAME1,COLUMNNAME2,COLUMNNAME3)
Examine the structure of the tables
Table : EMPLOYEE
EMPLOYEE_NO NUMBER,
EMPLOYEE_NAME VARCHAR2(20)
DEPTID NUMBER
SALARY NUMBER
Table : DEPARTMENT
DEPTID NUMBER
DEPTNAME VARCHAR2(20)
35) What is the Syntax to create a Foreign key relationship
between the above tables provided DEPTID of the Employee
table should be present in the Department table (during Altering
the table)
7/31/2019 OracleQP
12/32
P a g e | 12
a) ALTER TABLE EMPLOYEE ADD CONSTRAINT FK FOREIGN
KEY (DEPTID) REFERENCES DEPARTMENT(DEPTID)
b) ALTER TABLE DEPARTMENT ADD CONSTRAINT FK FOREIGN
KEY (DEPTID) REFERENCES EMPLOYEE(DEPTID)
c) ADD CONSTRAINT FK FOREIGN KEY(DEPTID) REFERINGDEPARTMENT(DEPTID)
d) ALTER TABLE EMPLOYEE ADD CONSTRAINT FK FOREIGN
KEY (DEPTID) REFERENCING DEPARTMENT(DEPTID)
36) A VIEW is a
a) Logical/Virtual table
b) Dummy table
c) Real tabled) Duplicate table
37) INDEX is used to
a) To retrieve data from more than one table
b) To retrieve data quickly
c) To Join the tables
d) To retrieve the uncommon values from more than one table joined
38) Syntax to Drop the Index created
a) DROP INDEX INDEXNAME
b) ALTER TABLE TABLENAME DROP INDEX INDEXNAME
c) DROP INDEX TABLENAME(INDEX)
d) DROP INDEXNAME
39) Which Pseudocolumns display the date and time of when
the row got modified?
a) ROWNUM
7/31/2019 OracleQP
13/32
P a g e | 13
b) USER
c) ORA_ROWSCN
d) ROWSCN
40) Which SELECT statement fetches the rows whose salarylies between 5000 and 10000?
a) SELECT * FROM EMPLOYEE WHERE SALARY BETWEEN 5000
AND 10000
b) SELECT * FROM EMPLOYEE WHERE SALARY BETWEEN 5000
,10000
c) SELECT * FROM EMPLOYEE WHERE SALARY = BETWEEN
5000 AND 10000
d) SELECT * FROM EMPLOYEE WHERE SALARY = 5000 , 10000
41) Which command is used to create a table by copying the
structure of another table?
a) CREATE TABLE TABLENAME SELECT * FROM TABLENAME;
b) CREATE TABLE TABLENAME AS SELECT * FROM
TABLENAME;
c) CREATE TABLE TABLENAME AS TABLENAME;
d) CREATE TABLE TABLENAME SELECT TABLENAME;
Examine the EMPLOYEE table data and answer accordingly
EMPNO ENAME DEPARTMENT SALARY1 Anitha SD 50002 Mehta FIN 45003 Sneha FIN 45004 Yaminee SD 3500
5 Shruthy HR 5500
42) What is the output for the query:
SELECT EMPNO,ENAME,RANK() OVER (ORDER BY SALARY
DESC) RANK, DENSE_RANK() OVER (ORDER BY SALARY
DESC) DENSERANK FROM EMPLOYEE
7/31/2019 OracleQP
14/32
P a g e | 14
a)
EMPNO ENAME DEPARTMENT SALARY RANK DENSERANK5 Shruthy HR 5500 1 11 Anitha SD 5000 2 22 Mehta FIN 4500 3 33 Sneha FIN 4500 3 44 Yaminee SD 3500 5 5
b)
EMPNO ENAME DEPARTMENT SALARY RANK DENSERANK5 Shruthy HR 5500 1 11 Anitha SD 5000 2 2
2 Mehta FIN 4500 3 33 Sneha FIN 4500 3 44 Yaminee SD 3500 4 5
c)
EMPNO ENAME DEPARTMENT SALARY RANK DENSERANK5 Shruthy HR 5500 1 11 Anitha SD 5000 2 22 Mehta FIN 4500 3 3
3 Sneha FIN 4500 3 34 Yaminee SD 3500 4 5
d)
EMPNO ENAME DEPARTMENT SALARY RANK DENSERANK5 Shruthy HR 5500 1 11 Anitha SD 5000 2 22 Mehta FIN 4500 3 33 Sneha FIN 4500 3 3
4 Yaminee SD 3500 5 4
Examine the EMPLOYEE table data and answer accordingly
EMPNO ENAME DEPARTMENT Manager SALARY
7/31/2019 OracleQP
15/32
P a g e | 15
1 Anitha SD Mehta 50002 Mehta FIN 45003 Sneha FIN Mehta 45004 Yaminee SD Anitha 3500
5 Shruthy HR Sneha 5500
43) Which query best describes the employee manager
relationship. Like who is working under which Manager.
a) SELECT EMPNO,ENAME,MNAME FROM EMPLOYEE START
WITH MANAGER IS NULL CONNECT BY PRIOR
ENAME=MNAME
b) SELECT EMPNO,ENAME,MNAME FROM EMPLOYEE
CONNECT BY PRIOR ENAME=MNAME
c) SELECT EMPNO,ENAME,MNAME FROM EMPLOYEE START
WITH MANAGER IS NULL CONNECT BY PRIOR
MNAME=ENAME
d) SELECT EMPNO,ENAME,MNAME FROM EMPLOYEE STARTWITH MANAGER = CONNECT BY PRIOR ENAME=MNAME
44) Which Statement provide better performance?
a) SELECT COUNT(*) FROM EMPLOYEE
b) SELECT COUNT(1) FROM EMPLOYEE
c) SELECT COUNT(EMPNO) FROM EMPLOYEE
d) SELECT COUNT() FROM EMPLOYEE
45) Syntax for creating Temporary Table
a) CREATE TEMPORARY TABLE my_temp_table (
column1 NUMBER,
column2 NUMBER
) ON COMMIT DELETE ROWS;
7/31/2019 OracleQP
16/32
P a g e | 16
b) CREATE TEMPORARY TABLE my_temp_table (
column1 NUMBER,
column2 NUMBER
) ON COMMIT DELETE;c) CREATE GLOBAL TEMPORARY TABLE my_temp_table (
column1 NUMBER,
column2 NUMBER
) ON COMMIT DELETE ROWS;
d) CREATE GLOBAL TEMPORARY TABLE my_temp_table (
column1 NUMBER,
column2 NUMBER
) DELETE ROWS;
46) MERGE is a combination of
a) INSERT,DELTE
b) INSERT UPDATE
c) SELECT INSERT
d) SELECT UPDATE
47) Syntax to LOCK the table employee
a) ALTER TABLE EMPLOYEE LOCK
b) LOCK TABLE EMPLOYEE
c) LOCK TABLE EMPLOYEE IN ROW EXCLUSIVE MODE
d) ALTER TABLE EMPLOYEE LOCK IN ROW EXCLUSIVE MODE
48) Abbreviation of TKPROF
a) Transaction Kleen Proof
b) Transaction Kernel Profiler
c) Transient Kernel Profiler
d) Transient Kernel Proof
49) Data can be inserted into more than table in a single
command using
a) INSERT
7/31/2019 OracleQP
17/32
P a g e | 17
b) INSERTALL
c) INSERT ALL
d) MERGE
50) Which Normalization form eliminates Functionaldependencies on Non-key fields by putting them into separate
tables
a) First Normal Form
b) Second Normal Form
c) Third Normal Form
d) Fourth Normal Form
e) Fifth Normal Form
51) Abbreviation for PL/SQL
a) Programming Language extension to SQL
b) Processing Language extension to SQL
c) Procedural Language extension to SQL
d) Programmatic Language extension to SQL
52) Which lines in the below program is having error
1 Declare
2 I constant;
3 J integer;
4 Begin
5 I := 10;
6 J := 5;
7 DBMS_OUTPUT.PUT_LINE(i+j);
8 End;
a) 2
b) 3
c) 2 &6
d) 2 & 5
7/31/2019 OracleQP
18/32
P a g e | 18
53) Which Statement stores data correctly? (Note: Employee
Table is having more rows)
a) SELECT ENAME,DEPT INTO TENAME,TDEPT FROM
EMPLOYEE WHERE EMPNO=2b) SELECT ENAME INTO TENAME,DEPT INTO TDEPT FROM
EMPLOYEE WHERE EMPNO=2
c) SELECT ENAME,DEPT INTO TENAME,TDEPT FROM
EMPLOYEE
54) How to declare a tempno variable of type similar toEmployee table Empno column
a) TEMPNO number;
b) TEMPNO EMPLOYEE%ROWTYPE;
c) TEMPNO EMPLOYEE.EMPNO%ROWTYPE;
d) TEMPNO EMPLOYEE.EMPNO%TYPE;
55) Which Conditional statements are correct
a) IF Dept=SD THEN
Dbms_output.put_line(SD Department);
ELSE
Dbms_output.put_line(FIN Department);
END IF;
b) IF Dept=SD THEN
Dbms_output.put_line(SD Department);
ELSEIF
Dbms_output.put_line(FIN Department);
END IF;
c) IF Dept=SD THEN
7/31/2019 OracleQP
19/32
P a g e | 19
Dbms_output.put_line(SD Department);
ELSE IF Dept=FIN THEN
Dbms_output.put_line(FIN Department);
END IF;
d) IF Dept=SD THEN
Dbms_output.put_line(SD Department);
ELSIF DEPT=FIN
Dbms_output.put_line(FINDepartment);
END IF;
56) Which block is correct?
a)
declare
begin
loop
i :=i+1;
exit when i>10;
end loop;end;
b)
begin
i integer :=1;
loop
i :=i+1;
exit when i>10;
end loop;
end;
c)
declare
i integer :=1;
begin
7/31/2019 OracleQP
20/32
P a g e | 20
loop
i :=i+1;
end loop;
end;
d)
declare
i integer :=1;
begin
loop
exit when i>10;
end loop;
end;
57) CURSOR is a
a) Logical Entity
b) Temporary Work area
c) Virtual table
d) Real table
58) What statement is correct for a Cursor Definition
a) Cursor IS SELECT * FROM TABLENAME;
b) Cursor AS SELECT * FROM TABLENAME;
c) Cursor cursorname IS SELECT * FROM TABLENAME;
d) Cursor cursorname AS SELECT * FROM TABLENAME;
59) A Procedure can have only IN and OUT Parameters
a) True
b) False
60) CREATE OR REPLACE PROCEDURE add_emp
(pempno NUMBER,
7/31/2019 OracleQP
21/32
P a g e | 21
pename VARCHAR2)
IS
BEGIN
INSERT INTO EMPLOYEE VALUES(pempno,pename);
END;
Which options are Valid calls to the Procedure?
a) Add_emp(1,Priya); (From PL/SQL Block)
b) EXEC Add_emp(1,Priya); (From SQL * plus command)
c) Add_emp(Priya,1); (From PL/SQL Block)
d) Add_emp(1) (From PL/SQL Block)
61) Functions will return
a) 2 values
b) 1 value
c) May not return values
d) Cannot return values
62) CREATE OR REPLACE PACKAGE test AS -- package spec
PROCEDURE hire_employee (emp_id INTEGER, name
VARCHAR2);
END test;
/
CREATE OR REPLACE PACKAGE BODY test AS -- package body
PROCEDURE hire_employee (emp_id INTEGER, name
VARCHAR2) IS
BEGIN
INSERT INTO employee VALUES (emp_id, name);
7/31/2019 OracleQP
22/32
P a g e | 22
END hire_employee;
PROCEDURE fire_employee (emp_id INTEGER) IS
BEGINDELETE FROM employee WHERE empno = emp_id;
END fire_employee;
END test;
What is the error found in the code?
a) Procedure fire_employee is not defined in the Specification of the
Packageb) Procedure fire_employee is additionaly mentioned in the package
Body
c) Clause Spec is not included in the Specification of the Package
d) No Error Found
63) Command used to call a Procedure from a SQL * Plus
a) Procedure;b) Execute / Exec Procedure;
c) Run procedure;
d) Call Procedure ;
ANALYZE the below Program and Answer accordingly
CREATE OR REPLACE PACKAGE test AS -- package spec
PROCEDURE hire_employee (emp_id INTEGER, nameVARCHAR2);
END test;
/
7/31/2019 OracleQP
23/32
P a g e | 23
CREATE OR REPLACE PACKAGE BODY test AS -- package body
PROCEDURE hire_employee (emp_id INTEGER, name
VARCHAR2) IS
BEGIN
INSERT INTO employee VALUES (emp_id, name);
Fire_employee(empid);
END hire_employee;
PROCEDURE fire_employee (emp_id INTEGER) IS
BEGIN
DELETE FROM employee WHERE empno = emp_id;
END fire_employee;END test;
64) What is the error found in the code?
a) No error will occur
b) Fire_employee not defined in the Specification
c) Error fire_employee not declared in this scope will occur (while
compiling the Package Body)
d) None of the above
65) How to execute the above hire_employee procedure
a) Exec hire_employee;
b) Exec hire_employee(1,Neha);
c) Exec test.hire_employee;
d) Exec test.hire_employee(1,Neha);
66) What is the syntax for creating a Function?
a) CREATE OR REPLACE FUNCTIONNAME (parameter datatype,
parameter datatype) RETURN IS
BEGIN
SQL Statements
END
7/31/2019 OracleQP
24/32
P a g e | 24
b) CREATE OR REPLACE FUNCTION FUNCTIONNAME
(parameter datatype, parameter datatype) RETURN VARCHAR2
IS
BEGIN
SQL StatementsEND
c) CREATE OR REPLACE FUNCTION FUNCTIONNAME
(parameter datatype, parameter datatype) BEGIN
SQL Statements
END
d) CREATE OR REPLACE FUNCTIONNAME (parameter datatype,
parameter datatype) RETURN VARCHAR2 IS
BEGINSQL Statements
END
67) EXCEPTION NO_DATA_FOUND comes under
a) User defined exception
b) System defined named exception
c) System defined unnamed exception
68) EXCEPTION is defined by
a) exceptionname EXCEPTION;
b) EXCEPTION exceptionname;
c) SYSTEM EXCEPTION exceptionname
d) Exceptionname varchar2(20) EXCEPTION;
69) What is the Exception thrown while trying to duplicate the
primary key value?
a) TOO_MANY_ROWS
b) NO_DATA_FOUND
c) DUP_VAL_ON_INDEX
d) VALUE_ERROR
7/31/2019 OracleQP
25/32
P a g e | 25
70) What is the Exception thrown while trying to assign more
records into a variable?
a) TOO_MANY_ROWS
b) NO_DATA_FOUND
c) DUP_VAL_ON_INDEXd) VALUE_ERROR
71) Unhandled errors will be handled by
a) WHEN OTHERS THEN
b) WHEN TOO_MANY_ROWS THEN
c) WHEN UNHANDLED_ERRORS THEN
d) WHEN ERRORS THEN
72) Whenever a message is displayed using
RAISE_APPLICATION_ERROR, all previous transactions which
are not committed within the PL/SQL Block are rolled back
automatically
a) True
b) False
c) Occasionally
73) Dynamic SQL Statement is executed using
a) EXEC qry
b) EXECUTE IMMEDIATE qry
c) EXEC IMME qry
d) EXEC IMMEDIATE qry
74) Which command is used to select multiple rows into
variable
a) MULTIPLE ROWS
b) BULK COLLECT
c) BULKCOLLECT
d) BULK ROWS
7/31/2019 OracleQP
26/32
P a g e | 26
75) Which statement is correct with FORALL
a) FORALL k in temp.first..temp.last
b) FOR ALL k =temp.first..temp..last
c) FOR ALL k in temp.first..temp.last
d) FORALL k=temp.first..temp.last
76) Trigger cannot be written on the event of which below
statement?
a) INSERT
b) UPDATE
c) DELETE
d) SELECT
77) EXAMINE THE TRIGGER and select the correct option
CREATE or REPLACE TRIGGER price_history_trigger
UPDATE
ON product
FOR EACH ROW
BEGIN
INSERT INTO product_price_history
VALUES
(:old.product_id,
:old.product_name,
:old.supplier_name,
:old.unit_price);
END;
/
a) Trigger will be executed successfully
b) :new values is not mentioned in the Trigger
c) Column name is mentioned in the Trigger
d) BEFORE /AFTER statement is not specified
7/31/2019 OracleQP
27/32
P a g e | 27
78) You can refer the old and new values by specifying
a) REFERENCING OLD as oldname NEW as newname
b) REFERING OLD as oldname NEW as newname
c) REFERING OLD oldname NEW newnamed) REFERENCING OLD oldname NEW newname
79) Giving another name for an Object is known as
a) Synonym
b) Sequence
c) View
d) Trigger
80) To get the current value from the Sequence the command
is
a) CURRVAL
b) CURRENTVALUE
c) CURRVALUE
d) CURVAL
81) To get the next value from the Sequence
a) SELECT SEQUENCENAME.CURRVAL FROM DUAL
b) SELECT SEQUENCENAME.NEXTVAL FROM DUAL
c) SELECT SEQUENCENAME.NEXTVALUE FROM DUAL
d) SELECT NEXTVAL FROM DUAL
82) To set the Maximum value in Sequence
a) MAXVALUE 5000
b) MAXVAL 5000
c) MAXIMUM VALUE 5000
d) MAX VALUE 5000
83) How to Alter the Sequence to increment the Sequence by 2
7/31/2019 OracleQP
28/32
P a g e | 28
a) ALTER SEQUENCE sequencename INCREMENT BY 2
b) ALTER SEQUENCE sequencename INCR BY 2
c) ALTER sequencename INCREMENT BY 2
d) ALTER SEQUENCE sequencename INCREMENT BY 1+1
84) How to Drop a Synonym
a) ALTER TABLE TABLENAME DROP SYNONYM synonymname
b) DROP SYNONYM synonymname
c) ALTER TABLE DROP SYNONYM synonymname
d) ALTER TABLE TABLENAME DROP SYNONYM
85) What are the Attributes of Explicit Cursors
a) Cursorname%FOUNDb) Cursorname%NOTFOUND
c) Cursorname%CLOSE
d) Cursorname%ROWCOUNT
86) Which statement fetches data from cursor
a) FETCH VARIABLE INTO CURSORNAME;
b) FETCH CURSORNAME INTO VARIABLE;
c) FETCH INTO VARIABLE;
d) FETCH CURSORNAME INTO variable1,variable2;
87) Which three of the following are implicit cursor attributes?
a) %found
b) %too_many_rows
c) %notfound
d) %rowcount
e) %rowtype
7/31/2019 OracleQP
29/32
P a g e | 29
88) If left out, which of the following would cause an infinite
loop to occur in a simple loop?
a) LOOP
b) END LOOP
c) IF-THENd) EXIT WHEN (CONDITION)
89) The command used to open a CURSOR FOR loop is
a) Open
b) Fetch
c) Parse
d) None, cursor FOR loops handle cursor opening implicitly.
90)
Read the following code:CREATE OR REPLACE TRIGGER update_show_gross
{trigger information}BEGIN{additional code}
END;
The trigger code should only execute when the column,COST_PER_TICKET, is greater than $3. Which trigger information willyou add?
a) WHEN (new.cost_per_ticket > 3.75)b) WHEN (:new.cost_per_ticket > 3.75 )c) WHERE (new.cost_per_ticket > 3.75)d) WHERE (:new.cost_per_ticket > 3.75)
91) Which Data dictionary contains all the tables created for
the user
a) Usertables
b) User_table
7/31/2019 OracleQP
30/32
P a g e | 30
c) User_tables
92) Which is a Valid assignment statement
a) V := 5;b) V =5;
c) V==5;
93) To Print the output, the statement used is
a) Dbms_output.put(text);
b) Dbms_output.put_line(text);
c) Dbms_output.put.line(text);
d) Dbms.output.put_line(text);
94) Declare
i number,;
lamt number :=0;
BEGIN
i :=1;
LOOP
lamt := lamt +500;
i=i+1;
EXIT looplabel WHEN i>3;
END LOOP;
END;
What will be the final value of the lamt
a) 2000
b) 500
c) 1500
d) 1000
7/31/2019 OracleQP
31/32
P a g e | 31
95) Which command executes the contents of a specified file?
a) EXEC filename
b) EXECUTE filename
c) @ file =filenamed) @ filename
96) What is the Exception thrown while trying to Fetch a value
from a Cursor which is not yet Opened?
a) TOO_MANY_ROWS
b) INVALID CURSOR
c) CURSOR_ALREADY_OPENd) VALUE_ERROR
97) Which two programming constructs can be created within
a package
a) Cursor
b) Constant
c) Trigger
d) Sequence
e) View
98) Which part of the database Trigger determines the number
of times the trigger body executes?
a) Trigger type
b) Trigger body
c) Trigger event
d) Trigger timing
7/31/2019 OracleQP
32/32
P a g e | 32
99) You need to create a trigger on the Emp table that monitors
every row that is changed and places this information into the
AUDIT_TABLE.
What type of trigger do you create?
a) FOR EACH ROW Trigger on the emp tableb) Statement level trigger on the EMP Table
c) FOR EACH ROW trigger on the AUDIT_TABLE
d) Statement level trigger on the AUDIT_TABLE
100) What is the statement used to throw a USER DEFINED
EXCEPTION?a) THROW EXCEPTIONNAME;
b) RAISE EXCEPTION EXCEPTIONNAME;
c) RAISE EXCEPTIONNAME;
d) THROW EXCEPTION EXCEPTIONNAME;
*************************************************************************************
***********************************