1.
What is a database?
Correct Answer
B. A collection of structured data
Explanation
A database is a collection of structured data because it organizes and stores information in a systematic way. Structured data refers to data that is organized into predefined categories and follows a consistent format. In a database, data is typically stored in tables with rows and columns, allowing for efficient storage, retrieval, and manipulation of information. This structure enables users to easily search, sort, and analyze the data, making it a valuable tool for managing and accessing large amounts of information.
2.
Which of these is referred to as a specified number of columns in a table?
Correct Answer
C. Fields
Explanation
Fields are referred to as a specified number of columns in a table. In a database table, each field represents a specific piece of information or attribute. It is used to define the structure and organization of the data stored in the table. Fields can contain different types of data such as text, numbers, dates, etc. They are essential for categorizing and organizing data in a table, allowing for efficient storage and retrieval of information.
3.
Which of these is a combination of fields which uniquely specify a row?
Correct Answer
D. Primary key
Explanation
A primary key is a combination of fields that uniquely identifies each row in a database table. It ensures that each row has a unique identifier, which helps in maintaining data integrity and enforcing uniqueness constraints. Other keys such as unique key, foreign key, and surrogate key may also have unique values, but a primary key is specifically designed to uniquely identify each row in a table.
4.
The first normal form (1NF) is used to...
Correct Answer
A. Remove all duplicate columns
Explanation
The first normal form (1NF) is used to remove all duplicate columns from a database table. This means that each column in the table should contain only atomic values and not repeat any information. This helps in organizing the data in a structured manner and avoids redundancy. By removing duplicate columns, the database becomes more efficient and easier to manage.
5.
Which of these is a not a type of index?
Correct Answer
B. Ordinary index
Explanation
An ordinary index is not a type of index because it is not a commonly recognized or defined type of index in database systems. Unique index, clustered index, and unclustered index are all well-known types of indexes used to optimize data retrieval and improve database performance. However, there is no standard definition or widely accepted concept of an "ordinary index" in the field of database management.
6.
How many cluster indexes can be found in a table?
Correct Answer
A. 1
Explanation
A table can have only one cluster index. A cluster index determines the physical order of the data in a table. It reorganizes the table's data rows to match the index's order, which can improve query performance. Having multiple cluster indexes would contradict the purpose of a cluster index, as it is meant to define the physical order of the data in the table. Therefore, the correct answer is 1.
7.
A code written to get information back from the database is called...
Correct Answer
B. Query
Explanation
A code written to get information back from the database is called a query. Queries are used to retrieve specific data from a database by specifying the criteria for the search. They allow users to extract the required information by requesting it from the database. Therefore, a query is the correct term to describe this type of code.
8.
What are the types of subquery?
Correct Answer
A. Correlated and non-correlated
Explanation
The correct answer is correlated and non-correlated. A subquery is a query nested within another query. In a correlated subquery, the inner query depends on the result of the outer query, and it is executed for each row of the outer query. On the other hand, a non-correlated subquery is independent of the outer query and can be executed separately. These types of subqueries are used to retrieve specific data based on certain conditions and are commonly used in SQL queries.
9.
The Scala user function is primarily used to return _____ from the database.
Correct Answer
B. Unit
Explanation
The Scala user function is primarily used to return nothing from the database. In Scala, the Unit type represents the absence of a value, similar to void in other programming languages. When a function in Scala does not need to return any specific value, it can be declared as having a return type of Unit. Therefore, the correct answer is Unit.
10.
Which of these operators is used to return rows from the first query but not from the second query?
Correct Answer
C. MINUS
Explanation
The MINUS operator is used to return rows from the first query but not from the second query. It compares the result sets of two queries and returns the rows from the first query that are not present in the second query. This allows for finding the differences between two result sets and obtaining only the unique rows from the first query.