The relation scheme given below is used to store information about the employees of a company, where empId is the key and deptId indicates the department to which the employee is assigned. Each employee is assigned to exactly one department.
\[ \text{emp}(\text{empId},\ \text{name},\ \text{gender},\ \text{salary},\ \text{deptId}) \]
Consider the following SQL query:
select deptId, count(*)
from emp
where gender = "female" and salary > (select avg(salary) from emp)
group by deptId; The above query gives, for each department in the company, the number of female employees whose salary is greater than the average salary of
Step 1: Understand the subquery.
The subquery
\[
(\text{select avg(salary) from emp})
\]
computes the average salary over the entire \texttt{emp} table, that is, the average salary of all employees in the company, irrespective of department or gender.
Step 2: Analyze the WHERE clause.
The condition
\[
\text{gender = "female" and salary > (select avg(salary) from emp)}
\]
filters only those employees who are female and whose salary is greater than the company-wide average salary.
Step 3: Role of GROUP BY.
The clause
\[
\text{group by deptId}
\]
groups the filtered female employees by their department and counts them for each department.
Step 4: Final interpretation.
Hence, for each department, the query counts female employees whose salary exceeds the average salary of all employees in the company.
Final Answer: (B)


On a relation named Loan of a bank: 
On a relation named Loan of a bank: 
The following SQL query is executed:
SELECT L1.loannumber FROM Loan L1 WHERE L1.amount \(>\) (SELECT MAX(L2.amount) FROM Loan L2 WHERE L2.branchname = 'SR Nagar');
In a 4-bit ripple counter, if the period of the waveform at the last flip-flop is 64 microseconds, then the frequency of the ripple counter in kHz is ______________. {(Answer in integer)}
Consider the following C code segment:
int x = 126, y = 105;
do {
if (x > y)
x = x - y;
else
y = y - x;
} while (x != y);
printf("%d", x);
The output of the given C code segment is ____________. (Answer in integer)
The following two signed 2’s complement numbers (multiplicand \( M \) and multiplier \( Q \)) are being multiplied using Booth’s algorithm:
| Multiplicand (\( M \)) | Multiplier (\( Q \)) |
|---|---|
| 1100 1101 1110 1101 | 1010 0100 1010 1010 |
The total number of addition and subtraction operations to be performed is __________. (Answer in integer)
The maximum value of \(x\) such that the edge between the nodes B and C is included in every minimum spanning tree of the given graph is __________ (answer in integer).
Consider the following C program
The value printed by the given C program is __________ (Answer in integer).