Unit 3 - Practice Quiz

INT306 50 Questions
0 Correct 0 Wrong 50 Left
0/50

1 Which of the following SQL aggregate functions ignores NULL values by default?

A. COUNT(*)
B. SUM()
C. ROW_NUMBER()
D. ISNULL()

2 In SQL, which clause is used to filter the results of an aggregate function?

A. WHERE
B. HAVING
C. GROUP BY
D. ORDER BY

3 What is the result of COUNT(column_name) if the column contains the values: [10, NULL, 20, 10, NULL]?

A. 2
B. 3
C. 4
D. 5

4 Which SQL keyword is used to eliminate duplicate rows before an aggregate function is applied?

A. UNIQUE
B. DIFFERENT
C. DISTINCT
D. SEPARATE

5 Which type of join returns all rows from the left table and the matched rows from the right table, filling NULL where no match is found?

A. INNER JOIN
B. RIGHT OUTER JOIN
C. LEFT OUTER JOIN
D. FULL OUTER JOIN

6 If Table A has rows and Table B has rows, how many rows will the Cartesian Product () yield?

A.
B.
C.
D.

7 Which join operation is equivalent to a Cartesian Product followed by a selection based on a condition?

A. CROSS JOIN
B. INNER JOIN
C. NATURAL JOIN
D. UNION

8 A join in which a table is joined with itself is called a:

A. Self Join
B. Equi Join
C. Natural Join
D. Outer Join

9 Which set operator combines the result sets of two queries and removes duplicate rows?

A. UNION ALL
B. UNION
C. INTERSECT
D. MINUS

10 Which set operator returns only the rows that appear in BOTH result sets?

A. UNION
B. EXCEPT
C. INTERSECT
D. CROSS JOIN

11 To use set operators like UNION or INTERSECT, the participating queries must be:

A. Join compatible
B. Union compatible
C. Index compatible
D. View compatible

12 What is the equivalent of the SQL EXCEPT operator in Oracle SQL?

A. REMOVE
B. DELETE
C. MINUS
D. DISCARD

13 Which of the following statements about SQL Views is TRUE?

A. A view physically stores data.
B. A view is a virtual table derived from a query.
C. Views cannot be used in SELECT statements.
D. Views are always faster than the underlying query.

14 Which command is used to remove a view definition from the database?

A. DELETE VIEW
B. REMOVE VIEW
C. DROP VIEW
D. TRUNCATE VIEW

15 A view is generally considered updatable if:

A. It contains a GROUP BY clause.
B. It uses DISTINCT.
C. It maps 1-to-1 with a single base table without aggregation.
D. It involves a complex multi-table join.

16 What is a Correlated Subquery?

A. A subquery that runs once for the entire parent query.
B. A subquery that references a column from the outer query.
C. A subquery used in the FROM clause.
D. A subquery that returns multiple columns.

17 Which operator is best suited for a subquery that returns multiple rows to be compared against a single value?

A. =
B. IN
C. IS
D. LIKE

18 The EXISTS operator returns TRUE if:

A. The subquery returns at least one row.
B. The subquery returns exactly one row.
C. The subquery returns NULL.
D. The subquery returns no rows.

19 In Relational Algebra, which operator is represented by the symbol (sigma)?

A. Projection
B. Selection
C. Rename
D. Cartesian Product

20 In Relational Algebra, which operator is represented by the symbol (pi)?

A. Projection
B. Selection
C. Join
D. Union

21 Which Relational Algebra operator is used to change the name of a relation or its attributes, denoted by (rho)?

A. Project
B. Rename
C. Select
D. Divide

22 The intersection of two relations and () can be expressed using fundamental operators as:

A.
B.
C.
D.

23 Which Relational Algebra operation is denoted by the symbol ?

A. Natural Join
B. Division
C. Cartesian Product
D. Selection

24 The Division operator () is typically used to answer queries containing the keyword:

A. ANY
B. AT LEAST ONE
C. ALL
D. NONE

25 In Relational Algebra, if relation has degree and relation has degree , what is the degree of ?

A.
B.
C.
D.

26 Which of the following is NOT a fundamental operator in Relational Algebra (i.e., it can be derived from others)?

A. Selection ()
B. Projection ()
C. Natural Join ()
D. Union ()

27 What distinguishes an SQL Window Function from a standard Aggregate Function?

A. Window functions collapse rows into a single result.
B. Window functions return a value for every row in the window without collapsing them.
C. Window functions cannot be used with numbers.
D. Window functions must use a GROUP BY clause.

28 Which clause defines the scope (set of rows) for a Window Function?

A. WITH
B. OVER
C. INTO
D. USING

29 What is the difference between RANK() and DENSE_RANK()?

A. RANK() leaves gaps in numbering after ties; DENSE_RANK() does not.
B. DENSE_RANK() leaves gaps in numbering; RANK() does not.
C. RANK() is for numbers; DENSE_RANK() is for strings.
D. They are identical.

30 Which window function assigns a unique sequential integer to rows within a partition?

A. RANK()
B. NTILE()
C. ROW_NUMBER()
D. LAG()

31 In hashing, a situation where two different search keys hash to the same bucket is called a:

A. Union
B. Collision
C. Overflow
D. Probe

32 Which hashing technique allows the directory size to grow or shrink dynamically as records are added or deleted?

A. Static Hashing
B. Linear Probing
C. Extendible Hashing
D. Chained Hashing

33 Static Hashing performance degrades significantly when:

A. The hash function is too complex.
B. The bucket size is too large.
C. The number of records exceeds the designed capacity, causing overflow chains.
D. The keys are integers.

34 A data structure that maps search keys to pointers where the records are stored is called an:

A. Index
B. View
C. Trigger
D. Schema

35 In a Clustered Index, how is the data file sorted?

A. It is not sorted.
B. It is sorted according to the index key.
C. It is sorted by the primary key only.
D. It is sorted randomly.

36 What is a Dense Index?

A. An index record appears for every search key value in the file.
B. An index record appears only for some search key values.
C. An index that takes up more space than the data.
D. An index on a non-unique column.

37 Which indexing structure consists of a balanced tree where all leaf nodes are at the same level?

A. Binary Search Tree
B. B+ Tree
C. Hash Index
D. Linear List

38 In a B+ Tree, pointers to the actual data records are stored in:

A. The root node only.
B. Internal nodes only.
C. Leaf nodes only.
D. Both internal and leaf nodes.

39 Which of the following creates a composite index?

A. CREATE INDEX idx ON Table(Col1)
B. CREATE INDEX idx ON Table(Col1, Col2)
C. CREATE INDEX idx ON Table(Col1) AND Table(Col2)
D. CREATE COMPOSITE idx ON Table(Col1)

40 Hash indices are optimized for which type of query?

A. Range queries (e.g., )
B. Equality queries (e.g., )
C. Pattern matching (e.g., LIKE 'A%')
D. Sorting (ORDER BY)

41 What is Query Optimization in a DBMS?

A. Writing shorter SQL queries.
B. The process of selecting the most efficient execution plan for a query.
C. Removing unused indexes.
D. Compressing the database storage.

42 In Query Optimization, what is a heuristic rule?

A. A rule based on precise mathematical proof.
B. A rule of thumb to reduce the search space, like 'perform selections early'.
C. A rule that uses brute force to check all plans.
D. A rule that requires user intervention.

43 Why is 'Pipelining' used in query execution?

A. To store all intermediate results on disk.
B. To pass the output of one operator directly to the next without waiting for the first to complete entirely.
C. To execute queries in parallel on different machines.
D. To rename columns automatically.

44 Which information is primarily used by a Cost-Based Optimizer (CBO)?

A. The length of the SQL query string.
B. Database statistics (e.g., table size, histogram of values).
C. The name of the tables.
D. The creation date of the database.

45 In Relational Algebra optimization, the expression is equivalent to:

A.
B.
C.
D.

46 What is a Materialized View?

A. A standard virtual view.
B. A view whose result is physically computed and stored on disk.
C. A view that is only available in memory.
D. A view that cannot be updated.

47 The 'Scan' operation in query processing refers to:

A. Reading every record in a relation.
B. Using an index to find a record.
C. Sorting the relation.
D. Joining two relations.

48 In the context of Join Optimization, if we join a small table with a very large table, which algorithm is generally preferred if an index exists on the large table?

A. Nested Loop Join
B. Index Nested Loop Join
C. Block Nested Loop Join
D. Cartesian Product

49 Which transformation rule allows moving a Projection () down the query tree?

A. Projection Cascade
B. Selection Pushdown
C. Join Commutativity
D. Associativity

50 What is the primary goal of the 'Selection Pushdown' optimization technique?

A. To sort the data earlier.
B. To reduce the number of rows (cardinality) as early as possible.
C. To increase the number of joins.
D. To convert the query into a view.