Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Mastering PL/SQL and NoSQL Concepts

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

What is the purpose of the IF-THEN control structure in PL/SQL?

a)

To handle exceptions and errors in code.

b)

To execute code conditionally based on a specified condition.

c)

To declare variables in PL/SQL.

d)

To define a loop for repeated execution.

2.

How does the IF-THEN-ELSE statement differ from IF-THEN?

a)

IF-THEN-ELSE can only be used in functions, whereas IF-THEN can be used anywhere.

b)

The IF-THEN-ELSE statement includes an alternative action for when the condition is false, while IF-THEN does not.

c)

IF-THEN-ELSE is used only for loops, while IF-THEN is for conditional statements.

d)

IF-THEN-ELSE requires a boolean expression, while IF-THEN does not.

3.

Explain the use of ELSIF in PL/SQL control structures.

a)

ELSIF allows for multiple conditional checks in PL/SQL control structures.

b)

ELSIF is used to terminate a PL/SQL block.

c)

ELSIF can only be used once in a control structure.

d)

ELSIF is a synonym for the IF statement.

4.

What is a CASE statement and how is it used in PL/SQL?

a)

A CASE statement is used to create tables in PL/SQL.

b)

A CASE statement is a method for defining variables in PL/SQL.

c)

A CASE statement is a control structure for conditional logic in PL/SQL, used to evaluate conditions and return values based on the first true condition.

d)

A CASE statement is a type of loop structure in PL/SQL.

5.

What are stored procedures in PL/SQL and how are they created?

a)

Stored procedures are temporary PL/SQL blocks created using the CREATE TEMPORARY statement.

b)

Stored procedures are created using the INSERT PROCEDURE statement.

c)

Stored procedures are named PL/SQL blocks stored in the database, created using the CREATE PROCEDURE statement.

d)

Stored procedures are only used for data retrieval and cannot modify data.

6.

Define triggers in PL/SQL and explain their purpose.

a)

Triggers can only be executed manually by users.

b)

Triggers are a type of data type in PL/SQL.

c)

Triggers are only used for logging purposes.

d)

Triggers in PL/SQL are procedures that automatically execute in response to specific events on a table, serving purposes like enforcing rules and maintaining data integrity.

7.

What is the difference between a function and a procedure in PL/SQL?

a)

A function can only be called once; a procedure can be called multiple times.

b)

A procedure always returns a value; a function does not.

c)

A function is used for data manipulation; a procedure is used for data retrieval.

d)

A function returns a value; a procedure does not.

8.

How do you create a package in PL/SQL?

a)

CREATE OR REPLACE PACKAGE package_name AS procedure_name; END package_name; CREATE OR REPLACE PACKAGE BODY package_name AS procedure_name IS BEGIN -- implementation END procedure_name; END package_name;

b)

CREATE PACKAGE BODY package_name; procedure_name IS BEGIN END;

c)

CREATE OR REPLACE PACKAGE package_name; procedure_name; END package_name;

d)

CREATE PACKAGE package_name AS procedure_name; END;

9.

What are cursors in PL/SQL and why are they used?

a)

Cursors are used to store static data in PL/SQL.

b)

Cursors are used in PL/SQL to manage and process query results row by row.

c)

Cursors are a type of variable used for error handling in PL/SQL.

d)

Cursors are used to define the structure of a database table in PL/SQL.

10.

Explain the concept of exception handling in PL/SQL blocks.

a)

Exception handling in PL/SQL blocks is managed using the 'EXCEPTION' section to catch and handle runtime errors.

b)

PL/SQL blocks do not support exception handling; all errors must be resolved manually.

c)

Exception handling in PL/SQL blocks is done using the 'BEGIN' section to initiate processes.

d)

The 'CATCH' section is used in PL/SQL for exception handling instead of 'EXCEPTION'.

11.

What is a NoSQL database and how does it differ from SQL databases?

a)

NoSQL databases are only used for structured data and require complex queries.

b)

A NoSQL database is a non-relational database that differs from SQL databases by allowing flexible data models and handling unstructured data, while SQL databases use structured schemas and relational data.

c)

SQL databases are designed to handle unstructured data and provide flexible data models.

d)

A NoSQL database is a type of SQL database that uses fixed schemas.

12.

Describe the CRUD operations in the context of NoSQL databases.

a)

Create, Retrieve, Modify, and Erase

b)

Construct, Read, Alter, and Delete

c)

CRUD operations in NoSQL databases are Create, Read, Update, and Delete.

d)

Create, Read, Write, and Remove

13.

What are the advantages of using NoSQL databases over traditional SQL databases?

a)

Advantages of NoSQL databases include flexibility in data models, horizontal scalability, lower latency, and support for various data types.

b)

Higher costs for scaling infrastructure

c)

Strict adherence to a fixed schema

d)

Increased complexity in data management

14.

How can you perform a read operation in a NoSQL database?

a)

Perform a write operation to read data.

b)

Access the data directly from the server's file system.

c)

Use a SQL query to fetch data from the database.

d)

Use the database's query method to retrieve data from a specified collection or table.

15.

What is the significance of the 'RETURN' statement in a PL/SQL function?

a)

The 'RETURN' statement is used to pass control back to the calling environment and can return a value from the function.

b)

The 'RETURN' statement is used to exit a function without returning a value.

c)

The 'RETURN' statement is optional in PL/SQL functions.

d)

The 'RETURN' statement is used to define the output parameters of a function.