Online Test 2 - Database Management System
GATE DBMS Online Test covering relational algebra, SQL queries, transaction management, database models, and query optimization concepts.
Questions
To be considered minimally relational, the DBMS must support of the following key relational functions.
- SELECT, PROJECT, UNION
- SELECT, PROJECT, JOIN
- SELECT, UNION, JOIN
- SELECT, UNION, INTERSECT
The successful execution of a database despite the possibility of system failure is called
- atomicity
- consistence
- durability
- integrity
Find the odd man out.
- Desktop database
- Work group database
- Distributed database
- Enterprise database
Database that are designed and managed specifically to meet information needs are called
- production databases
- transaction database
- data warehouses
- database management system
A file system is said to exhibit data dependence, because
- 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
- organization of the data, within the file is determined by the data's expected use
- data is the most important part of a file system, which also includes hardware software, people and procedures
- when any of the files data characteristics change, all data access programs are subjects to change
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.
- (i), (ii), (iii)
- All the above
- (i)
- (i), (iii), (iv)
Choose the odd man out.
- AVG
- INT
- DATE
- BOOLEAN
The data retrieval time factor is most critical for
- transactional DBMS
- decision DBMS
- data warehouse
- both (2) and (3)
Match the following.
| 1. | SELECT | (a) | Vertical subset of a tuple |
| 2. | PROJECT | (b) | Horizontal subset of a tuple |
| (c) | Common tuples |
- 1 - a, 2 - b
- 1 - b, 2 - a
- 1 - c, 2 - a
- 1 - c, 2 - b
Which of the following statements are equivalent?
| (I) LIKE '_ _ _ %' | (II) LIKE '% _ _ _' |
| (III) LIKE '%_ _%' | (IV) LIKE '%_ _ _ %' |
| (V) '%%%_%' |
- I and II only
- I, II, IV, and V
- I, II, III, IV
- I, II, III, IV, V
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?
- Gives error, since we are deleting the table.
- In student $\theta$ table we add new attributes as subject.
- In student table we have one tuple with values “Hitesh”, 1220,”B.tech”.
- In student table we have one tuple with value “Hitesh”, 1928. an “B.E”.
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.
- All of the above
- (i), (ii), (iii)
- (ii), (iii)
- (iii)
LIKE “abcd%” ESCAPE ‘’- The statement matches
- all strings beginning with “abcd”
- all strings ending with “abcd”
- all string beginning with “abcd%”
- error in SQL
Which of the following is not supported by the hierarchical database model?
- Structural independence
- Data independence
- Database integrity
- Database security
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'
- (I) , (II) and (III) only
- (I) and (IV) only
- (II), (III) and (IV) only
- (I) , (II), (III) and (IV) only
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.
- SELECT employee-name
FROM employee, works, company
WHERE salary between 17000 and 35500 - SELECT employee-name
FROM employee, works, company
GROUP BY company, city having salary between 17000 and 35500 - SELECT employee-name
FROM employee, works, company
GROUP BY city having salary between 17000 and 35500 - SELECT employee-name
FROM employee, works, company
GROUP BY city having salary > = 17000 and 35500 salary < = 35500
Find all employees in the database who do not work for State Bank of India.
- SELECT employee-name
FROM employee
WHERE employee-name IN
(SELECT employee-name
FROM employee-work
WHERE company name
= “State Bank of India” - SELECT employee-name
FROM employee
WHERE employee-name except
(SELECT employee-name
FROM employee-work
WHERE company name
= “State Bank of India” - SELECT employee-name
FROM employee
WHERE employee-name <>
(SELECT employee-name
FROM employee-work
WHERE company name
= “State Bank of India” - SELECT employee-name
FROM employee
WHERE Employee-name not IN
(SELECT employee-name
FROM employee-work
WHERE company name
= “State Bank of India”
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.
- F2, F3, F1, F5, F6, F2
- F2, F6, F5, F1, F4, F3
- F1, F2, F3, F4, F5, F6
- Ordering is immaterial as all files are accessed with the same frequency.
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 |
- i - IV, ii - III, iii - IV, iv - I
- i - II, ii - III, iii - V, iv - IV
- i - IV, ii - III, iii - V, iv - II
- i - II, ii - III, iii - V, iv - I
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
- $\pi_{customer name} (\sigma_{balance} > 1000(Deposits)$
- $\sigma_{customer name} (\sigma_{balance} >1000(Deposits)$
- $\pi_{customer name} (\sigma_{balance} > 1000(Borrow)$
- $\sigma_{customer name} (\sigma_{balance} >1000(Borrow)$
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
- <T0 start> <T0, A, 935><T0, B, 2055>
- <T0 start><T0, A, 957><T0, B, 2055><T0 commit><T1 start><T1, C, 640>
- <T0 start><T0, A, 957><T0, B, 2055><T0 commit><T1 start><T1, C, 62><T1, Commit>
- none of the above
Which of the following queries finds the clients of banker Agassi and the city they live in?
- $\pi_{client, customer\ name, customer\ city} (\sigma_{Banker name} = “Agassi” (client × customers))$
- $\pi_{client, customer\ name, customer\ city} (\sigma_{Banker name} = “Agassi” (client × customers)$
- $\pi_{client, customer\ name, customer\ city} \\\\ (\sigma_{Banker name} = “Agassi” (\sigma_{client} × customer name) = \\\\ customer, customer\ name (client × customers)$
- $\pi_{customer\ name, customer\ city }(\sigma_{Banker name} = “Agassi” (client × customers)$
What will be the average access time?
- 268 units
- 293 units
- 256 units
- 210 units
Which of the following is used to add new attribute (column) in the existing relation schema?
- ADD
- INSERT
- CREATE
- DROP