of science and technologyexampapers.nust.na/greenstone3/sites/localsite...18. the maximum number of...

11
1 ... r nAmIB I A U n IVERS I TY OF SCIEnCE AnD TECHnOLOGY FACULTY OF COMPUTING AND INFORMATICS DEPARTMENT OF COMPUTER SCIENCE QUALIFICATION: BACHELOR OF COMPUTER SCIENCE QUALIFICATION CODE: 07BACS LEVEL: 5 COURSE: Database Fundamentals COURSE CODE: DBF510S DATE: June 2016 DURATION: 3 hours EXAMINER(S) MODERATOR: SESSION: 1 MARKS: 100 FIRST OPPORTUNITY EXAMINATION QUESTION PAPER MRS. JOSEPHINA MIKKA MR. ISAAC NHAMU THIS QUESTION PAPER CONSISTS OF 10 PAGES (Excluding this front page) INSTRUCTIONS 1. Answer ALL the questions. 2. Questions 2 and 3 must be answered on the Question paper and the sheets attached to the answer sheet. 3. Write clearly and neatly. 4. Number the answers clearly. 5. When answering questions you should be guided by the allocation of marks in [ ] . Do not give too few or too many facts in your answers. PERMISSIBLE MATERIALS 1. Non programmable Scientific Calculator.

Upload: others

Post on 11-May-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

1 ... r

nAmIB I A U n IVERS I TY OF SCIEnCE AnD TECHnOLOGY

FACULTY OF COMPUTING AND INFORMATICS

DEPARTMENT OF COMPUTER SCIENCE

QUALIFICATION: BACHELOR OF COMPUTER SCIENCE

QUALIFICATION CODE: 07BACS LEVEL: 5

COURSE: Database Fundamentals COURSE CODE: DBF510S

DATE: June 2016

DURATION: 3 hours

EXAMINER(S)

MODERATOR:

SESSION: 1

MARKS: 100

FIRST OPPORTUNITY EXAMINATION QUESTION PAPER

MRS. JOSEPHINA MIKKA

MR. ISAAC NHAMU

THIS QUESTION PAPER CONSISTS OF 10 PAGES

(Excluding this front page)

INSTRUCTIONS

1. Answer ALL the questions.

2. Questions 2 and 3 must be answered on the Question paper and the sheets

attached to the answer sheet.

3. Write clearly and neatly.

4. Number the answers clearly.

5. When answering questions you should be guided by the allocation of marks in

[ ] . Do not give too few or too many facts in your answers.

PERMISSIBLE MATERIALS

1. Non programmable Scientific Calculator.

Page 2: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

' -r

Question 1: Multiple Choices

1. "A software system that enables users to define, create and maintain the database" .

This statement describes

A. Oracle lOg B. Microsoft Office Access 2007 C. Database Management System D. Data warehouse

2. The function of a database is to ________ _

A. collects and organizes input data B. check all input data C. check all spelling D. output data

3. Choose the software that is commonly used in database.

A. Oracle

B. SQL Access

C. SQL desktop

D. Linux

4. A is the set of allowable values for one or more attributes

A. Cardinality B. Tuple c. Degree D. Domain

[30]

5. Within a table, the primary key must be unique so that it will identify each row. When this is the case,

the table is said to exhibit ______________ integrity.

A. Referential B. Entity c. Enforced D. Key

6. The set of possible values of a column is called a ______ _

A. Range

B. Product

C. Domain

D. Function

1

Page 3: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

7. Which clause would you use in a SELECT statement to limit the display to those employees

whose salary is greater than 5000?

A. WHERE SALARY> 5000 B. HAVING SALARY> 5000 C. ORDER BY SALARY> 5000

D. GROUP BY SALARY> 5000

8. Based on Figure 1, identify which one is the Candidate Key?

A. W

B. X c. y

D. Z

z

L r

w

X y

/ Cust_SSN Cust_Name Cust_Address

111-11-1111 Konana CBA 3.246, UT, Austin

Figu re 1

Cust_State Cust_Phone

TX 512-471-5219

9. All companies operate four departments in their organization. The relationship between company and departments represents a ____ _

A. One-to-one relationship.

B. One-to-many relationship.

C. Many-to-one relationship .

D. Many-to-many relationship.

10 . SELECT *

FROM order

You use this SQL statement to retrieve data from a table for __ _

A. Viewing B. Deleting c. Inserting D. Updating

2

Page 4: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

' . r

11. Which are Data Manipulation Language (DML) statements?

i. S ELE CT

ii. ALTER

iii. DROP

iv. DELETE

A. i, iv

B. ii, iii

C. i, ii, iii

D. ii, iii, iv

12. What happens if the WHERE clause is omitted from a DELETE statement?

A. All records from the table are deleted

B. No record from the table will be deleted

C. First record ofthe table will be deleted

D. The statement will not be executed and will give a syntax error

13. Which of the following is an example of 1:N relationship

A. Course-has-Student

B. Teacher-teaches-students

C. Teacher-heads-Department

D. None of the above

14. The following operation is used to update the structure of the database table

A. Alter

B. Update

C. Change

D. None of the above

15. In ER modeling weak entity is identified for an owner entity using

A. Primary key

B. Super key

C. Candidate key

D. Partial key

3

Page 5: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

J ­I

16. Create table is a

A. DOL Command

B. DML command

C. Both A) and B)

D. None of the above

17. A single entity having more than one role in the same relationship is an example of

A. Binary relationship

B. Identifying relationship

C. Recursive relationship

D. Ternary relationship

18. The maximum number of relationship instances that an entity can participate in a relationship is called

A. Degree

B. Cardinality ratio

C. Min-max constraints

D. None of the above

19. Threats to the database result in the loss or degradation of the following:

A. Loss of integrity

B. Loss of availability

C. Loss of confidentiality

D. All of the above

20. Values of key attributes cannot be NULL is the requirement of

A. Key Constraint

B. Entity Integrity Constraint

C. Referential Integrity

D. None ofthe above

4

Page 6: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

) .

21. You need to produce a report for mailing labels for all customers. The mailing label must have only

the customer name and address. The CUSTOMERS table has these columns:

COST ID NUMBER(4) NOT NULL

CUST_NAME VARCHAR2(100) NOT NULL

CUST_ADDRESS VARCHAR2(150)

COST PHONE VARCHAR2(20)

Which SELECT statement accomplishes this task?

A. SELECT *FROM CUSTOMERS;

B. SELECT CUST_NAME, CUST_ADDRESS, CUST_PHONE FROM CUSTOMERS;

C. SELECT CUST_ID,CUST_NAME,CUST_ADDRESS, CUST_PHONE FROM CUSTOMERS;

D. SELECT CUST_NAME, CUST_ADDRESS FROM CUSTOMERS;

22. Which INSERT statement is correct to insert a new row into the table employees?

A. INSERT INTO employees employee_id)

VALUES (1000);

B. INSERT INTO employees

VALUES (NULL, 'John' ,Smith');

C. INSERT INTO employees(first_name,last_name)

VALUES('John', 'Smith');

D. INSERT INTO employees first_name,last name,employee_id)

VALUES ( 100, 'John', 'Smith');

23. If locking is not available and several users access a database concurrently, problems may occur if their

transactions use the same data at the same time. Concurrency problems include

i. Lost or buried updates.

ii. Uncommitted dependency iii. Inconsistent analysis

iv. Transaction Log

A. B. ii,iii

c. i,ii,iii

D. i,iii,iv

5

Page 7: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

( .

24. The NVL Function

A. Converts null to an actual value B. Converts date to a character data type. C. Converts null to numbers. D. Converts numbers to a null value.

25. You can use MAX and MIN functions for:

A. Date data type. B. Numeric data type. C. Character data type. D. Any data type.

26. What is the best data type for a field that stores mobile numbers?

A. Text B. Number C. Date/Time D. Memo

27. The single row function LPAD:

A. Pads the character value right-justified B. Pads the character value left- justified. C. Pads the character value Center-justified D. None of the above.

28. One solution to the multivalued dependency constraint problem is to :

A. split the relation into two relations, each with a single theme. B. changes the theme. C. creates a new theme. D. adds a composite key.

29. Wh ich of the following is another name for weak entity?

A. Child B. Owner C. Dominant D. All ofthe above

30. E-R model uses this symbol to represent a weak entity set?

A. Dotted rectangle . B. Diamond C. Doubly outlined rectangle D. None one of these

6

Page 8: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

' ' \' "

Question 2 [10]

Each statement below is either TRUE or FALSE. Choose the most appropriate one, answer on this sheet

and attach the sheet to your answer sheet.

Questions T F

2.1 Date and character Literal values must be enclosed in single quotations

2.2 Simple views can contain groups of data and functions

2.3 The default DATE format is DD-MON-YYYY

2.4 An index can be modified without dropping it.

2.5 The HAVING clause is used with conditions that contain group functions

2.6 The NATURAL JOIN and the USING clause are mutually exclusive

2.7 The ORDER BY clause can be placed in the subquery unless

performing a Top-N analysis

2.8 TRUNCATE TABLE Ernp is a Data Manipulation Language statement

2.9 The MAX function can be used with any datatype

2.10 The TO_ CHAR function can be used to convert dates to any valid date character

7

Page 9: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

Question 3

Match the descriptions/definitions in column X of Table 3.1 with the word/phrases in column Yin Table 3.2, Use the corresponding letters A, B, C, ... N from Table 3.2 to match the descriptions/definitions in Table 3.1. Fill in your answer in the column marked Match in Table 3.1. Attach this page to your answer sheet. [10]

X Match

3.1 The action of filling a database with records.

3.2 Nested within each other

3.3 Ensure accuracy and consistency of data in a relational database

3.4 Enormous datasets created by Web applications

3.5 A data model in which data are stored in relations and relationships between rows are represented by data values.

3.6 The order of the rows and columns is immaterial.

3.7 Allows us to model a general entity type and then subdivide it into several specialised entity types.

3.8 Statement of policy that restricts the ways in which data can be inserted, updated, or deleted in the database

3.9 Sequence of operations performed as a single logical unit of work.

3.10 The process of applying design rules and principles to ensure that a database performs as expected.

Table 3.1

y

A SQL

B Supertype/subtype relationships

c Normalisation

D Relational databases

E Populate

F Data Wa rehouse

G Subquery

H Entity

I Integrity Constraint

J Relation

K Big data

L Business Rule

M Relational Model

N Transaction

Table 3.2

8

Page 10: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

Question 4

Table 4.1 below shows the data dictionary for PRODUCT table:

Column Name Null ~ype

Product Number Number

NOT NULL Product_Name 1Varchar2{15)

Date manufactured Date

Batch_Number Number

Customer Name 1Varchar2(20)

Date_Dispatched Date

Quantity_supplied Number

Table 4.1

Use the information in Table 4.1 above to answer the following questions

a) Correct the coding errors in the following code: [3]

, _ SELECT Product_name, Batch, supplier, from Products, WHERE quantity <not equal to>lOO

b) Write SQL statements to insert the following record in the table:

Part number= 2016; Part name = Tube; Batch number= 33; Customer's name 4/3/09; Quantity dispatched= 2200.

Date of manufacture = 2/2/09; = Selma; Date of dispatch=

[3]

c) Count the number of products dispatched each day where there is more than 1 product. [3]

d) Write an SQL statement that will delete the PRODUCT table from the database. [2]

e) What is the difference between ON DELETE CASCADE and ON DELETE SET NULL clauses? [4]

9

Page 11: OF SCIEnCE AnD TECHnOLOGYexampapers.nust.na/greenstone3/sites/localsite...18. The maximum number of relationship instances that an entity can participate in a relationship is called

==] vehicle \,

vehiclelID ~ platNo

DN3013 1989 _ MooL JET246 1985 | POOL DAN3013 2002 'Ppoo2 WIM7204 2001 PDO1 DAS3013 2004 Ppo2 WPY8492 2008 Ppo3 DAJ1174 —«- 2000 TOOL DBG3013 2006

>.

i. SELECT vehicleID, platNo,

FROM vehicle

WHERE yearProduce >= 2000

yearProduce +.

Table 5.1

ORDER BY yearProduce asc

i SELECT vehicleID, platNo, model

FROM vehicle

WHERE model LIKE “Perodua%”

iil. SELECT vehicleID, platNo,

FROM vehicle

WHERE price < 20000

iv. SELECT SUM(price)

FROM vehicle

QUESTION 6

price

5000

25000

3000

14600

15600

40000

10000

65600

yearProduce,

yearProduce

model +.

Honda Accord

Mercedes Benz

Proton iswara

Proton Wira

Produa Kelisa

Produa Myvi

Produa kancil

Toyota Vias

model

[5]

[2]

a) The Jonesburgh County Basketball Conference (JCBC) is an amateur basketball association. Each city

in the country has one team that represents it. Each team has a maximum of 12 players and a

minimum of nine players. Each team also has up to three coaches (offensive, defensive, and PT

coaches.) Each team plays two games (home and visitor) against each of the other teams during the

season. Draw the Chen and Crow’s Foot E-R diagram to represent the JCBC database. [15]

<<<<<<<<< END >>>>>>>>

10

, .

Question 5

a) Generate the output for the following SQL statements based on the Table 5.1.

~ vehicle

vehicl e!D · I platNO • [ yearProdu ce · I price . model · I Ill! rDN3013 1989 5000 Honda Accord

MOOl JET246 1985 25000 Mercedes Benz

POOl DAN3013 2002 9000 Proton iswara

P002 VJJM7204 2001 14000 Proton Wira

POOl DAS3013 2004 15000 Produa Kelisa

PD02 VJPY8492 2008 40000 Produa Myvi

PD03 DAJ1174 2000 10000 Produa kancil

DBG3013 2006 65000 Toyota Vios

Table 5.1

i. SELECT vehicleiD, platNo, yearProduce, model FROM vehicle WHERE yearProduce >= 2000 ORDER BY yearProduce asc

ii. SELECT vehicleiD, platNo, model FROM vehicle

iii.

iv.

QUESTION 6

WHERE model LIKE "Perodua%u

SELECT vehicleiD, platNo, yearProduce FROM vehicle WHERE price < 20000

SELECT SUM(price) FROM vehicle

[5]

[2]

[ 5]

[3]

a) The Jonesburgh County Basketball Conference (JCBC) is an amateur basketball association. Each city

in the country has one team that represents it. Each team has a maximum of 12 players and a

minimum of nine players. Each team also has up to three coaches (offensive, defensive, and PT

coaches.) Each team plays two games (home and visitor) against each of the other teams during the

season. Draw the Chen and Craw's FootE-R diagram to represent the JCBC database. [15]

<<<<<<<<<END>>>>>>>>

10