

MCQOPTIONS
Saved Bookmarks
This section includes 406 Mcqs, each offering curated multiple-choice questions to sharpen your Graduate Aptitude Test (GATE) knowledge and support exam preparation. Choose a topic below to get started.
401. |
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 and MY, new records are inserted in the table 128 times with X and Y values being 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 are carried out? |
A. | 127 |
B. | 255 |
C. | 129 |
D. | 257 |
Answer» B. 255 | |
402. |
Database table by name Loan_Records is given below.Borrower Bank_Manager Loan_Amount Ramesh Sunderajan 10000.00 Suresh Ramgopal 5000.00 Mahesh Sunderajan 7000.00What 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. | 6 |
Answer» D. 6 | |
403. |
Which of the following statements are TRUE about an SQL query?P : An SQL query can contain a HAVING clause even if it does not have a GROUP BY clauseQ : An SQL query can contain a HAVING clause only if it has a GROUP BY clauseR : All attributes used in the GROUP BY clause must appear in the SELECT clauseS : 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 | |
404. |
Table AId Name Age----------------12 Arun 6015 Shreya 2499 Rohit 11Table BId Name Age----------------15 Shreya 2425 Hari 4098 Rohit 2099 Rohit 11Table CId Phone Area-----------------10 2200 02 99 2100 01Consider the above tables A, B and C. How many tuples does the result of the following SQL query contains?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 | |
405. |
SQL allows 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) |
A. | select R.* from R, S where R.a=S.a (D) |
B. | select distinct R.* from R,S where R.a=S.a |
C. | select R.* from R,(select distinct a from S) as S1 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 | |
406. |
Given the following schema: employees(emp-id, first-name, last-name, hire-date, dept-id, 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. | 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. generates an error because of pairwise comparison | |