Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DBMS Quiz

Total questions: 68

Worksheet time: 13mins

Name
Class
Date
1.

What does DBMS stand for?

a)

Database Management Solution

b)

Data Backup Management System

c)

Database Management System

d)

Data Business Management Software

2.

Which of the following is a DBMS software?

a)

MS Word

b)

MySQL

c)

Photoshop

d)

Notepad

3.

Which of the following is not a function of DBMS?

a)

Data storage

b)

Data backup

c)

Data manipulation

d)

Graphic design

4.

Which language is used to define the structure of a database?

a)

DML

b)

DDL

c)

HTML

d)

SQL

5.

Which of the following is NOT a DDL command in SQL?

a)

CREATE

b)

UPDATE

c)

ALTER

d)

DROP

6.

What does the ALTER command do in SQL?

a)

Adds, deletes, or modifies columns in a table

b)

Removes a table completely

c)

Changes existing data in rows

d)

Creates a new database

7.

Who is responsible for managing the database system?

a)

Web Developer

b)

System Analyst

c)

Database Administrator

d)

Data Miner

8.

Which one of the following is a type of key in DBMS?

a)

Main key

b)

Primary key

c)

Start key

d)

Index key

9.

Which of these ensures uniqueness in a database table?

a)

Column

b)

Foreign key

c)

Primary key

d)

Row

10.

The full form of SQL is:

a)

Structured Question Language

b)

Standard Query List

c)

Structured Query Language

d)

Sequential Query Language

11.

Which of these is NOT a feature of DBMS?

a)

Concurrency

b)

Redundancy

c)

Security

d)

Data integrity

12.

A DBMS reduces:

a)

Data retrieval

b)

Data redundancy

c)

Storage speed

d)

System updates

13.

Which of the following is a DML command?

a)

CREATE

b)

INSERT

c)

DROP

d)

ALTER

14.

Which of the following best defines a tuple?

a)

A column

b)

A table

c)

A row

d)

A schema

15.

A database schema is a:

a)

Plan for a website

b)

Framework of a database

c)

Set of queries

d)

Data set

16.

Which command will remove a table completely along with its structure and data?

a)

DELETE

b)

DROP

c)

TRUNCATE

d)

REMOVE

17.

The command to change the name of a table is:

a)

RENAME

b)

ALTER TABLE RENAME TO

c)

MODIFY

d)

UPDATE

18.

Which of the following cannot be rolled back once executed?

a)

DELETE

b)

TRUNCATE

c)

DROP

d)

Both B and C

19.

To add a new column to an existing table, which command is used?

a)

UPDATE TABLE

b)

ALTER TABLE ADD

c)

CREATE COLUMN

d)

INSERT COLUMN

20.

A foreign key is used to:

a)

Delete records

b)

Link two tables

c)

Encrypt data

d)

Identify a table uniquely

21.

Which of the following is true for a primary key?

a)

Can have NULL values

b)

May not be unique

c)

Can consist of multiple columns

d)

Used only for foreign tables

22.

Which of the following is a constraint in DBMS?

a)

WHERE clause

b)

DEFAULT value

c)

CHECK

d)

FROM clause

23.

In relational DBMS, relationships are implemented through:

a)

Loops

b)

Foreign keys

c)

Nested queries

d)

Triggers

24.

Which of the following is NOT an integrity constraint?

a)

Entity integrity

b)

Referential integrity

c)

File integrity

d)

Domain constraint

25.

Which is NOT a feature of PL/SQL?

a)

Block structure

b)

Exception handling

c)

Modular programming

d)

GUI building

26.

Which section of PL/SQL block is optional?

a)

DECLARE

b)

BEGIN

c)

END

d)

None

27.

A variable name in PL/SQL can be up to:

a)

100 chars

b)

50 chars

c)

30 chars

d)

Unlimited

28.

Which of these is an invalid variable name?

a)

salary$

b)

v2_num

c)

1value

d)

v_name

29.

Syntax to declare a variable in PL/SQL:

a)

name data_type;

b)

variable name type;

c)

datatype name;

d)

name := datatype;

30.

Local variables in nested blocks:

a)

Are accessible in outer blocks

b)

Are not accessible in outer blocks

c)

Can be used anywhere

d)

Automatically global

31.

Keyword to declare constant:

a)

CONST

b)

CONSTANT

c)

FIXED

d)

IMMUTABLE

32.

Which is a logical operator in PL/SQL?

a)

AND

b)

OR

c)

NOT

d)

All of the above

33.

Which is NOT a valid IF form in PL/SQL?

a)

IF-THEN

b)

IF-THEN-ELSE

c)

IF-THEN-ELSIF ladder

d)

IF-ONLY

34.

In PL/SQL, a FOR loop counter increments by:

a)

Default 2

b)

Default 1

c)

Must specify explicitly

d)

Cannot decrement

35.

Which loop requires explicit EXIT?

a)

FOR loop

b)

WHILE loop

c)

Simple LOOP

d)

None

36.

(Code)
DECLARE
   fact NUMBER := 1;

BEGIN
   FOR i IN 1..4 LOOP

fact := fact * i

; END LOOP;

DBMS_OUTPUT.PUT_LINE(fact); END; /

a)

10

b)

24

c)

120

d)

Error

37.

%TYPE is used to:

a)

Match data type of a column/variable

b)

Match whole row

c)

Declare trigger type

d)

None

38.

%ROWTYPE is used to:

a)

Define multiple rows

b)

Define structure same as table/cursor row

c)

Define constants

d)

None

39.

(Code) DECLARE vEmployeeName Employee.Name%TYPE;

BEGIN SELECT Name INTO vEmployeeName FROM Employee WHERE ROWNUM = 1; DBMS_OUTPUT.PUT_LINE(vEmployeeName);

END; /

a)

NUMBER

b)

VARCHAR2

c)

Employee.Name column

d)

Table row

40.

VARRAY is used to store:

a)

Heterogeneous data

b)

Ordered homogeneous collection

c)

Random rows from DB

d)

Only character data

41.

VARRAY elements are stored:

a)

Randomly

b)

In contiguous memory

c)

In temporary table

d)

On disk

42.

(Code) TYPE grades IS VARRAY(5) OF INTEGER;

a)

Array of 5 characters

b)

Array of 5 integers

c)

Array of 5 rows

d)

None

43.

A view in SQL is:

a)

A physical table

b)

A logical/virtual table based on a query

c)

A synonym for a table

d)

A stored procedure

44.

Which option allows view creation even if base table doesn't exist?

a)

NOFORCE

b)

FORCE

c)

OR REPLACE

d)

WITH READ ONLY

45.

Which option makes a view unmodifiable?

a)

FORCE

b)

WITH CHECK OPTION

c)

WITH READ ONLY

d)

OR REPLACE

46.

Which statement deletes a view permanently?

a)

REMOVE VIEW v1;

b)

DROP VIEW v1;

c)

DELETE VIEW v1;

d)

TRUNCATE VIEW v1;

47.

Code Output: CREATE VIEW emp_view AS SELECT emp_id, emp_name FROM employees;

INSERT INTO emp_view VALUES (101, 'Ravi');

SELECT * FROM emp_view;

Output = ?

a)

Error - cannot insert into view

b)

Row inserted: (101, Ravi)

c)

No rows displayed

d)

Only emp_id shown

48.

Which statement is TRUE about procedures?

a)

Must always return a value

b)

Cannot accept parameters

c)

Can have IN, OUT, IN OUT parameters

d)

Are temporary blocks only

49.

In procedure creation, `AS` can replace which keyword?

a)

IS

b)

RETURN

c)

DECLARE

d)

BEGIN

50.

Parameter mode used to send data into procedure:

a)

IN

b)

OUT

c)

IN OUT

d)

RETURN

51.

Code Output: DECLARE v_name VARCHAR2(20) := 'Alfred';

BEGIN

DBMS_OUTPUT.PUT_LINE('Hello ' || v_name);

END; / Output = ?

a)

Hello

b)

Alfred

c)

Hello Alfred

d)

Error

52.

Code Output: DECLARE

n NUMBER := 4;

fact NUMBER := 1;

BEGIN FOR i IN 1..n LOOP

fact := fact * i;

END LOOP; DBMS_OUTPUT.PUT_LINE('Factorial = ' || fact);

END; /

Output = ?

a)

Factorial = 16

b)

Factorial = 24

c)

Factorial = 4

d)

Error

53.

Code Output:

DECLARE num NUMBER := 12;

BEGIN

IF MOD(num, 2) = 0 THEN

DBMS_OUTPUT.PUT_LINE(num || ' is Even');

ELSE DBMS_OUTPUT.PUT_LINE(num || ' is Odd');

END IF; END; /

Output = ?

a)

12 is Odd

b)

12 is Even

c)

Error

d)

Null

54.

Code Output: DECLARE

n NUMBER := 5;

BEGIN FOR i IN 1..3 LOOP

DBMS_OUTPUT.PUT_LINE(n || 'x' || i || '=' || (n*i)); END LOOP; END; /

Output = ?

a)

5x1=5, 5x2=10, 5x3=15

b)

5, 10, 15

c)

Error

d)

Null

55.

Code Output: DECLARE str VARCHAR2(50) := 'Hello World'; v_count NUMBER := 0; ch CHAR(1); BEGIN FOR i IN 1..LENGTH(str) LOOP ch := SUBSTR(str, i, 1); IF LOWER(ch) IN ('a','e','i','o','u') THEN v_count := v_count + 1; END IF; END LOOP; DBMS_OUTPUT.PUT_LINE('Vowels: ' || v_count); END; / Output = ?

a)

Vowels: 2

b)

Vowels: 3

c)

Vowels: 4

d)

Error

56.

Which keyword is used to execute a standalone procedure?

a)

EXECUTE

b)

EXEC

c)

BEGIN-END block

d)

All of the above

57.

Procedures are stored in:

a)

User's local memory

b)

Database schema

c)

Only inside triggers

d)

Only inside packages

58.

In PL/SQL, factorial of 0 is returned as:

a)

Error

b)

0

c)

1

d)

NULL

59.

A function must have:

a)

OUT parameter

b)

RETURN statement

c)

Exception block

d)

Cursor

60.

Which statement is valid for default parameter assignment?

a)

p NUMBER = 5

b)

p NUMBER := 5

c)

p DEFAULT 5

d)

p OUT NUMBER := 5

61.

Code Output: DECLARE n NUMBER := 8; result NUMBER; BEGIN result := n * n; -- Square logic DBMS_OUTPUT.PUT_LINE(result); END; / Output = ?

a)

8

b)

16

c)

64

d)

Error

62.

Code Output: DECLARE price NUMBER := 400; disc NUMBER; BEGIN -- Suppose discount = 5% of price disc := price * 0.05; DBMS_OUTPUT.PUT_LINE(disc); END; / Output = ?

a)

5

b)

20

c)

400

d)

0

63.

Code Output: DECLARE qty NUMBER := 25; rate NUMBER := 4; total NUMBER; BEGIN total := qty * rate; -- multiplication DBMS_OUTPUT.PUT_LINE(total); END; / Output = ?

a)

0

b)

100

c)

29

d)

Error

64.

Functions can be called from:

a)

SELECT statements

b)

PL/SQL blocks

c)

Expressions

d)

All of the above

65.

What happens if a function does not contain a RETURN statement?

a)

It runs normally

b)

Compilation error

c)

Returns NULL

d)

Infinite loop

66.

Which keyword is used for exception handling in functions?

a)

TRY

b)

CATCH

c)

EXCEPTION

d)

ERROR

67.

Functions must always return:

a)

At least one OUT parameter

b)

Exactly one value

c)

Multiple values

d)

Nothing

68.

Which of the following can be reused both in SQL and PL/SQL blocks?

a)

Views only

b)

Procedures only

c)

Functions

d)

None