Databases-Introduction to Programming-Quiz Solution, Exercises for Computer Programming. Quaid-i-Azam University
asim.amjid
asim.amjid

Databases-Introduction to Programming-Quiz Solution, Exercises for Computer Programming. Quaid-i-Azam University

PDF (238 KB)
6 pages
50Number of download
1000+Number of visits
100%on 5 votesNumber of votes
2Number of comments
Description
This quiz was taken by Sir Raza Muhammad at Quaid-i-Azam University for Introduction to Programming course. It includes: Computer, Programming, Engineers, Accesses, Database, Model, Relational, Operations
20 points
Download points needed to download
this document
Download the document
Preview3 pages / 6
This is only a preview
3 shown on 6 pages
Download the document
This is only a preview
3 shown on 6 pages
Download the document
This is only a preview
3 shown on 6 pages
Download the document
This is only a preview
3 shown on 6 pages
Download the document
Test Bank Chap. 9 (9th ed.)

Mohammad Ali Jinnah University, Islamabad Campus

Quiz# 5

Course Title Computer Programming (for Engineers) Instructor Maryam Kausar Weightage 2% Absolute

Multiple Choice Questions

1. Which of the following accesses a database in terms of a database model?

A. Application software B. Database management system C. Actual database

ANSWER: A

2. Which of the following describes only the portion of a database available to a particular user?

A. Database model B. Schema C. Subschema D. DBMS

ANSWER: C

3. Which of the following relational operations combine data from more than one relation?

A. SELECT B. PROJECT C. JOIN

ANSWER: C

4. Which of the following relational operations extracts entire columns from a relation?

A. SELECT B. PROJECT C. JOIN

ANSWER: B

5. Which of the following relational operations extracts entire rows from a relation?

A. SELECT B. PROJECT C. JOIN

ANSWER: A

6. Which of the following relational operations is performed by the SQL statement below?

select A, B, C

from X

A. SELECT B. PROJECT C. JOIN

ANSWER: B

7. Given the relation X below

X: A B C

2 5 7

3 3 3

docsity.com

4 3 2

5 2 8

what value will be extracted by the following query?

TEMP  SELECT from X where B > C

RESULT  PROJECT A from TEMP

A. 2 B. 3 C. 4 D. 5

ANSWER: C

8. Given the relation X below

X: A B C

2 5 7

3 3 3

4 4 2

5 2 8

what value will be retrieved by the following query?

TEMP  SELECT from X where B = C

RESULT  PROJECT B from TEMP

A. 2 B. 3 C. 4 D. 5

ANSWER: B

9. Given the relation below

X: A B C

2 5 7

3 3 6

4 4 2

5 2 2

what values will be retrieved by the following SQL statement?

select A, B

from X

where X.B = X.C

A. 2, 5 B. 3, 6 C. 2, 2 D. 5, 2

ANSWER: D

10. Given the two relations X and Y below

X: A B Y: C D

7 s t 3

2 z r 2

what value would be retrieved by executing the following SQL statement?

docsity.com

select Y.C

from X, Y

where X.A < Y.D

A. s B. z C. t D. r

ANSWER: C

Fill-in-the-blank/Short-answer Questions

1. In a relational database, information is presented as though it were stored in tables called

_________________ , each of which has columns called _________________ and rows

called _________________ .

ANSWER: Relations, attributes, tuples

2. Identify two database models.

____________________

____________________

ANSWER: Possible answers include: relational and object-oriented

3. The term “lossless decomposition” refers to a decomposition of one relation into several relations such

that _____________________________________________ .

ANSWER: no information is lost

4. Suppose a relation X had the attributes PartID (part identification number), StockGoal (quantity

held when fully stocked), and CurrentQuantity (quantity actually in stock). Complete the following

statement to obtain information about those parts that are not fully stocked.

Result  SELECT from X where _________________________________________

ANSWER: StockGoal  CurrentQuantity

5. Suppose a relation X had the attributes Name, EmployeeID, and Address. Complete the following

statement to obtain a list of the names and addresses of all employees.

Result  ___________________________________ from X

ANSWER: PROJECT Name, Address

6. Given the two relations X and Y below

X: A B Y: C D

2 s t 1

5 z r 3

w 2

docsity.com

what values would be in the tuple produced by the following statement?

Result  JOIN X and Y where X.A < Y.D

______________________

ANSWER: 2, s, r, 3

7. Given the two relations X and Y below

X: A B Y: C D

2 s t 1

5 z r 3

w 2

what values would be in the tuple produced by the following statements?

Temp  JOIN X and Y where X.A = Y.D

Result  PROJECT X.B, Y.C from Temp

____________________

ANSWER: s, w

8. Given the two relations X and Y below

X: A B Y: C D

7 s t 1

3 z r 2

1 u

what values would be retrieved by executing the following statement?

select X.A, X.B, Y.C

from X, Y

where X.A < Y.D

_________________

ANSWER: 1, u, t

9. Given the three relations X, Y, and Z below

X: A B Y: C D Z: E F

7 s t 4 2 w

3 z r 2 3 q

1 u

what values would be retrieved by executing the following statement?

select X.B, Y.C, Z.F

from X, Y, Z

where X.A > Y.D and X.A = Z.E

_________________

docsity.com

ANSWER: z, r, q

10. Which of the operations SELECT, PROJECT, and JOIN are actually used when executing the

following SQL instruction?

select A, B

from X

where C = D

________________________________

ANSWER: SELECT, PROJECT

General Format Questions

1. What information is available from a relational database containing one relation with the attributes

Name, Employee identification number, and Address that is not available from a database containing two

relations, one with attributes Name and Address and the other with attributes Address and Employee

identification number? Explain your answer.

ANSWER: The connection between an employee’s name and identification number may not be available

in the second database because two employees may have the same address.

2. Given the two relations X and Y below

X: A B Y: C D

2 s t 1

5 z r 3

w 2

draw the relation Result that would be produced by the following statements?

Temp  JOIN X and Y where X.A > Y.D

Result  PROJECT X.B, Y.C from Temp

ANSWER: X.B Y.C

s t

z t

z r

z w

3. Given the relation Parts containing the attributes PartName, PartNumber, and SupplierID as

well as the relation Suppliers containing the attributes SupplierID, Address, FaxNumber, write

a sequence of SELECT, PROJECT, and JOIN operations to obtain the supplier identifications and fax

numbers for all the suppliers that supply the part whose part number is X4J26.

ANSWER: Temp1  SELECT from Parts

where PartNumber = “X4J26”

Temp2 JOIN Temp1 and Suppliers

where Temp1.SupplierID = Suppliers.SupplierID

Result  PROJECT Suppliers.SupplierID, Suppliers.FaxNumber

docsity.com

from Temp2

docsity.com

can someone explain mcq number 10?
thank's for tips
This is only a preview
3 shown on 6 pages
Download the document