wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Assignment for MSE+CIE-2

Total questions: 20

Worksheet time: 19mins

Name
Class
Date
1.

1. Which of the following is not a built in aggregate function in SQL?

a)

avg

b)

max

c)

total

d)

count

2.

Observe the given SQL query and choose the correct option.

SELECT branch_name, COUNT (DISTINCT customer_name) FROM depositor, account WHERE depositor.account_number = account.account_number GROUP BY branch_id

a)

a) The query is syntactically correct but gives the wrong answer

b)

b) The query is syntactically wrong

c)

c) The query is syntactically correct and gives the correct answer

d)

d) The query contains one or more wrongly named clauses.

3.

State true or false: We can rename the resulting attribute after the aggregation function has been applied

a)

true

b)

false

c)

none

4.

What values does the count(*) function ignore?

a)

a) Repetitive values

b)

b) Null values

c)

c) Characters

d)

d) Integers

5.

Which of the following is a good database management practice?

a)

a) Adding redundant attributes

b)

b) Not specifying primary keys

c)

c) Removing redundant attributes

d)

d) None of the mentioned

6.

Which of the following command is used to obtain the structure of an Oracle table?

a)

a) DESC TABLE [TableName].

b)

b) STRUCTURE [TableName].

c)

d) DESCRIBE STRUCTURE [TableName].

d)

c) DESC [TableName].

7.

What would be printed when the following code is executed?

DECLARE x NUMBER;

BEGIN

x := 5;

x := 10;

dbms_output.put_line(-x);

dbms_output.put_line(+x);

x := -10;

dbms_output.put_line(-x);

dbms_output.put_line(+x);

END;

a)

-10

10

10

-10

b)

-10

10

-10

10

c)

10

10

-10

-10

d)

-5

10

10

-10

10

8.

Which of the following is true about the execution section of a PL/SQL block?

a)

A - It is enclosed between the keywords BEGIN and END.

b)

B - It is a mandatory section.

c)

C - It consists of the executable PL/SQL statements.

d)

D - All of the above

9.

What does PL/SQL stand for?

a)

PL/SQL stands for Procedural Language Extension of SQ

b)
  1. PL/SQL stands for Primary Language Extension of SQL

c)
  1. PL/SQL stands for Pattern Language Extension of SQL

d)
  1. PL/SQL stands for Private Language Extension of SQL

10.

PL/SQL text is made up of lexical units, which are groups of characters and can be classified as –

a)
  1. Delimiters

b)
  1. Identifiers

c)
  1. Literals

d)
  1. All of the above

11.

PL/SQL Variables are by default

a)
  1. Case Sensitive

b)
  1. Upper Case Sensitive

c)
  1. Lower Case Sensitive

d)
  1. Not Case Sensitive

12.

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

a)
  1. Cursor

b)
  1. Procedure

c)
  1. Function

d)
  1. View

13.

The Implicit cursors are created in order to process the ____ statements.

a)
  1. DDL

b)
  1. DCL

c)

TCL

d)

DML

14.

Which of the following is/are an/the implicit cursor's attribute(s)?

a)
  1. %FOUND

b)
  1. %ROWCOUNT

c)
  1. %ISOPEN

d)
  1. All of the above

15.

The correct syntax to declare PL/SQL variable is –

a)
  1. variable_name [CONSTANT] datatype [NOT NULL] [:= | DEFAULT initial_value]

b)
  1. datatype [CONSTANT] variable_name [NOT NULL] [:= | DEFAULT initial_value]

c)
  1. variable_name [CONSTANT] datatype [NULL] [:= | DEFAULT initial_value]


d)
  1. datatype [CONSTANT] variable_name [NULL] [:= | DEFAULT initial_value]


16.

What is a foreign key?

a)

A foreign key is a primary key of a relation which is an attribute in another relation

b)

A foreign key is a superkey of a relation which is an attribute in more than one other relations

c)

A foreign key is an attribute of a relation that is a primary key of another relation

d)

A foreign key is the primary key of a relation that does not occur anywhere else in the schema

17.

What action does ⋈ operator perform in relational algebra

a)

Output specified attributes from all rows of the input relation and remove duplicate tuples from the output

b)

Outputs pairs of rows from the two input relations that have the same value on all attributes that have the same name

c)

Output all pairs of rows from the two input relations (regardless of whether or not they have the same values on common attributes)

d)

Return rows of the input relation that satisfy the predicate

18.

Choose the option that correctly explains in words, the function of the following relational algebra expression
σyear≥2009 (book ⋈ borrow)

a)

Selects all tuples from the Cartesian product of book and borrow

b)

Selects all the tuples from the natural join of book and borrow wherever the year is lesser than 2009

c)

Selects all the tuples from the natural join of book and student wherever the year is greater than or equal to 2009

d)

Selects all tuples from the Cartesian product of book and borrow wherever the year is greater than or equal to 2009

19.

Which of the following creates a virtual relation for storing the query?

a)

Function

b)

View

c)

Procedure

d)

None of the mentioned

20.

CREATE VIEW faculty AS

SELECT ID, name, dept name

FROM instructor;

Find the error in this query.

a)

Instructor

b)

Select

c)

View …as

d)

None of the mentioned