You are on page 1of 5

Section A

[Marks 20]
Q 1. Following is not a mandatory process for Oracle Instance to start
a) DBWR
b) LGWR
c) PMON
d) Dispatcher
Ans:- d
Q 2 Which of the following file is used to authenticate privileged database users?
a) Redo Log File
b) Control File
c) Password File
d) Archived File
Ans:- c
Q 3. A User executes a SQL command to update a row in EMP table. Which process
executes this statement?
a) User Process
b) Sever Process
c) RECO
d) ARCH
Ans:- b
Q 4. When database is created which of the Tablespace is created automatically?
a) SYSTEM
b) Data
c) User
d) Userdata
Ans:- a
Q 5. Which of the following file is not a part of the Database?
a) Control File
b) Datafile
c) Password file
d) Redo Log file
Ans:- c
Q 6. Which of the following file stores Rollback Segments?
a) Datafile
b) Control file
c) Password file
d) Parameter file
Ans:- a
Q 7. Which of the following memory area is not a part of SGA?
a) Database Buffer Cache
b) Shared Pool
c) PGA
d) Redo Log Buffer
Ans:- c
Q 8. Which of the following memory area is used to cache the data dictionary
information?
a) Shared Pool
b) Database Buffer Cache
c) Redo Log Buffer
d) PGA
Ans:- a
Q 9. Which of the following Logical Backup?
a) RMAN
b) Export
c) Offline
d) Online

Ans:- b
Q 10. Which of the following process is used to manage multiple requests in Shared
Server environment?
a) RECO
b) ARCH
c) Dispatcher
d) SMON
Ans:- c
Q11 This Cursor attribute returns number of rows effected.
a. %Reccount
b. %Rowcounted
c. %RowCount
d. %Open
Ans:- c
Q12. User defined Exception can be raise using following key word
a. Call Exception
b. Raise <Exception name>
c. Execute <Exception name>
d. None of the above
Ans:- b
Q13. Which are the valid modes of parameter are available in Stored Procedures and
Functions.
a. IN
b. INPUT
c. OUT
d. INOUT
e. OUTPUT
Ans:- a,c,d
Q14. When a transaction does starts
a. User Logs in to Oracle Database
b. User issues COMMIT
c. User issues ROLLBACK
d. User creates SAVEPOINT
e. None of the above
Ans:- a,b,c
Q15. The following function adds n number to a given date d, where n can be negative.
a. Add_months(d,n)
b. Sum_months(d,n)
c. Next_date(d,n)
d. New_date(d,n)
Ans:- a
Q16. Which of the following sections are optional in PL/SQL.
a. Begin
b. Exception
c. Declare
d. End
Ans:- b,c
Q17. Which are the two database objects meant for performance issues in Oracle
database?
a. Materialized view
b. Index
c. Cluster
d. None of the above
Ans:- b,c
Q18. Integrity constraints defined on schema objects are stored in
a. USER_OBJECTS
b. USER_CONSTRAINTS
c. USER_INDEXES
d. USER_PRIMARY_KEY

Ans:- b
Q19. By using which clause Oracle maintains referential interiority by automatically
removing dependent primary or unique key value.
a. ENABLE
b. DEFAULT
c. ON DELETE CASCADE
d. REFERENCES
Ans:- c
Q20. What happens when Primary Key is defined on a tables column?
a. Index is created on that column
b. No index is created on any column
c. Not Null and Unique constraints are defined implicitly
d. There is no effect
Ans:- a
Section B
Give your answer in either True or False

[Marks 15]

1. Oracle will increment the sequence only once in one SQL statement although
sequence is called for different columns or called twice.(False)
2. Procedure is a subprogram that returns a value.(False)
3. To define foreign key constraint as table level FOREIGN KEY keyword is necessary.
(True)
4. A function can have only one return statement. (True)
5. Inside a package function can be overloaded. (True)
6. Syntax for user defined Error Message and user defined Error Number is
Raise_Application_error(-19989,Oracle internal Error);(False)
7. All explicit cursors must be declared in declarative section. (True)
8. The cursor FOR LOOP automatically opens and closes the cursors. (True)
9. To call a procedure from PL/SQL block, execute command is used.(False)
10. Every time an oracle database is opened, one or more control files are
checked.(True)
11. The primary purpose of Redo Log Buffer Cache is to record all changes to database
data block.(False)
12. Shared Pool is used to keep Data Dictionary information.(True)
13. A Session starts when a user is validated by Oracle.(True)
14. The Physical structure of database consists of Control File, Datafile and Redo Log
file. (True)
15. Large Pool is not a part of System Global Area.(True)
Section C
Fill in the blanks.

[ 10 Marks ]

1) Syntax for padding the Hello by * characters from left as well as right
respectively are LPAD('HELLO',20,'*')and RPAD('HELLO',20,'*').
2) All variables must be declared in the DECLARE section of the PL/SQL block.
3) The assignment operator is := and substitution operator is &.
4) EXECUTE command is used to call procedure at SQL Prompt.
5) Unnamed exceptions can be handled by using OTHERS exception handler.
6) INDEX and CLUSTER are the two ways to improve performance of the
database operations.
7) SGA contains DATABASE BUFFER CACHE, REDO LOG BUFFER and SHARED
POOL.
8) All changes made to the database are written on REDO LOG FILE.
9) %ISOPEN attribute is used to determine whether the cursor is opened or not.
10)The IMPLICIT cursor is created for SQL statements.

Section D
Write the PL/SQL Blocks, Cursors, Function and procedures.

[marks 10]

1. Write a procedure to increment the salary of all the employees by following criteria
10% if the JOB is MANAGER
15% if the JOB is CLERK
20% if JOB ANALYST otherwise 8% for rest of the employees, also displays
the incremented salary.
2. Write four cursor attributes and their description in one sentence.
3. Write a procedure to display all the employees with there name, job and salary and
their manager name, job, with their salary.

4. Write a trigger which will store the information like user name, date of
Modification, time in the table called UpdateInfo, whenever EMP table is updated.
.(UpdateInfo table has these columns :- uname, dom,time)
5. Write a procedure to display 2nd, 4th, 6th, 8th and 10th rows from employees table.

Programs
1. declare
cursor csr is select * from emp;
mcsr csr%rowtype;
begin
open csr;
loop
fetch csr into mcsr;
exit when csr%notfound;
if mcsr.job='MANAGER' THEN
update emp set sal=sal+sal*.1 where job=mcsr.job;
ELSIF mcsr.job='CLERK' THEN
update emp set sal=sal+sal*.15 where job=mcsr.job;
ELSIF mcsr.job='ANALYST' THEN
update emp set sal=sal+sal*.2 where job=mcsr.job;
ELSE
update emp set sal=sal+sal*.1 where job=mcsr.job;
end if;
end loop;
end;
/
2. Cursor Attributes
1.
2.
3.
4.

%ISOPEN: - Evaluates to TRUE if the cursor is open.


%FOUND: - Evaluates to TRUE if the most recent fetch returns a row.
%NOTFOUND: - Evaluates to TRUE if the most recent fetch does not return a row.
%ROWCOUNT: - Evaluates to the total number of rows returned so far.

Program 3.
DECLARE
CURSOR CSR2 IS SELECT W.EMPNO WENO,W.ENAME WENAME,W.JOB
WJOB,W.MGR WMGR,W.SAL WSAL,M.EMPNO,M.ENAME MENAME,M.JOB
MJOB,M.SAL MSAL FROM EMP W,EMP M
WHERE W.MGR=M.EMPNO;

MCSR2 CSR2%ROWTYPE;
BEGIN
OPEN CSR2;
LOOP
FETCH CSR2 INTO MCSR2;
EXIT WHEN CSR2%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(MCSR2.WENO || '' ||MCSR2.WENAME||' '||
MCSR2.WJOB||' '|| MCSR2.WMGR || ' '||MCSR2.WSAL|| ' '|| MCSR2.MENAME||
' '|| MCSR2.MJOB || ' '|| MCSR2.MSAL );
END LOOP;
END;
/

Program 4.
create or replace trigger trig
before update on emp
begin
end;

insert into updateinfo


values(user,sysdate,to_char(sysdate,'hh:mi:ss'));

Program 5.

declare
cursor cur is select * from emp;
e cur%rowtype;
begin
open cur;
loop
fetch cur into e;
exit when cur%NotFound;
if cur%rowcount in (1,2,3,5) then
dbms_output.put_line('Name : ' ||e.ename||'
end if;
end loop;
end;
/

' ||e.sal);

You might also like