Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Questions

Lecture 15: Normalization

1. What is the primary objective of normalization in database design?

A) Minimize data anomalies


B) Maximize data redundancy
C) Optimize query performance
D) Increase data inconsistencies

2. What issue is associated with the table entries having data inconsistencies, such as
variations in the representation of job classes?

A) Update anomalies
B) Insertion anomalies
C) Deletion anomalies
D) Data redundancies

3. In normalization, what does the term "well-formed relations" refer to?

A) Tables with maximum redundancy


B) Tables with controlled inconsistencies
C) Tables with minimum controlled redundancy
D) Tables with transitive dependencies

4. In the context of dependencies, what is a partial dependency?

A) Dependency on the entire primary key


B) Dependency on part of the primary key
C) Dependency on a non-prime attribute
D) Dependency on a transitive attribute

5. During the conversion to 2NF, what is the purpose of writing each key component on a
separate line?

A) Normalize the data


B) Identify transitive dependencies
C) Divide the original table into multiple tables
D) Remove all dependencies from the table
6. What is the objective of conversion to 3NF in the normalization process?

A) Identify transitive dependencies


B) Remove repeating groups
C) Ensure each table represents a single subject
D) Remove dependent attributes from transitive dependencies

7. When is a table in Boyce-Codd Normal Form (BCNF)?

A) Every determinant is a candidate key


B) Every determinant is a foreign key
C) Every determinant is a composite key
D) Every determinant is a primary key

8. In database normalization, what is the term for a dependency where one non-prime attribute
depends on another non-prime attribute?

A) Partial dependency
B) Transitive dependency
C) Composite dependency
D) Multivalued dependency

9. What is the key requirement for a table to be in Fourth Normal Form (4NF)?

A) All attributes must be dependent on each other


B) All attributes must be independent of each other
C) A row may contain multiple multivalued facts
D) A row must contain two or more multivalued facts

10. According to the rules for 4NF, what is the limitation on attributes in a row?

A) Attributes must be dependent on each other


B) Attributes must be independent of each other
C) No row may contain two or more multivalued facts about an entity
D) All attributes must be composite keys

Lecture 16: Group By

1. When using the GROUP BY clause in SQL, what is the purpose of the HAVING clause?

A) To filter individual rows based on conditions.


B) To filter groups based on conditions.
C) To filter both rows and groups.
D) To order the results.

2. Which of the following is true about the ORDER BY clause when used with GROUP BY in
SQL?

A) ORDER BY must be the first clause in the query.


B) ORDER BY must be the last clause in the query.
C) ORDER BY must be placed before the GROUP BY clause.
D) ORDER BY must be placed after the HAVING clause.

3. What does the ROLLUP function do in SQL?

A) Creates subtotals from least detailed to grand total.


B) Creates subtotals from most detailed to grand total.
C) Filters groups based on conditions.
D) Orders the results.

4. In SQL, which clause is specifically designed to evaluate conditions based on group functions
such as SUM and COUNT?

A) WHERE clause
B) HAVING clause
C) GROUP BY clause
D) ORDER BY clause

5. When using GROUP BY and WHERE together, what is the order of execution in Oracle?

A) WHERE, GROUP BY
B) GROUP BY, WHERE
C) WHERE, HAVING
D) GROUP BY, HAVING

6. What is the purpose of the NVL function in SQL?

A) To return the total number of rows in a table.


B) To replace NULL values with a specified value.
C) To calculate the average of a column.
D) To filter groups based on conditions.

7. Which group function in SQL is used to find the total number of rows in a group?

A) SUM
B) AVG
C) COUNT
D) MIN

8. What does the DISTINCT clause do when used with the COUNT function in SQL?

A) Counts only unique values.


B) Counts all values.
C) Counts NULL values.
D) Counts only non-distinct values.

Lecture 17: Transaction Management

1. What is the primary purpose of a transaction in a database system?

A) Data retrieval
B) Data storage
C) Ensuring data consistency
D) Database optimization

2. Which of the following properties of transactions ensures that all operations of a transaction
are completed or none at all?

A) Atomicity
B) Consistency
C) Isolation
D) Durability

3. In the context of transactions, what does the COMMIT command do?**

A) Rolls back changes


B) Commits changes
C) Initiates a new transaction
D) Aborts the transaction

4. What is the purpose of the TRANSACTION LOG in a database management system?

A) Database recovery
B) Data retrieval
C) Query optimization
D) Transaction isolation
5. Which concurrency control problem occurs when two transactions are updating the same
data element, and one update is lost?

A) Inconsistent retrievals
B) Lost updates
C) Uncommitted data
D) Data isolation

6. What is the scheduler's role in a database management system?

A) Database optimization
B) Query execution
C) Ensuring serializability and isolation
D) Data recovery

7. What is lock granularity?

A) The size of a lock


B) The duration of a lock
C) The exclusivity of a lock
D) The strength of a lock

8. Which lock granularity allows concurrent transactions to access the same row if they require
different fields within that row?

A) Table-level lock
B) Page-level lock
C) Row-level lock
D) Field-level lock

9. What is the purpose of a shared lock in concurrency control?

A) Exclusive access
B) Read access
C) Write access
D) Lock escalation

10. What type of lock has only two states: locked or unlocked?

A) Shared lock
B) Exclusive lock
C) Binary lock
D) Field-level lock
Lecture 18: Sub-Queries

1. What is a correlated subquery?

A) A subquery that generates a list of values


B) A subquery that doesn't depend on the main query
C) A subquery that receives input from the main query
D) A subquery that is nested within another subquery

2. In SQL, which clause is used to compare a value to the result of a subquery?

A) HAVING
B) WHERE
C) JOIN
D) ON

3. What does the ROWNUM pseudo column represent in Oracle?

A) Number of rows in the table


B) Row number for the retrieved rows
C) Total number of rows in the result set
D) Sequential number assigned to each row

4. Which clause of the INSERT command allows the use of a subquery in Oracle 8i and later
versions?

A) SELECT
B) VALUES
C) FROM
D) INTO

5. What is the main purpose of the NOT EXISTS operator in a correlated subquery?

A) Checks for the existence of any row


B) Returns true if the subquery retrieves no row
C) Compares values using ALL operator
D) Compares values of columns

6. What is the purpose of the "ANY" keyword in a subquery?

A) To compare a value to any value in the result set


B) To specify any column in the subquery
C) To filter results using aggregate functions
D) To perform an outer join with the main query

Lecture 19: Views

1. What is a primary advantage of using a view in Oracle?

A) Reduces storage space


B) Speeds up query execution
C) Simplifies data retrieval
D) Enhances data security

2. In Oracle, what does the FORCE option do when creating a view?

A) Enforces constraints on the view


B) Allows view creation even if the base table doesn't exist
C) Forces the view to be read-only
D) Facilitates view renaming

3. When a view is created, the ORDER BY clause cannot be used in the query. What is the
reason for this limitation?

A) Views cannot be sorted


B) Oracle does not support ordering in views
C) Views automatically inherit the ordering of the base table
D) The result of a view is inherently unordered

4. How can a view be used to isolate an application from changes in the definition of tables?

A) By creating a view with a different schema


B) By creating a view on required tables and using it instead of the base table
C) By avoiding the use of views altogether
D) By storing application data in the view

5. In the context of views, what does the term "stored query" refer to?

A) A query that is stored in the database for later use


B) A query that includes stored procedures
C) A query that is stored within a view
D) A query that is stored in a cache

6. What does the USER_UPDATABLE_COLUMNS data dictionary view provide information


about?
A) Columns that can be modified in a view
B) Columns that are not updatable in a view
C) Columns that have been recently updated
D) Columns that can be modified in any table

7. What is the primary purpose of using a view in SQL?

A) To physically store data in a separate table


B) To provide a virtual, simplified representation of data
C) To enforce constraints on the underlying tables
D) To create temporary tables for complex queries

8. What is the purpose of the "WITH CHECK OPTION" clause when creating a view?

A) It specifies the columns to be included in the view.


B) It ensures that only certain rows are visible in the view.
C) It enforces a check on the underlying tables when updating the view.
D) It allows the view to include data from multiple databases.

9. Which of the following SQL statements is used to modify the definition of an existing view?

A) ALTER VIEW
B) UPDATE VIEW
C) MODIFY VIEW
D) CHANGE VIEW

10. Which SQL statement is used to remove a view from the database?

A) DELETE VIEW
B) REMOVE VIEW
C) DROP VIEW
D) ERASE VIEW

Lecture 20: PL/SQL

1. What is the primary advantage of using PL/SQL over SQL alone?

A) Improved syntax
B) Enhanced data retrieval
C) Support for procedural statements
D) Increased network traffic
2. Which PL/SQL unit is stored in the database with a name and can be executed using that
name?

A) Anonymous block
B) Constant
C) Stored procedure
D) Control structure

3. What is the purpose of the "Declarative part" in a PL/SQL block?

A) Execute SQL statements


B) Handle exceptions
C) Group logically related statements
D) Declare constants

4. Which operator is used for assigning a value to a variable in PL/SQL?

A) = operator
B) => operator
C) <- operator
D) := operator

5. How do stored procedures contribute to better application maintenance?

A) Increased complexity
B) Business logic duplication
C) Automatic client updates
D) Easy modification of concerned procedures

6. Why do stored procedures enhance security in a database?

A) They provide direct table access


B) They run with the user's privileges
C) They bypass security measures
D) They enforce data security by restricting table access

7. What is the main difference between a stored procedure and a function in PL/SQL?

A) Stored procedures have better performance


B) Functions return a value
C) Functions cannot take parameters
D) Stored procedures are more secure
8. Which of the following is a key difference between a stored procedure and a function in
PL/SQL?

A) Stored procedures can return values, while functions cannot.


B) Functions can have OUT parameters, while stored procedures cannot.
C) Stored procedures can be called from SQL queries, while functions cannot.
D) Functions must have a RETURN statement, while stored procedures do not require one.

9. Consider a function defined as follows:

FUNCTION calculate_bonus(salary NUMBER) RETURN NUMBER IS


bonus NUMBER;
BEGIN
bonus := salary * 0.1;
RETURN bonus;
END;

What will be the result of the function call calculate_bonus(50000)?

A) 500
B) 5000
C) 50000
D) 5

10. In PL/SQL, what will happen if an exception is raised but not handled in the current block or
its enclosing blocks?

A) The program will terminate abruptly.


B) The exception will be automatically logged to the database.
C) The program will continue executing the next statement after the exception block.
D) The exception will be propagated to the calling program.

11. What is a cursor in PL/SQL used for?

A) To perform mathematical calculations.


B) To process conditional statements.
C) To iterate over a result set from a SELECT query.
D) To handle exceptions in a program.

12. What does the FETCH statement do in PL/SQL with respect to cursors?

A) Closes the cursor.


B) Opens the cursor.
C) Retrieves the next row from the cursor result set.
D) Declares a new cursor.

Lecture 22: Triggers

1. What is the primary purpose of a database trigger in SQL?

A) Execute complex queries


B) Implement integrity constraints
C) Perform automatic actions on specific events
D) Define stored procedures

2. When might a trigger be more suitable than using integrity constraints?

A) When enforcing primary keys


B) When implementing complex business rules
C) When inserting new rows
D) When creating indexes

3. How does a trigger differ from a stored procedure in SQL?

A) Triggers are called explicitly; procedures are called implicitly


B) Procedures are fired only once; triggers are fired multiple times
C) Triggers are fired implicitly by the database on specific events
D) Procedures are associated with events in the database

4. What is the key characteristic of a statement-level trigger?

A) Fired once for each affected row


B) Fired multiple times for each affected row
C) Fired once for a DML statement
D) Fired before the triggering action is completed

5. What is the default correlation name for accessing new values in a row-level trigger?

A) CURRENT
B) NEXT
C) NEW
D) LATEST

6. How can you determine which DML command fired a trigger in SQL?

A) By using the EXECUTING predicate


B) By checking the COMMAND attribute
C) By using conditional predicates like INSERTING, DELETING, UPDATING
D) By examining the TRIGGER_SOURCE column

7. What is the main purpose of the REFERENCING option in creating a trigger?

A) To reference external files


B) To refer to other triggers
C) To avoid naming conflicts between tables and correlation names
D) To reference stored procedures

8. How can you drop a trigger in SQL when it is no longer needed?

A) DELETE TRIGGER
B) REMOVE TRIGGER
C) DROP TRIGGER
D) ERASE TRIGGER

9. When does a BEFORE trigger in SQL execute?

A) Before a transaction is committed.


B) After a transaction is committed.
C) Before a row is updated or deleted.
D) After a row is updated or deleted.

10. In SQL, what is the purpose of an AFTER trigger?

A) To prevent changes to data in the table.


B) To execute before the triggering event occurs.
C) To perform actions after the triggering event (e.g., INSERT, UPDATE, DELETE).
D) To execute in place of a stored procedure.

11. What is the primary use of triggers in a database?

A) To create temporary tables.


B) To enforce referential integrity.
C) To encapsulate complex queries.
D) To automate actions in response to database events.

Lecture: NoSQL

1. What does NoSQL stand for?


A) New Object Structured Query Language
B) Non-relational Structured Query Language
C) Not Only SQL
D) Non-Schema Query Language

2. Which of the following is a common characteristic of NoSQL databases?

A) Strict adherence to the ACID properties


B) Fixed and rigid schema design
C) Horizontal scalability
D) Exclusively relational data model

3. Which data model is associated with MongoDB?

A) Relational
B) Key-Value
C) Document-Oriented
D) Graph

4. What is the primary advantage of using a flexible schema in NoSQL databases?

A) Enhanced data integrity


B) Improved query performance
C) Easier adaptation to evolving data requirements
D) Strong support for complex transactions

5. Which theorem is often considered when discussing the trade-offs in distributed systems,
including NoSQL databases?

A) Pythagorean Theorem
B) CAP Theorem
C) Fermat's Last Theorem
D) Gödel's Incompleteness Theorems

6. In the context of NoSQL databases, what does "BASE" stand for?

A) Basic Availability, Strong Consistency, Elasticity


B) Balanced Availability, Soft state, Elasticity
C) Basically Available, Soft state, Eventually consistent
D) Balanced Availability, Strong Consistency, Elasticity

7. Which NoSQL database is known for its support of key-value pairs and in-memory caching?
A) Cassandra
B) MongoDB
C) Redis
D) Couchbase

8. What type of NoSQL database is Apache Cassandra known to be?

A) Document-Oriented
B) Key-Value
C) Column-Family
D) Graph

9. Which characteristic is typically associated with NoSQL databases in terms of scalability?

A) Vertical scalability
B) Horizontal scalability
C) Linear scalability
D) Static scalability

10. In NoSQL databases, which term refers to the process of distributing data across multiple
servers to improve performance and reliability?

A) Fragmentation
B) Sharding
C) Replication
D) Normalization

Lecture: MongoDB

1. What type of database is MongoDB?

A) Relational Database
B) Document-Oriented Database
C) Key-Value Database
D) Graph Database

2. What is a collection in MongoDB?

A) A group of related fields


B) A table
C) A JSON document
D) A set of related documents
3. In MongoDB, what is the purpose of the find() method?

A) To insert documents into a collection


B) To update documents in a collection
C) To retrieve documents from a collection
D) To delete documents from a collection

4. What does the limit() method do in a MongoDB query?

A) Limits the number of documents returned in the result


B) Limits the number of fields in each document
C) Limits the execution time of the query
D) Limits the type of data returned in the query

5. Which MongoDB operator is used to specify greater than in a query?

A) $gt
B) $lt
C) $gte
D) $lte

6. How do you perform a query with AND condition in MongoDB?

A) Use the AND keyword


B) Separate conditions with a comma
C) Use the $and operator
D) MongoDB does not support AND conditions

7. What is the purpose of the sort() method in MongoDB queries?

A) To alphabetically sort field names in the documents


B) To sort the documents based on specified criteria
C) To randomly order the documents
D) To sort the fields within each document

8. Which MongoDB operator is used to perform a query for values within a specified range?

A) $in
B) $exists
C) $between
D) $range
9. Which MongoDB method is used to count the number of documents returned by a query?

A) count()
B) total()
C) size()
D) length()

Answers

Lecture 15: Normalization


1. A
2. A
3. C
4. B
5. C
6. D
7. A
8. B
9. B
10. C

Lecture 16: Group By


1. C
2. B
3. A
4. B
5. A
6. B
7. C
8. A

Lecture 17: Transaction Management

1. C
2. A
3. B
4. A
5. B
6. C
7. A
8. D
9. B
10. C

Lecture 18: Sub-Queries


1. C
2. B
3. B
4. B
5. B
6. A

Lecture 19: Views


1. C
2. B
3. D (B is fine too, i think)
4. B
5. C
6. A
7. B
8. C
9. A
10. C

Lecture 20: PL/SQL


1. C
2. C
3. D
4. D
5. D
6. D
7. B
8. D
9. B
10. A
11. C
12. C
Lecture 22: Triggers
1. C
2. B
3. C
4. C
5. C
6. C
7. C
8. C
9. C
10. C
11. D

Lecture: NoSQL
1. C
2. C
3. C
4. C
5. B
6. C
7. C
8. C
9. B
10. B

Lecture: MongoDB
1. B
2. D
3. C
4. A
5. A
6. C
7. B
8. A
9. A

You might also like