Databases-Introduction to Programming-Quiz Solution, Exercises of Computer Programming

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

Typology: Exercises

2011/2012

Uploaded on 07/13/2012

asim.amjid
asim.amjid 🇵🇰

4.4

(47)

41 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
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
pf3
pf4
pf5

Partial preview of the text

Download Databases-Introduction to Programming-Quiz Solution and more Exercises Computer Programming in PDF only on Docsity!

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

  1. 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

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

A. SELECT B. PROJECT C. JOIN

ANSWER: C

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

A. SELECT B. PROJECT C. JOIN

ANSWER: B

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

A. SELECT B. PROJECT C. JOIN

ANSWER: A

  1. 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

  1. Given the relation X below

X: A B C 2 5 7 3 3 3

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

  1. 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

  1. 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

  1. 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?

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

  1. 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

  1. 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

  1. 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


ANSWER: z, r, q

  1. 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.

  1. 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

  1. 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