Consider the following database tables of a sports league. player (\( pid \), \( pname \), \( age \)) coach (\( cid \), \( cname \)) team (\( tid \), \( tname \), \( city \), \( cid \)) members (\( pid \), \( tid \)) An instance of the table and an SQL query are given.
Player table
coach table:
team table:
members table:
SQL query: \[ {SELECT MIN(P.age)} \] \[ {FROM player P} \] \[ {WHERE P.pid IN (} \] \[ { SELECT M.pid} \] \[ { FROM team T, coach C, members M} \] \[ { WHERE C.cname = 'Mark'} \] \[ { AND T.cid = C.cid} \] \[ { AND M.tid = T.tid)} \] The value returned by the given SQL query is _________. (Answer in integer)
A schedule of three database transactions \(T_1\), \(T_2\), and \(T_3\) is shown. \(R_i(A)\) and \(W_i(A)\) denote read and write of data item A by transaction \(T_i\), \(i = 1, 2, 3\). The transaction \(T_1\) aborts at the end. Which other transaction(s) will be required to be rolled back?
Consider a directed graph \( G = (V,E) \), where \( V = \{0,1,2,\dots,100\} \) and
\[ E = \{(i,j) : 0 < j - i \leq 2, \text{ for all } i,j \in V \}. \] Suppose the adjacency list of each vertex is in decreasing order of vertex number, and depth-first search (DFS) is performed at vertex 0. The number of vertices that will be discovered after vertex 50 is:
Create empty stack S Set x = 0, flag = 0, sum = 0 Push x onto S while (S is not empty){ if (flag equals 0){ Set x = x + 1 Push x onto S } if (x equals 8): Set flag = 1 if (flag equals 1){ x = Pop(S) if (x is odd): Pop(S) Set sum = sum + x } } Output sumThe value of \( sum \) output by a program executing the above pseudocode is:
def f(a, b): if (a == 0): return b if (a % 2 == 1): return 2 * f((a - 1) / 2, b) return b + f(a - 1, b) print(f(15, 10))The value printed by the code snippet is 160 (Answer in integer).
Consider the following tables, Loan and Borrower, of a bank.
Query: \[ \pi_{\text{branch\_name}, \text{customer\_name}} (\text{Loan} \bowtie \text{Borrower}) \div \pi_{\text{branch\_name}}(\text{Loan}) \] where \( \bowtie \) denotes natural join. The number of tuples returned by the above relational algebra query is 1 (Answer in integer).