0% found this document useful (0 votes)
4 views13 pages

Paper CS409 1

The document is a final examination paper for a course on Database Administration, containing multiple-choice questions and practical coding tasks related to SQL and PL/SQL. It covers topics such as creating tablespaces, views, triggers, procedures, exceptions, and database management concepts. Additionally, it includes questions on transaction handling, deadlocks, and SQL Plus statements for database operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views13 pages

Paper CS409 1

The document is a final examination paper for a course on Database Administration, containing multiple-choice questions and practical coding tasks related to SQL and PL/SQL. It covers topics such as creating tablespaces, views, triggers, procedures, exceptions, and database management concepts. Additionally, it includes questions on transaction handling, deadlocks, and SQL Plus statements for database operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

FINALTERM EXAMINATION

Fall 2022
CS409 – Introduction to Database Administration

MUBEEN MUSTAFA
Whatsapp +92 3411677117

Question No: 1 (Marks: 01) - Please choose the correct option

Which SQL statement from the following is used to create a new tablespace?
A. CREATE TABLESPACE
B. CREATE TEMPORARY TABLESPACE
C. CREATE UNDO TABLESPACE
D. Both A & B

Question No: 2 (Marks: 01) - Please choose the correct option

Views are ____ tables that don't exist physically in Oracle.

A. Real
B. Virtual
C. Both A and B
D. None of the above

Question No: 3 (Marks: 01) - Please choose the correct option

One or more tables are joined to create a ____.

A. View
B. Virtue
C. Variable
D. None

Question No: 4 (Marks: 01) - Please choose the correct option

Which of the following date function can be used to get the timestamp from database?
A. SYSTEMTIMESTAMP
B. SYSTIMESTAMP
C. SYSTEMDATE
D. SYSDATE

Question No: 5 (Marks: 01) - Please choose the correct option


________ are PL/SQL programs that are set up to execute in response to a particular
event on a table in the database.
A. Package
B. Functions
C. Triggers
D. Procedure

Question No: 6 (Marks: 01) - Please choose the correct option

A program that resides inside an oracle database that manipulates data in the database
before the data is used outside the database is known as __________.
A. Triggers
B. Function
C. Stored procedure
D. Package

Question No: 7 (Marks: 01) - Please choose the correct option

Which command is used to fetch records from database?

A. Fetch
B. Select
C. Use
D. Get

Question No: 8 (Marks: 01) - Please choose the correct option

A ________ is a group of PL/SQL statements that can be called by name.

A. View
B. Trigger
C. Procedure
D. Function

Question No: 9 (Marks: 01) - Please choose the correct option

How many CREATE TRIGGER statements are there? ANSWER is 2

A. 4
B. 5
C. 6
D. 7
Question No: 10 (Marks: 01) - Please choose the correct option

TRUNCATE TABLE statement is used to remove the table.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

Question No: 11 (Marks: 01) - Please choose the correct option

Which processes is an instance made of Oracle?

A. Memory processes
B. Oracle background processes
C. Data processes
D. All of the above

Question No: 12 (Marks: 01) - Please choose the correct option

Which is the smallest unit of storage in an Oracle database?

A. Segment
B. Data Block
C. Extent
D. Data File

Question No: 13 (Marks: 01) - Please choose the correct option

How many types of procedure are there?

A. 1
B. 2(Standalone and procedure)
C. 3
D. 4

Question No: 14 (Marks: 01) - Please choose the correct option

Which of the following is/are the type of procedure?

A. IN
B. OUT
C. IN OUT
D. All of the above
Question No: 15 (Marks: 01) - Please choose the correct option

The value of ____ is passed to the subprogram as a default parameter.

A. IN
B. OUT
C. IN OUT
D. None

Question No: 16 (Marks: 01) - Please choose the correct option

What is the syntax to Drop Procedure?

A. DELETE PROCEDURE procedure_name;


B. DROP PROCEDURE procedure_name;
C. RETRIEVE PROCEDURE procedure_name;
D. END PROCEDURE procedure_name;

Question No: 17 (Marks: 01) - Please choose the correct option

Which of the following is not present in the syntax of Create Procedure?

A. IS
B. BEGIN
C. END
D. None(A,B,C are present)

Question No: 18 (Marks: 01) - Please choose the correct option

Which of the following is present in Call Procedure?

A. BEGIN
B. END
C. Both A and B
D. None of the above

Question No: 19 (Marks: 01) - Please choose the correct option

How many types of exceptions are there?


A. 2(Pre-defined,user-defined and system-defined exceptions)in pl/sql there are
2 types

B. 3
C. 4
D. 5

Question No: 20 (Marks: 01) - Please choose the correct option

Errors that are encountered during the execution of the program are referred to as ____ in
PL/SQL.

A. FUNCTION
B. CURSOR
C. EXCEPTION
D. PROCEDURE

Question No: 21 (Marks: 01) - Please choose the correct option

Which of the following is/are an/the type(s) of exceptions?

A. System-defined
B. User-defined
C. Both A. and B.
D. None of the above

Question No: 22 (Marks: 01) - Please choose the correct option

Which command is used in order to raise an exception explicitly?

A. RISE
B. ROSE
C. RAISE
D. RINSE

Question No: 23 (Marks: 01) - Please choose the correct option

Oracle creates ____ when SQL statements are processed.

A. Content Areas
B. Context Areas
C. Context Ids
D. Content Ids

Question No: 24 (Marks: 01) - Please choose the correct option

In the contexts created by Oracle, a cursor represents a ____.

A. Function
B. Table
C. Pointer
D. None of the above

Question No: 25 (Marks: 01) - Please choose the correct option

An SQL ____ refers to a program that retrieves and processes one row at a time, based
on the results of the SQL statement.

A. Cursor
B. Function
C. Procedure
D. View

Question No: 26 (Marks: 01) - Please choose the correct option

Which of the following would cause an infinite loop to occur in a simple loop

A. LOOP
B. END LOOP
C. IF – THEN
D. EXIT

Question No: 27 (Marks: 01) - Please choose the correct option

Which identifier is valid?

A. Customer_12
B. Loop
C. customer@orgA
D. 12customer

Question No: 28 (Marks: 01) - Please choose the correct option


Select the best answer below. What are the components of a package?

A. Box, wrapping and binding


B. Specification and content
C. Header and body
D. None of the given

Question No: 29 (Marks: 01) - Please choose the correct option

If you cannot specify a mode for a parameter, what is the default mode?

A. OUT
B. IN
C. COPY
D. DEFAULT

Question No: 30 (Marks: 01) - Please choose the correct option

Which of the given files are not copied in cold/offline backup.

A. Data Files
B. Control Files
C. Init.ora and config.ora files
D. Log files

Question No: 31 (Marks: 01) - Please choose the correct option

____________ is online backup.

A. Hot
B. Physical
C. Cold
D. Logical

Question No: 32 (Marks: 01) - Please choose the correct option

A management procedure called ___ control is required to control the process of


concurrently performing operations on a database.

A. Database
B. Conspiracy
C. Concurrency
D. Relational

Question No: 33 (Marks: 01) - Please choose the correct option

It is called a schedule when it consists of a series of operations from one ___ to another.

A. Transition
B. Transaction
C. Transportation
D. Transcription

Question No: 34 (Marks: 01) - Please choose the correct option

In SQL, which of the following is not a data definition language command?

A. RENAME
B. REVOKE
C. GRANT
D. UPDATE

Question No: 35 (Marks: 01) - Please choose the correct option

The granting and revoking of roles by the user may cause some confusions when that
user role is revoked. To overcome the above situation

A. The privilege must be granted only by roles


B. The privilege is granted by roles and users
C. The user role cannot be removed once given
D. By restricting the user access to the roles

Question No: 36 (Marks: 01) - Please choose the correct option

Which of the following data base objects can generate serial numbers?

A. Synonyms
B. Views
C. Tables
D. Sequences

Question No: 37 (Marks: 01) - Please choose the correct option

Which of the given is part of logical database?


A. Control Files
B. Redo Log Files
C. Data Files
D. Segments
Question No: 38 (Marks: 01) - Please choose the correct option

The size of the database block is decided at the time of _____________.


A. Database creation
B. Table creation
C. Workspace creation
D. Tablespace creation
Question No: 39 (Marks: 01) - Please choose the correct option

Which of the given synonym is used for Char Datatype in PL/SQL?


A. Character
B. Varchar
C. Varchar2
D. Ch
Question No: 40 (Marks: 01) - Please choose the correct option

A ___________of the transactions can be obtained by finding a linear order consistent


with the partial order of the precedence graph.

A. Direction graph
B. Precedence graph
C. Scheduling scheme
D. Serializability order

Question No: 41 (Marks: 03)

Write the syntax to create view in PL/SQL.

Answer

CREATE [OR REPLACE] VIEW view_name


AS
SELECT column1, column2, ...
FROM table_name
WHERE [condition];

Question No: 42 (Marks: 03)


Write the PL/SQL code to create a sequence to generate the primary key of the Employee
table incremented by 2.

Answer

CREATE SEQUENCE emp_seq


INCREMENT BY 2
START WITH 1
NOCACHE
NOCYCLE;

Question No: 43 (Marks: 03)

Write the difference between PL/SQL Procedure and PL/SQL Functions.

Answer

PL/SQL procedures are designed to perform an action or a series of


actions, while PL/SQL functions are designed to return a single value.

Question No: 44 (Marks: 03)

Write the names of any three scaler data types used in PL/SQL programs.

Answer

NUMBER: Used to store numeric values, such as integers or decimals.


VARCHAR2: Used to store character strings with a maximum length of
32767 bytes.
DATE: Used to store date and time values in a specific format (e.g. 'DD-
MON-YYYY HH24:MI:SS').

Question No: 45 (Marks: 03)

Write PL/SQL statement to remove the privilege from the user Amir.

Answer

REVOKE privilege_name FROM Amir;


Question No: 46 (Marks: 03)

Write a transaction which reads two elements X and Y and perform the following
operations and write the results.
X:= X+500
Y:= Y+1000

Answer

DECLARE
x NUMBER;
y NUMBER;
BEGIN
-- Read the values of X and Y
x := &enter_value_for_x;
y := &enter_value_for_y;

-- Perform the required operations


x := x + 500;
y := y + 1000;

-- Display the results


DBMS_OUTPUT.PUT_LINE('X after the operation: ' || x);
DBMS_OUTPUT.PUT_LINE('Y after the operation: ' || y);
END;

Question No: 47 (Marks: 05)

Write sample query for creating schema named “Product” for sample user “AE” using
following attributes?

1. Table name is “new_product”


2. View is “new_product_view”
3. Grants is “SELECT” object privilege on view to the sample user “HR”

Answer

CREATE SCHEMA Product;

CREATE TABLE Product.new_product (


product_id INT,
product_name VARCHAR(50),
product_price DECIMAL(10,2),
product_quantity INT
);

CREATE VIEW Product.new_product_view AS


SELECT product_name, product_price FROM Product.new_product
WHERE product_quantity > 0;

GRANT SELECT ON Product.new_product_view TO HR;

Question No: 48 (Marks: 05)

Define deadlock in context of oracle and also describe to resolve this deadlock issue.

Answer

In Oracle, a deadlock occurs when two or more transactions are blocked


indefinitely because each of them is waiting for the other to release a
resource. To resolve this, Oracle uses a technique called deadlock
detection and resolution, where the system detects the deadlock and
identifies one of the transactions as the victim. The victim's transaction is
then rolled back, freeing up the resources and allowing the other
transaction(s) to continue. Alternatively, application developers can use
techniques such as reducing lock times or adjusting transaction isolation
levels to prevent or minimize the occurrence of deadlocks.

Question No: 49 (Marks: 05)

Write the SQL Plus statements for following.

1. Recreating control files.


2. Viewing Alert Log using data dictionary
3. To trace files for your current session.
Answer

To recreate control files, execute the following SQL Plus statement:


ALTER DATABASE BACKUP CONTROLFILE TO TRACE;
CREATE CONTROLFILE REUSE DATABASE <database_name>
RESETLOGS NOARCHIVELOG;

To view Alert Log using data dictionary, execute the following SQL Plus
statement:
SELECT VALUE FROM V$DIAG_INFO WHERE NAME = 'Diag Trace';
Navigate to the path obtained from the above query, and then open the
Alert_<SID>.log file to view the Alert Log.

To trace files for your current session, execute the following SQL Plus
statement:
ALTER SESSION SET SQL_TRACE = TRUE;

This statement enables tracing for the current session. To disable tracing,
use the following statement:

ALTER SESSION SET SQL_TRACE = FALSE;

Question No: 50 (Marks: 05)

Given are the entities of School management system, you have to create ERD for this.
Mention the primary key and cardinalities among all entities.
1. Teacher
2. Class
3. Student
Answer

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy