0

Online Test 2 - Database Management System

Description: GATE Online Test 2 - Database Management System (DBMS)
Number of Questions: 25
Created by:
Tags: DBMS GATE CS
Attempted 0/25 Correct 0 Score 0

To be considered minimally relational, the DBMS must support of the following key relational functions.

  1. SELECT, PROJECT, UNION

  2. SELECT, PROJECT, JOIN

  3. SELECT, UNION, JOIN

  4. SELECT, UNION, INTERSECT


Correct Option: B
Explanation:

Relational algebra defines the theoretical way of manipulating table contents using the eight relational functions. To be considered minimally relational, the DBMS must support the key relational functions SELECT, PROJECT and JOIN.

The successful execution of a database despite the possibility of system failure is called

  1. atomicity

  2. consistence

  3. durability

  4. integrity


Correct Option: C
Explanation:

Durability indicates the performance of the database's consistent state. When a transaction is completed the database reaches a consistent state and that state cannot be lost, even in the event of a system failure.

Find the odd man out.

  1. Desktop database

  2. Work group database

  3. Distributed database

  4. Enterprise database


Correct Option: C
Explanation:

Desktop database, workgroup database and enterprise database is the classification of DBMS according to number of users where a distributed DBMS is classification according to database site location.

Database that are designed and managed specifically to meet information needs are called

  1. production databases

  2. transaction database

  3. data warehouses

  4. database management system


Correct Option: C
Explanation:

Production database are also known as transaction databases. Although such database yield streams of useful information, there are specialized databases, known as data warehouses that are designed and managed specifically to meet information needs. The data warehouses derive their data from production databases.

A file system is said to exhibit data dependence, because

  1. a change in any file's structure such as the addition or deletion of a field, requires the modification of all programs using that file

  2. organization of the data, within the file is determined by the data's expected use

  3. data is the most important part of a file system, which also includes hardware software, people and procedures

  4. when any of the files data characteristics change, all data access programs are subjects to change


Correct Option: D
Explanation:

A file system is said to exhibit structural dependence because a change in any file's structure such as addition or deletion of a field, requires modification of all programs using that file. That means access to a file is dependent on its structure.

Which of the following statements/ statement are true? (i) In SQL you can create virtual tables. (ii) SQL is only data manipulation language. (iii) WHERE clause applies to output of a GROUP BY command. (iv) HAVING clause applies to column and expressions for individual rows.

  1. (i), (ii), (iii)

  2. All the above

  3. (i)

  4. (i), (iii), (iv)


Correct Option: C
Explanation:

In SQL, we can create virtual tables.

Choose the odd man out.

  1. AVG

  2. INT

  3. DATE

  4. BOOLEAN


Correct Option: A
Explanation:

AVG is an aggregate function where INT, DATE, BOOLEAN are the data types in SQL.

The data retrieval time factor is most critical for

  1. transactional DBMS

  2. decision DBMS

  3. data warehouse

  4. both (2) and (3)


Correct Option: A
Explanation:

Transactions such as product or service sates payments and supply purchases reflect critical day to day operations such transactions are time critical and must be recorded accurately and immediately.

Match the following.

1. SELECT (a) Vertical subset of a tuple
2. PROJECT (b) Horizontal subset of a tuple
(c) Common tuples
  1. 1 - a, 2 - b

  2. 1 - b, 2 - a

  3. 1 - c, 2 - a

  4. 1 - c, 2 - b


Correct Option: B
Explanation:

SELECT yields for all attributes found in a table. SELECT can be used to list all of the row's values for each attribute, or it can yield selected rows values for each attribute. In other worlds SELECT yields a horizontal subset of a table.PROJECT produces a list of all values for selected attributes. In other words, PROJECT yields a vertical subset of a table.

Which of the following statements are equivalent?

(I) LIKE '_ _ _ %' (II) LIKE '% _ _ _'
(III) LIKE '%_ _%' (IV) LIKE '%_ _ _ %'
(V) '%%%_%'
  1. I and II only

  2. I, II, IV, and V

  3. I, II, III, IV

  4. I, II, III, IV, V


Correct Option: B
Explanation:

I, II, IV and V corresponds to any string of at least 3 characters.

Suppose we are having relation schema as student (name, student-id, degree-level) with primary key as student-id. (i) INSERT INTO student VALUES. (“Himani”, 1928, “B.E.”) (ii) DELETE FROM student (iii) INSERT INTO student VALUES (“Hemant”, 1220, “B. Tech”) (iv) ALTER TABLE student ADD ( subject varchar(20)) (v) ALTER TABLE student DROP subject. What will be the results of the above sequence?

  1. Gives error, since we are deleting the table.

  2. In student $\theta$ table we add new attributes as subject.

  3. In student table we have one tuple with values “Hitesh”, 1220,”B.tech”.

  4. In student table we have one tuple with value “Hitesh”, 1928. an “B.E”.


Correct Option: C
Explanation:

First we insert values in student table as “Hitesh”, 1928, “B.E”. Then we delete tuple from student but table is still known to database, if it is an empty relation.After that we again inserting tuple into student having values “Hitesh”, 1220, and “B.Tech”After that by using ALTER command we add one attribute as subject.After that we again use ALTER command to drop attribute subject.So we remain with student relation having values “Hitesh”, 1220,'B.Tech”

Which of the following statements is/are correct?

(i) SQL allows use of DISTINCT with count (*).

(ii) If is not legal to use DISTANCE with MAX and MIN.

(iii) If is ‘WHERE’ clause and a ‘HAVING’ clause appear in the same clause is applied first.

(iv) By default, the ‘ORDER BY’ clause list items in a descending order.

  1. All of the above

  2. (i), (ii), (iii)

  3. (ii), (iii)

  4. (iii)


Correct Option: D
Explanation:

Only statement (iii) is correct. SQL does not allow use of distance with COUNT(*). If is legal to use DISTINCT MAX and MIN. By default the ‘ORDER BY’ clause list items in an ascending order.

LIKE “abcd%” ESCAPE ‘’- The statement matches

  1. all strings beginning with “abcd”

  2. all strings ending with “abcd”

  3. all string beginning with “abcd%”

  4. error in SQL


Correct Option: A
Explanation:

Since, backslash () is an escape character, the string must be inserted after "abcd ". 

Which of the following is not supported by the hierarchical database model?

  1. Structural independence

  2. Data independence

  3. Database integrity

  4. Database security


Correct Option: A
Explanation:

The most important advantages of hierarchical models are conceptual simplicity, database security, data independence, database integrity and efficiency. Hierarchical database model lacks structural independence.

Which of the following is (are) true with respect to SQL?

(I) SQL is case insensitive

(II) Patterns used for comparison of string are case sensitive

(III) FROM and fROM are equivalent and mean the same keyword

(IV) String 'Mr' is not equal to string 'MR'

  1. (I) , (II) and (III) only

  2. (I) and (IV) only

  3. (II), (III) and (IV) only

  4. (I) , (II), (III) and (IV) only


Correct Option: D
Explanation:

SQL is case insensitive, meaning that it treats upper and lower case letters as the same letter.$\therefore$ Statements (I) and (III) are true.But patterns used for comparison of string are case sensitive. Instead all inside quotes is case sensitive. $\therefore$ Statements (II) and (IV) are also true hence, (4) is the answer.

Consider the relation schema as follows. Employee (employee-name, sheet, city) Works (employee-name, company-name, salary) Company (Company-name, city) Manages (Employee-name, manager-name)

Write a SQL query that gives the names of the employee who works in the same city and having salary greater than equal to 17000 and less than equal to 35500.

  1. SELECT employee-name FROM employee, works, company WHERE salary between 17000 and 35500

  2. SELECT employee-name FROM employee, works, company GROUP BY company, city having salary between 17000 and 35500

  3. SELECT employee-name FROM employee, works, company GROUP BY city having salary between 17000 and 35500

  4. SELECT employee-name FROM employee, works, company GROUP BY city having salary > = 17000 and 35500 salary < = 35500


Correct Option: B
Explanation:

Statement (2) will give the result of the requirement of the query. This statement will select the employees’ names from employee works, company and group them by same city, those who are having salary between 17000 and 35500.

Find all employees in the database who do not work for State Bank of India.

  1. SELECT employee-name FROM employee WHERE employee-name IN (SELECT employee-name FROM employee-work WHERE company name = “State Bank of India”

  2. SELECT employee-name FROM employee WHERE employee-name except (SELECT employee-name FROM employee-work WHERE company name = “State Bank of India”

  3. SELECT employee-name FROM employee WHERE employee-name <> (SELECT employee-name FROM employee-work WHERE company name = “State Bank of India”

  4. SELECT employee-name FROM employee WHERE Employee-name not IN (SELECT employee-name FROM employee-work WHERE company name = “State Bank of India”


Correct Option: D
Explanation:

This option is also incorrect which does not match with the correct query.

6 Files F1, F2, F3, F4, F5 and F6 have 100, 200, 30, 80, 120, 150 records respectively. In what order should they be stored so as to optimize activity? Assume each file is accessed with the same frequency.

  1. F2, F3, F1, F5, F6, F2

  2. F2, F6, F5, F1, F4, F3

  3. F1, F2, F3, F4, F5, F6

  4. Ordering is immaterial as all files are accessed with the same frequency.


Correct Option: A
Explanation:

Since, the access is sequential greater the distance greater will be the access time. Since, all files are referenced with equal frequency overall access time can be reduced by arranging them as in option (1). 

Match the following.

(i) SMALLINT (I) Calendar date
(ii) SYSDATE + 60 (II) Integer values up to 16 digits
(iii) NUMERIC(3,1) (III) Date 60 days from today's date
(iv) DATE (IV) 0.32
(V) 44.5
  1. i - IV, ii - III, iii - IV, iv - I

  2. i - II, ii - III, iii - V, iv - IV

  3. i - IV, ii - III, iii - V, iv - II

  4. i - II, ii - III, iii - V, iv - I


Correct Option: D
Explanation:

SMALLINT - integer value up to 16 digits, option contains all the matching pairs.

Consider the given schemes (20 - 2) Branch scheme = (Branch name, assets, branch city) Customer scheme = (Customer name, street, Customer city) Deposit scheme = (Branch name, account name, customer name, balance) Borrow scheme = (Branch name, loan number, customer name, amount) Client scheme = (Customer name, banker name) Using the relational algebra the query that finds customers who have a balance of over 1000 is

  1. $\pi_{customer name} (\sigma_{balance} > 1000(Deposits)$

  2. $\sigma_{customer name} (\sigma_{balance} >1000(Deposits)$

  3. $\pi_{customer name} (\sigma_{balance} > 1000(Borrow)$

  4. $\sigma_{customer name} (\sigma_{balance} >1000(Borrow)$


Correct Option: A
Explanation:

The SQL statement isSelect customer name from deposit where (balance > 1000) $\therefore$Relational algebra query is $\pi_{customer name} (\sigma_{balance} > 1000(Deposits)$

If the solution of the previous question was the log at the time of crash, then what will be the output of A, B and C after recovery?

  1. A = 1050 B = 2055 C = 720

  2. A = 957 B = 2055 C = 720

  3. A = 957 B = 2055 C = 640

  4. None of these


Correct Option: B
Explanation:

When the system comes back, the operation redo to is performed since the record. Appears in the log on the disk after this operation is executed, the values of account A and B are $957 and $2055, respectively. The value of account C remains $720 because T1 has not been committed yet.

Consider the following transaction T0 and T1<To start><To , A, 1050, 970><To, B, 2030, 2070><To commit><T1 start><T1, C, 720,640><T1 commit> If the system crashes just after log record for the step write C of transaction T1 has been written to stable storage, the log at the time of crash will be

  1. <T0 start> <T0, A, 935><T0, B, 2055>

  2. <T0 start><T0, A, 957><T0, B, 2055><T0 commit><T1 start><T1, C, 640>

  3. <T0 start><T0, A, 957><T0, B, 2055><T0 commit><T1 start><T1, C, 62><T1, Commit>

  4. none of the above


Correct Option: A
Explanation:

The log at the time of crash will be option B, which reaches up to commit statement but not including commit statement. Option (2) gives the correct log at the time of crash.

Which of the following queries finds the clients of banker Agassi and the city they live in?

  1. $\pi_{client, customer\ name, customer\ city} (\sigma_{Banker name} = “Agassi” (client × customers))$

  2. $\pi_{client, customer\ name, customer\ city} (\sigma_{Banker name} = “Agassi” (client × customers)$

  3. $\pi_{client, customer\ name, customer\ city} \\ (\sigma_{Banker name} = “Agassi” (\sigma_{client} × customer name) = \\ customer, customer\ name (client × customers)$

  4. $\pi_{customer\ name, customer\ city }(\sigma_{Banker name} = “Agassi” (client × customers)$


Correct Option: A
Explanation:

The SQL statement is select client customer name, client customer city from client customer where (client customer name = customer. Customer name and banker name = “Agassi” $\therefore$Relational algebra query is$\pi_{client, customer\ name, customer\ city} (\sigma_{Client, customer\ name})= customer. customer name \\ (\sigma_{Banker name} = “Agassi” (client × customers)$

What will be the average access time?

  1. 268 units

  2. 293 units

  3. 256 units

  4. 210 units


Correct Option: A
Explanation:

Since, each file is referenced with equal frequency and each record in a particular file can be referenced with equal frequency, average access time will be$\dfrac{25 + (50 +40 ) + (50 + 80 + 50) + ......}{6}$Approximately 268 units

Which of the following is used to add new attribute (column) in the existing relation schema?

  1. ADD

  2. INSERT

  3. CREATE

  4. DROP


Correct Option: A
Explanation:

The modifications in the relation schema are done by a statement that begins with the keywords ALTER TABLE and the name of the relation. We then have several options and one of the most important is ADD.Syntax: ALTER TABLE relation ADD new-attribute dates typeE.g. ALTER TABLE Employee ADD salary INTThe above statement will add a new attributes salary to employee relation.

- Hide questions