

MCQOPTIONS
Saved Bookmarks
This section includes 125 Mcqs, each offering curated multiple-choice questions to sharpen your Database knowledge and support exam preparation. Choose a topic below to get started.
1. |
Which of the following statements are true about an SQL query? P. An SQL query can contain HAVING clause even if it does not have a GROUP BY clause Q. An SQL query can contain HAVING clause only if it does not have a GROUP BY clause R. All attributes used in the GROUP BY clause must appear in the SELECT clause S. Not all attributes used in the GROUP BY clause need to appear in the SELECT clause |
A. | P and R |
B. | P and S |
C. | Q and R |
D. | Q and S |
Answer» D. Q and S | |
2. |
Consider the following log sequence of two transactions on a bank account, with initial balance 12000, that transfer 2000 to a mortagage payment and then apply a 5% interest. 1. T1 start 2. T1 B old = 1200 new = 10000 3. T1 M old = 0 new = 2000 4. T1 commit 5. T1 start6. T2 B old = 10000 new = 10500 7. T2 commit Suppose the database system crashes just before log record is written. When the system is started, which one statement is true of the recovery procedure? |
A. | We must redo log record 6 to set B to 10500 |
B. | We must redo log record 6 to set B to 10000 and the redo log records 2 and 3. |
C. | We need not redo log records 2 and 3 because transaction T1 has committed |
D. | We can apply redo and undo operations in arbitrary order because they are idempotent |
Answer» C. We need not redo log records 2 and 3 because transaction T1 has committed | |
3. |
Which of the following concurrency control protocols ensure both conflict serializability and freedom from deadlock ? 1. 2-phase locking 2. Time-stamp ordering |
A. | 1 only |
B. | 2 only |
C. | Both 1 and 2 |
D. | Neither 1 nor 2 |
Answer» C. Both 1 and 2 | |
4. |
Consider the following transactions with data items P and Q initialized to zero : T1 : read (P); read (Q); if P = 0 then Q = Q + 1; write (Q); T2 : read (Q); read (P); if Q = 0 then P = P + 1; write (P); Any non-serial interleaving of T1 and T2 for concurrent execution leads to |
A. | a serializable schedule |
B. | a schedule that is not conflict serializable |
C. | a conflict serializable schedule |
D. | a schedule for which a precedence graph cannot be drawn |
Answer» C. a conflict serializable schedule | |
5. |
Consider the transactions T1, T2, and T3 and the schedules S1 and S2 given below. T1: r1(X); r1(Z); w1(X); w1(Z) T2: r2(Y); r2(Z); w2(Z) T3: r3(Y); r3(X); w3(Y) S1: r1(X); r3(Y); r3(X); r2(Y); r2(Z); w3(Y); w2(Z); r1(Z); w1(X); w1(Z)S2: r1(X); r3(Y); r2(Y); r3(X); r1(Z); r2(Z); w3(Y); w1(X); w2(Z); w1(Z) Which one of the following statements about the schedules is TRUE ? |
A. | Only S1 is conflict-serializable. |
B. | Only S2 is conflict-serializable. |
C. | Both S1 and S2 are conflict-serializable. |
D. | Neither S1 nor S2 is conflict-serializable. |
Answer» B. Only S2 is conflict-serializable. | |
6. |
Consider a simple checkpointing protocol and the following set of operations in the log. (start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7); (checkpoint); (start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3), (write, T3, z, 7, 2); If a crash happens now the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list? |
A. | Undo: T3, T1; Redo: T2 |
B. | Undo: T3, T1; Redo: T2, T4 |
C. | Undo: none; Redo; T2, T4, T3, T1 |
D. | Undo: T3, T1, T4; Redo: T2 |
Answer» B. Undo: T3, T1; Redo: T2, T4 | |
7. |
Consider the following transaction involving two bank accounts x and y. read(x); x: = x 50; write(x); read (y); y = y + 50; write(y) The constraint that the sum of the accounts x and y should remain constant is that of |
A. | Atomicity |
B. | Consistency |
C. | Isolation |
D. | Durability |
Answer» C. Isolation | |
8. |
Consider the following database schedule with two transactions, T1 and T2. S = r2 (X); r1(X); r2 (Y); w1 (X); r1 (Y); w2 (X); a1; a2 where ri (Z) denotes a read operation by transaction Ti on a variable Z, wi (Z) denotes a write operation by Ti on a variable Z and ai denotes an abort by transaction Ti. Which one of the following statements about the above schedule is TRUE ? |
A. | S is non-recoverable |
B. | S is recoverable, but has a cascading abort |
C. | S does not have a cascading abort |
D. | S is strict |
Answer» D. S is strict | |
9. |
Suppose a database schedule S involves transactions T1, ...., Tn. Construct the precedence graph of S with vertices representing the transactions and edges representing the conflicts. If S is serializable, which one of the following orderings of the vertices of the precedence graph is guaranteed to yield a serial schedule? |
A. | Topological order |
B. | Depth-first order |
C. | Breadth-first order |
D. | Ascending order of transaction indices |
Answer» B. Depth-first order | |
10. |
Consider the following database table named top_scorer.Player Country Goals Klose Germany 16 Ronaldo Brazil 15 G Muller Gemany 14 Fontaine France 13 Pele Brazil 12 Klinsmann Germany 11 Kocsis Hungary 11 Batistuta Argentina 10 Cubillas Peru 10 Lato Poland 10 Lineker England 10 T Miller Germany 10 Rahn Germany 10 Consider the following SQL query: SELECT ta.player FROM top_scorer AS ta WHERE ta.goals >ALL (SELECT tb.goals FROM top_scorer AS tb WHERE tb.country = Spain ) AND ta.goals >ANY (SELECT tc.goals FROM top_scorer AS tc WHERE tc.country = Germany ) The number of tuples returned by the above SQL query is ________. |
A. | 21 |
B. | 7 |
C. | 0 |
D. | 3 |
Answer» C. 0 | |
11. |
Two transactions T1 and T2 are given as T1 : r1 (X) w1 (X)r1 (Y)w1 (Y) T2 : r2(Y) w2 (Y)r2 (Z) w2 (Z)where ri (V) denotes a read operation by transaction Ti on a variable V and wi (V) denotes a write operation by transaction Ti on a variable V. The total number of conflict serializable schedules that can be formed by T1 and T2 is __________. |
A. | 27 |
B. | 23 |
C. | 54 |
D. | 45 |
Answer» D. 45 | |
12. |
In a database system, unique timestamps are assigned to each transaction using Lamport s logical clock. Let TS( T1) and TS(T2) be the timestamps of transactions T1 and T2 respectively. Besides, T1 holds a lock on the resource R and T2 has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp. if TS(T2) < TS(T1) then T1 is killed else T2 waits. Assume any transaction that is not killed terminates eventually. Which of the following is true about the database system that uses the above algorithm to prevent deadlocks? |
A. | The database system is both deadlock-free and starvation-free. |
B. | The database system is deadlock-free, but not starvation-free. |
C. | The database system is starvation-free, but not deadlock-free. |
D. | The database system is neither deadlock-free nor starvation-free. |
Answer» B. The database system is deadlock-free, but not starvation-free. | |
13. |
B+ trees are preferred to binary trees in databases because |
A. | disk capacities are greater than memory capacities |
B. | disk access is much slower than memory access |
C. | disk data transfer rates are much less than memory data transfer rates |
D. | disks are more reliable than memory |
Answer» C. disk data transfer rates are much less than memory data transfer rates | |
14. |
A B+ tree index is to be built on the name attribute of the relation STUDENT. Assume that all student names are of length 8 byte, disk blocks are of size 512 byte and index pointers are of size 4 byte. Given this scenario, what would be the best choice of the degree (i.e., the number of pointers per node) of the B+ tree? |
A. | 16 |
B. | 42 |
C. | 43 |
D. | 44 |
Answer» D. 44 | |
15. |
The order of an internal node in a B+ tree index is the maximum number of children it can have. Suppose that a child pointer takes 6 byte, the search field value takes 14 byte, and the block size is 512 byte. What is the order of the internal node? |
A. | 24 |
B. | 25 |
C. | 26 |
D. | 27 |
Answer» D. 27 | |
16. |
The order of a leaf node in a B+ tree is the maximum number of (value, data record pointer) pairs it can hold. Given that the block size is 1 kbyte, data record pointer is 7 byte long, the value field is 9 byte long and a block pointer is 6 byte long, what is the order of the leaf node? |
A. | 63 |
B. | 64 |
C. | 67 |
D. | 68 |
Answer» B. 64 | |
17. |
The following key values are inserted into a B+ tree in which order of the internal nodes is 3, and that of the leaf nodes is 2, in the sequence given below. The order of internal nodes is the maximum number of tree pointers in each node, and the order of leaf nodes is the maximum number of data items that can be stored in it. The B+ tree is initially empty.10, 3, 6, 8, 4, 2, 1 The maximum number of times leaf nodes would get split up as result of these insertions is |
A. | 32 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» B. 3 | |
18. |
Consider a B+ tree in which the maximum number of keys in a node is 5. What is the minimum number of keys in any nonroot node? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» C. 3 | |
19. |
Consider a relational table r with sufficient number of records, having attributes A1, A2,... An, let 1 p n . Two queries Q1 and Q2 are given below.Q1 = A1 ...............Ap where c is constant .Q2 = A1 ...............Ap ( c1 Ap c2 ) and c1 and c2 are constants. Which of the following statements is true? (a) Ordered indexing will always outperform hashing for both queries (b) Hashing will always outperform ordered indexing for both queries |
A. | Only a |
B. | Only b |
C. | Both a and b |
D. | None of the above |
Answer» D. None of the above | |
20. |
Given the following relation instance XYZ14 2 15 3 16 3 32 2 Which of the following functional dependencies are satisfied by the instance? |
A. | XY Z and Z Y |
B. | YZ X and Y Z |
C. | YZ X and X Z |
D. | XZ Y and Y X |
Answer» C. YZ X and X Z | |
21. |
Consider the following functional dependencies in a database: Date_of_Birth Age Age Eligibility Name Roll_number Roll_number Name Course_number Course_name Course_number Instructor (Roll_number, Course_number) Grade The relation (Roll_number, Name, Date_of_birth, Age) is |
A. | in second normal form but not in third normal form |
B. | in third normal form but not in BCNF |
C. | in BCNF |
D. | none of the above |
Answer» E. | |
22. |
The relational schema Student Performance (name, coureNo., rollNo., grade) has the following functional dependencies name, courseNo. grade rollNo., courseNo. grade name rollNo rollNo. name The highest normal form of this relation schema is |
A. | 2NF |
B. | 3NF |
C. | BCNF |
D. | 4NF |
Answer» C. BCNF | |
23. |
Consider the following relational schemas for a library database: Book (Title, Author, Catalog_no, Publisher, Year, Price) Collection (Title, Author, Catalog_no) within the following functional dependencies 1. Title, Author Catalog_no 2. Catalog_no Title Author Publisher Year 3. Publisher Title Year Price Assume {Author, Title} is the key for both schemas. Which of the following statements is true? |
A. | Both Book and Collection are in BCNF |
B. | Both Book and Collection are in 3 NF only |
C. | Book is in 2 NF and Collection is in 3 NF |
D. | Both Book and Collection are in 2 NF only |
Answer» D. Both Book and Collection are in 2 NF only | |
24. |
The following functional dependencies hold for relations R(A, B, C) and S(B, D, E)B A, A C The relation R contains 200 tuples and the relation S contain 100 tuples. What is the maximum number of tuples possible in the natural join R ⋈ S? |
A. | 100 |
B. | 200 |
C. | 300 |
D. | 2000 |
Answer» B. 200 | |
25. |
Consider the relation scheme R = (E, F, G, H, I, J, K, L, M, N) and the set of functional dependencies {{E, F} {G}, {F} {I, J}, {E, H} {K, L}, {K} {M}, {L} {N}} on R. What is the key for R? |
A. | {E, F} |
B. | {E, F, H} |
C. | {E, F, H, K, L} |
D. | {E} |
Answer» C. {E, F, H, K, L} | |
26. |
Given the following two statements: S1: Every table with two single-valued attributes is in 1NF, 2NF, 3NF and BCNF. S2: AB C, D E, E C is a minimal cover for the set of functional dependencies AB C, D E, AB E, E C. Which one of the following is CORRECT? |
A. | S1 is TRUE and S2 is FALSE. |
B. | Both S1 and S2 are TRUE. |
C. | S1 is FALSE and S2 is TRUE. |
D. | Both S1 and S2 are FALSE. |
Answer» B. Both S1 and S2 are TRUE. | |
27. |
A database of research articles in a journal uses the following schema. (VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, YEAR, PRICE) The primary key is (VOLUME, NUMBER, STARTPAGE, ENDPAGE) and the following functional dependencies exist in the schema. (VOLUME, NUMBER, STARTPAGE, ENDPAGE) TITLE (VOLUME, NUMBER) YEAR (VOLUME, NUMBER, STARTPAGE, ENDPAGE) PRICE The database is redesigned to use the following schemas. (VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, PRICE) (VOLUME, NUMBER, YEAR) Which is the weakest normal form that the new database satisfies, but the old one does not? |
A. | 1NF |
B. | 2NF |
C. | 3NF |
D. | BCNF |
Answer» C. 3NF | |
28. |
Consider a bank database with only one relation transaction (transno, acctno, data, amount) The amount attribute value is positive for deposits and negative for withdrawals. (a) Define an SQL view TP containing the information. (acctno, T1.date, T2.amount) for every pair of transactions T1, T2 such that T1 and T2 are transaction on the same account and the date of T2 is the date of T1. (b) Using only the above view TP, write a query to find for each account the minimum balance it ever reached (not including the 0 balance when the account is created). Assume there is at most one transaction per day on each account, and each account has had atleast one transaction since it was created. To simply your query, break it up into 2 steps by defining an intermediate view V. |
A. | Only a |
B. | only b |
C. | Both a and b |
D. | None of the above |
Answer» B. only b | |
29. |
Consider the set of relations shown below and the SQL query that follows: Students: (Roll_number, Name, Data_of_birth) Courses: (Course number, Course_name, Instructor) Grades: (Roll_number, Course_number, Grade) Select distinct Name from Students, Courses, Grades where Students. Roll_number = Grades Roll_number and Grades.grade and courses. Instructor = korth and Courses.course - number = Grades.course - number Roll_number = Grades.Roll_number and Grades.grade = A Which of the following sets is computed by the above query? |
A. | Names of students who have got an A grade in all courses taught by Korth |
B. | Names of students who have got an A grade in all courses |
C. | Names of students who have got an A grade in at least one of the courses taught by Korth |
D. | None of the above |
Answer» D. None of the above | |
30. |
The employee information in a company is stored in the relation Employee (name, sex, salary, deptName) Consider the following SQL query : Select deptName From Employee Where sex = M Group by deptName Having avg(salary) > (select avtg (salary) from Employee) It returns the name of the department in which |
A. | the average salary is more than the average salary in the company |
B. | the average salary of male employees is more than the average salary of all male employees in the company the |
C. | average salary of male employees is more than the average salary of employees in the same department |
D. | the average salary of male employees is more than the average salary in the company |
Answer» E. | |
31. |
Consider the following relational query on the above database : SELECT S.sname FROM Suppliers S WHERE S.sid NOT IN (SELECT C. sid FROM Catalog C WHERE C.pid NOT IN (SELECT P.pid FROM Parts P WHERE P.color < > blue )) Assume that relations corresponding to the above schema are not empty. Which one of the following is the correct interpretation of the above query? |
A. | Find the names of all suppliers who have supplied a non-blue part |
B. | Find the names of all suppliers who have not supplied a non-blue part |
C. | Find the names of all suppliers who have supplied only blue parts |
D. | Find the names of all suppliers who have not supplied only blue parts |
Answer» B. Find the names of all suppliers who have not supplied a non-blue part | |
32. |
Consider a database table T containing two columns X and Y each of type integer. After the creation of the table, one record (X = 1, Y = 1) is inserted in the table. Let MX and MY denote the respective maximum values of X and Y among all records in the table at any point in time. Using Mx + 1, 2*MY + 1 respectively. It may be noted that each time after the insertion, values of MX and MY change. What will be the output of the following SQL query after the steps mentioned above the carried out? SELECT Y FROM T WHERE X = 7; |
A. | 127 |
B. | 255 |
C. | 190 |
D. | 257 |
Answer» B. 255 | |
33. |
The relation book (title, price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query list? select title from book as B where (select count (*) from book as T where T. price > B. price) < 5 |
A. | Title of four most expensive book |
B. | Title of fifth most inexpensive book |
C. | Titles of fifth most expensive book |
D. | Titles of five most expensive book |
Answer» E. | |
34. |
How many tuples does the result of the following relational algebra expression contain? Assume that the schema of A B is the same as that of A. (A B)A.ld>40 C.ld<15C |
A. | 7 |
B. | 4 |
C. | 5 |
D. | 9 |
Answer» B. 4 | |
35. |
Given the following statements: S1: A foreign key declaration can always be replaced by an equivalent check assertion in SQL. S2: Given the table R(a,b,c) where a and b together form the primary key, the following is a valid table definition. CREATE TABLE S ( a INTEGER, d INTEGER, e INTEGER, PRIMARY KEY (d), FOREIGN KEY (a) references R) Which one of the following statements is CORRECT ? |
A. | S1 is TRUE and S2 is FALSE. |
B. | Both S1 and S2 are TRUE. |
C. | S1 is FALSE and S2 is TRUE. |
D. | Both S1 and S2 are FALSE. |
Answer» E. | |
36. |
Given the following schema: employees (emp-id, first-name, last-name, hire-date, deptid, salary) departments (dept-id, dept-name, manager-id, location-id) You want to display the last names and hire dates of all latest hires in their respective departments in the location ID 1700. You issue the following query: SQL > SELECT last-name, hire-date FROM employees WHERE (dept-id, hire-date) IN (SELECT dept-id, MAX (hire-date) FROM employees JOIN departments USING (dept-id) WHERE location-id = 1700 GROUP BY dept-id), What is the outcome? |
A. | It executes but does not give the correct result. |
B. | It executes and gives the correct result. |
C. | It generates an error because of pairwise comparison. |
D. | It generates an error because the GROUP BY clause cannot be used with table joins in a subquery. |
Answer» C. It generates an error because of pairwise comparison. | |
37. |
SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which one of the following queries always gives the same answer as the nested query shown below : select * from R where a in (select S.a from S) select R.* from R, S where R.a = S.a |
A. | select distinct R.* from R, S where R.a = S.a |
B. | select R.* from R, (select distinct a from S) as S1 |
C. | where R.a = S1.a |
D. | select R.* from R,S where R.a = S.a and is unique R |
Answer» D. select R.* from R,S where R.a = S.a and is unique R | |
38. |
Database table by name Loan_Records is given below. Borrower Bank_Manager Loan_Amount Ramesh Sunderajan 100000.00 Suresh Ramgopal 5000.00 Mahesh Sunderajan 7000.00 What is the output of the following SQL query ? SELECT count (*) FROM( (SELECT Borrower. Bank_Manager FROM Loan_ Records) AS S NATURAL JOIN (SELECT Bank_Manager, Loan_Amount FROM Loan_Records) AS T ); |
A. | 3 |
B. | 9 |
C. | 5 |
D. | |
E. | 6 |
Answer» D. | |
39. |
How many tuples does the result of the following SQL query contain? SELECT A. Id FROM A WHERE A. Age > ALL (SELECT B. Age FROM B WHERE B. Name = Arun ) |
A. | 4 |
B. | 3 |
C. | 0 |
D. | 1 |
Answer» C. 0 | |
40. |
Consider the following relation Cinema (theater, address, capacity) Which of the following options will be needed at the end of the SQL query SELECT P1. address FROM Cinema P1 Such that it always finds the addresses of theaters with maximum capacity? |
A. | WHERE P1. capacity >= All (select P2. capacity from Cinema P2) |
B. | WHERE P1. capacity >= Any (select P2. capacity from Cinema P2) |
C. | WHERE P1. capacity > All (select max(P2. capacity) form Cinema P2) |
D. | WHERE P1. capacity > Any (select max (P2. capacity) from Cinema P2) |
Answer» B. WHERE P1. capacity >= Any (select P2. capacity from Cinema P2) | |
41. |
Consider a relation geq which represents greater than or equal to , that is, (x, y) geq only if y x. create table geq (lb integer not null ub integer not null primary key lb foreign key (ub) references geq on delete cascade) Which of the following is possible if a tuple (x, y) is deleted? |
A. | A tupel (z, w) with z > y is deleted |
B. | A tuple (z, w) with z > x is deleted |
C. | A tuple (z, w) with w < x is deleted |
D. | The deletion of (x, y) is prohibited |
Answer» D. The deletion of (x, y) is prohibited | |
42. |
Consider an Entity-Relationship(ER) model in which entity sets E1 and E2 are connected by an m : n relationship R12. E1 and E3 are connected by a 1 : n (1 on the side of E1 and n on the side of E3) relationship R13. E1 has two single-valued attributes a11 and a12 of which a11 is the key attribute. E2 has two single-valued attributes a21 and a22 of which is the key attribute. E3 has two singlevalued attributes a31 and a32 of which a31 is the key attribute. The relationships do not have any attributes. If a relational model is the derived from the above ER model, then the minimum number of relations that would be generated if all the relations are in 3NF is _______. |
A. | 21 |
B. | 5 |
C. | 7 |
D. | 0 |
Answer» C. 7 | |
43. |
Let E1 and E2 be two entities in an E/R diagram with simple single valued attributes. R1 and R2 are two relationship between E1 and E2, where R1 is one-to-many and R2 is manyto-many. R1 and R2 do not have any attributes of their own. What is the minimum number of tables required to represent this situation in the relational model? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» C. 4 | |
44. |
The minimum number of tables needed to represent M, N, P, R1, R2 is |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» C. 4 | |
45. |
Consider two relations R1 (A,B) with the tuples(1, 5), (3, 7) and R2 (A, C) = (1, 7), (4, 9). Assume that R(A,B,C) is the full natural outer join of R1 and R2 . Consider the following tuples of the form (A, B, C): a = (1, 5, null), b = (1, null, 7), c = (3, null, 9), d = (4, 7, null), e = (1, 5, 7), f = (3, 7, null), g = (4, null, 9). Which one of the following statements is correct? |
A. | R contains a, b, e, f, g but not c, d. |
B. | R contains all of a, b, c, d, e, f, g. |
C. | R contains e, f, g but not a, b. |
D. | R contains e but not f, g. |
Answer» D. R contains e but not f, g. | |
46. |
Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus. (I) {t | u EMP(t[EmpName] = u[EmpName] v DEPT(t[DeptId] v[DeptId]))} (II) {t | u EMP(t[EmpName] = u[EmpName] v DEPT(t[DeptId] v[DeptId]))} (III) {t | u EMP(t[EmpName] = u[EmpName] v DEPT(t[DeptId] = v[DeptId]))} Which of the above queries are safe? |
A. | (I) and (II) only |
B. | (I) and (III) only |
C. | (II) and (III) only |
D. | (I), (II) and (III) |
Answer» E. | |
47. |
Consider the relational schema given below, where eId of the relation dependent is a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation. employee (empId, empName, empAge) dependent(depId, eId, depName, depAge) Consider the following relational algebra query : empId (employee)- empId (employee|X| (empId = eID)^.(empAge. depAge)dependent) The above query evaluates to the set of empIds of employees whose age is greater than that of |
A. | some dependent. |
B. | all dependents. |
C. | some of his/her dependents. |
D. | all of his/her dependents. |
Answer» E. | |
48. |
Consider the relation employee (name, sex, supervisorName) with name as the key. supervisorName gives the name of the supervisor of the employee under consideration. What does the following tuple relational calculus query produce? {e.name | employee (e) } ( x) [ employee (x) x. supervisor Name e. name vx. sex = male ] |
A. | Names of employees with a male supervisor |
B. | Names of employees with no immediate male subordinates |
C. | Names of employees with no immediate female subordinates |
D. | Names of employees with a female supervisor |
Answer» D. Names of employees with a female supervisor | |
49. |
Information about a collection of students is given by the relation studinfo (studld, name, sex). The relation enroll (studld, courseld) gives which student has enrolled for (or taken) what course(s). Assume that every course is taken by at least one male and at least one female student. What does the following relational algebra expression represent? courseld ( studld( sex = female (studinfo) courseheld(enroll)) enroll) |
A. | Courses in which all the female students are enrolled |
B. | Courses in which a proper subset of female students are enrolled |
C. | Courses in which only male students are enrolled |
D. | None of the above |
Answer» C. Courses in which only male students are enrolled | |
50. |
Let R and S be two relations with the following schemas. R(P. Q, R1, R2, R3) S (P. Q, S1, S2) Where {P, Q}is the key for both schemas. Which of the following queries are equivalent? 1. p (R ⋈ S)2. p (R) ⋈ p (S)3. p ( P , Q (R) P , Q (S) )4. p ( P , Q (R) ⋈ P , Q (R) - P , Q (S) ) ) |
A. | 1 and 2 |
B. | 1 and 3 |
C. | 1, 2 and 3 |
D. | 1, 3 and 4 |
Answer» E. | |