Infytq DBMS Questions and Answers 2023 | Set-2

Infytq DBMS Questions and Answers 2023: In this article, we will be discussing some important Infytq DBMS Questions and Answers which will help you guys to crack Infytq 2023 exam.

So, If you are also preparing for Infytq exam, Must prepare these questions.

Also check Infytq Detailed Exam Pattern, Click here

Infytq dbms questions and answers

Question 11: Consider the table instructor given below:

Table: instructor

instructoridnamesubjectuniversity salary
I201AlexJavaHarvard70000
I202SamRubyOxford75000
I201AlexRDBMSHarvard60000
I203MitchelNetworkingCambridge50000
I202SamRDBMSHarvard40000
I203Mitchel.NETOxford50000

How many number of rows will be in output after executing the below query?

Query:

SELECT instructorid, name FROM instructor WHERE salary > 40000

GROUP BY instructorid, name HAVING COUNT (DISTINCT university) > 1;

A. 1

B. 2

C. 3

D. 4

Answer: Option A

Explanation: Firstly it will select those rows whose salary is greater than 40000. i.e. 5 rows will be there.

Then, due to Group By command these 5 rows will be reduced to 3 rows as this command will group same values together on the basis of instructorId.

Now, the count of Distinct university is 3 and it is greater than 1 hence it will return 1 i.e. true and finally 1 row will be returned.

Question 12: Consider a Patient table with attributes patientid (primary key), patientname, city, dateofbirth and phone. Except patientid no columns are unique. The table has three indexes as follows:

IDX1 – patientid 

IDX2 – patientname, dateofbirth 

IDX3 – dateofbirth, phone

Which of the following queries will result in INDEX UNIQUE SCAN?

A. WHERE city > Mumbai’ AND dateofbirth > ’30-Mar-1995′

B. WHERE patientid = ‘P1007′ AND dateofbirth = ’30-Mar-1995’

C. WHERE patientname = ‘Sam’ AND dateofbirth = ’30-Mar-1995’

D. WHERE patientname LIKE ‘R%

Answer: Option C

Explanation: Among the options WHERE patientname = ‘Sam’ AND dateofbirth = ’30-Mar-1995’ alone is equivalent to IDX2. Hence our answer is Option C.

Question 13: Which is the correct syntax for BETWEEN operator?

A. WHERE column_name BETWEEN value1 AND value2

B. WHERE column_name BETWEEN (value1value2)

C. WHERE BETWEEN column_name value1 AND value2

D. WHERE column_name BETWEEN (value1 AND value2)

Correct Answer – Option A

Question 14:  Which is the correct syntax for IN operator?

A. WHERE column_name IN value1 AND value2

B. WHERE column_name IN (value1 AND value2, AND …)

C. WHERE IN column_name value1 AND value2 AND …

D. WHERE column_name IN (value1value2, …)

Correct Answer – Option D

Question 15: Consider the tables project and allocation given below:

Table: project

projectidprojectname
JobsAdda101NAM
JobsAdda102All State Bank
JobsAdda103Sunrise
JobsAdda104Swiss Insure

Table: allocation

empidempnameprojectid
E300Nipun JobsAdda102
E301Rahul JobsAdda102
E302Sehwag JobsAdda103
E303Jackie
E304Sachin

SELECT p.projectid,p.projectname,a.empid

FROM project p FULL JOIN allocation a

ON p.projectid=a.projectid AND a.projectid IS NOT NULL ;

How many rows will be fetched when the above query is executed?

A. 7

B. 5

C. 3

D. 6

Answer: Option C

Explanation:

The FULL OUTER JOIN command will return all matching records from both tables. In this question the resultant data will be completely dependent on the query “p.projectid=a.projectid AND a.projectid IS NOT NULL”. The column a.projectid have only 3 rows without NULL i.e. E300, E301 & E302. Hence only these 3 rows will be fetched.

Leave a Reply

Your email address will not be published. Required fields are marked *