Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
nAmIB I A U n IVERS I TY OF SCIEnCE AnD TECH n 0 LOGY
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: July 2016
DURATION: 3 hours
EXAMINER(S)
MODERATOR:
SESSION: 2
MARKS: 100
SECOND OPPORTUNITY EXAMINATION QUESTION PAPER
MRS. JOSEPHINA MIKKA
MR. ISAAC NHAMU
THIS QUESTION PAPER CONSISTS OF 11 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.
QUESTION 1: MULTIPLE CHOICES [30]
1. A Gender field can hold only the values M or F. This is an example of:
A. key integrity B. domain integrity C. referential integrity D. logical integrity
2. The EmployeeiD field in an employee table cannot be left blank. This is an example of:
A. key integrity B. domain integrity C. referential integrity D. schema integrity
3. The person responsible for the database technology, database design and construction consultation, security, backup and recovery, and performance tuning is known as a (n):
A. data administrator B. database administrator C. system owner D end-user
4. Which language is used by the DBMS to physically establish those record types, fields, and structural relationships in a relational database?
A. DML B. DOL C. DBA D. CASE
5. The physical, relational database implementation of a data model is known as a:
A. scenario B. role model C. schema D. primary data model
6. Which of the following is NOT a high-performance relational DBMS?
A. Oracle B. IBM DB2 C. Microsoft SQL Server D. Microsoft Access
7. Files that contain relatively static data that can be shared by applications to maintain consistency and improve performance are known as:
A. document B. table look-up c. archival D. audit
1
8. A database that stores data extracted from operational databases for the purpose of data mining is called a (n):
A. transactional database B. personal database C. workgroup database D. data warehouse
9. Which of the following is an acceptable technique for implementing supertype/subtype entities?
A. Each supertype and subtype can be implemented with a separate table . B. The subtypes may be collapsed into the supertype to create a single table . C. The supertype's attributes could be duplicated in a table for each subtype. D. all of these
10. The underlying design of a table is referred to as the:
A. source file B. structure c. caption D. archival
11. Pointers to the records of a different file in a database, they are used to link records of one type to those of another type:
A. attributes B. referential pointers C. descriptive fields D. foreign keys
12. Which is not true about surrogate keys?
A. They are short. B. They are fixed. C. They have meaning to the user. D. They are numeric.
13. A staff member called Maria realizes that her name is misspelt to Mary in a database.
Choose the correct answer that updates firstname, Mary to firstname, Maria in the table
called staff.
A. UPDATE RECORD staff SET FName = 'Maria' WHERE FName = 'Mary';
B. UPDATE staff SET FName ='Maria' WHERE FName ='Mary';
C. UPDATE staff SET INTO FName = 'Maria' WHERE FName = 'Mary';
D. UPDATE RECORD staff SET INTO FName ='Maria' WHERE FName ='Mary';
2
14. A goal of normalization is to minimize __ _
A. the number of relationships
B. the number of entities
C. the number of tables
D. dataredundancy
15. A table that satisfies 2NF ------
A. always satisfies 1NF
B. may violate 1NF
C. always satisfies 3N F
D. always satisfies BCNF
16. On an entity-relationship diagram, a diamond shape represents a ____ _
A. multivalued attribute
B. data flow
C. entity
D. relationship
17. Based on Figure 1 the BOOKS and MEMBER entities are related to each other. The relationship
on the MEMBER side indicates that:
BOOKS MEMBER
PK ISBN PK MEMBERID
* TITLE ~· o PRICE O,N
borrow (O,l)
:> --- ----0{ borrowed by
*NAME * ADDRESS o PHONE o EMAIL
Figure 1
A. A BOOKS may be borrowed by one or more MEMBER.
B. A MEMBER may borrow one BOOK.
C. A BOOKS may be borrowed by zero or one MEMBER only.
D. A MEMBER may borrow zero or more BOOKS.
3
18. is the ability of the DBMS to recover the committed transaction updates against
any kind of system failure .
A. Consistent B. Isolated
C. Durable
D. Atomic
19. Deadlocks are possible only when one of the transactions wants to obtain a{n) __ lock on a data item.
A. Binary
B. Exclusive
C. Shared
D. Complete
20. refers to the requirement that other operations cannot access data that has been
modified during a transaction that has not yet been completed.
A. Consistent
B. Isolated
C. Durable
D. Atomic
21. Which of the following term below refers to the statement stated below?
• All of the tasks of a database transaction must be completed • If incomplete due to any possible reasons, the database
transaction must be aborted.
A. Consistent
B. Durable
C. Atomic
D. Isolated
4
22. Choose the correct Entity Relationship Model diagram based on the situation given.
A.
B.
c.
D.
11Each INSTRUCTOR may teach one or more CLASS"
11Each CLASS is taught by one INSTRUCTOR"
INSTRUCTOR 1 1
(0, N) (1,1)
INSTRUCTOR 1 1
teac
(0,1) (1,1)
1 M
INSTRUCTOR
(1,N) (1,1)
1 M
INSTRUCTOR L..._ ___ ____, (O,N) (1,1)
CLASS
CLASS
CLASS
CLASS
5
23. ____ produces the relation that has attributes of Rl and R2
A. Cartesian product B. Difference C. Intersection D. Product
24. Which are the two ways in which entities can participate in a relationship?
A. Passive and active B. Total and partial C. Simple and Complex D. All ofthe above
25. Which of the following database activities allow for the actual retrieval and use of a database?
A. Enterprise modeling B. Logical database design C. Physical database design and definition D. Database implementation
26. Whose role is it to determine the requirements and design for a database?
A. Database analysts B. Database administrators C. Both A and B. D. Neither A or B.
27. Which of the following is a comparison operator in SQL?
A. = B. LIKE C. BETWEEN D. All of the above
28. What do you need if you should enforce many-to-many relationship between two tables?
A. Parent table B. Child table C. Junction table D. Many-to-many relationship can't be created in database
6
29. An entity set that does not have sufficient attributes to form a primary key is a
A. strong entity set B. weak entity set C. simple entity set D. primary entity set
30. In a craw's foot cardinality notation a circle indicates
A. one B. many C. zero D. one and only one
7
QUESTION 2: TRUE\FALSE (10]
Each statement below is either TRUE or FALSE. Choose the most appropriate one
Questions T F
2.1 Placing Null values for an attribute is avoided as they do not have any specific meaning.
2.2 GROUP BY is an example of aggregate function.
2.3 Modifying the database without ensuring that transaction will commit may leave database in a consistent state.
2.4 Table in second normal forms {2NF) eliminates all hidden dependencies
2.5 A database is ordered collection of data.
2.6 Update anomalies can occur in a normalized relation .
2.7 SQL DROP is used to remove objects from the database.
2.8 A good data model is complex. As a general rule, the data attributes that describe an entity should describe all possible characteristics of that entity.
2.9 Most database management systems store both user data and metadata.
2.10 During the creation of database schemas, NULL means the field must have a value; . whereas, NOT NULL means the field must not have a value .
8
QUESTION 3:
Match the descriptions/definitions in column X of Table 3.1 with the word/phrases in column V in 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 High level data model
3.2 Joint operation on two tables is a sunset of
3.3 Attribute of an entity having more than one value
3.4 To suppress any duplicate values in any column this
clause is used
3.5 A relational database in 3NF and many still have undesirable data-redundancy because
3.6 Elimination of transitive dependency on key attribute
3.7 When an entity is related to itself
3.8 X-7Y if X determines Y uniquely
3.9 Relationsh ip of a weak entity with it's owner entity
3.10 Command used to modify record of the table
Table 3.1
v A Multivalued
B Modify
c Non-trival FD,s involving prime attribute on
RHS
D Third normal form
E Update
F Conceptual level
G Cross-Product
H Distinct
I ER Model
J Recursive relationship
K Composite attribute
L Functional dependency
M Identifying relationship
Table 3.2
9
STRUCTURED QUESTIONS (50 marks)
INSTRUCTION: This section consists of THREE (3) structured questions.
Answer ALL questions.
QUESTION 4
1. Study the tables STUDENT, ENROLL and CLASS in Figure 4.1:
STU_NUM
321452
_10014_-10014 10018 10018 10021
CLASS_CODE
10014 10018
--·--·· -- ·-
i.
ii.
ii.
iv)
STU_LNAME
Bowser
STU_NUM ENROLL_ GRADE
321452 c 324257 B 321452 A 324257 B 321452 - c
CRS_CODE CLASS_SECTION
-I ACCT-211 3 CIT-220 2
---Figure 4.1
Determine primary key for each table
Determine foreign keys for these tables
CLASS_TIME
THUR. 2:30 - 3.4 I MON. 9:00 - 9:5d
Write suitable command to create a table called CLASS
CLASS_ROOM
BUS252 KLR211
Give an explanation of what the following SQL statement will result in.
PROF_NUM
342 114
[2]
[2]
(4]
[6]
SELECT employee_id, hire_date, MONTHS_BETWEEN (SYSDATE, hire_date) Months_hired, ADD_MONTHS (hire_date, 6) REVIEW, NEXT_DAY (hire_date, 'MONDAY'), LAST_DAY (hire_date) FROM Employees Where MONTHS BETWEEN (SYSDATE, hire_date) < 50;
v) How would you select all the records from a table named 'Persons' where the
value of the column "FirstName" starts with an "a" using SQL statement? [2]
10
QUESTION 5
a) Explain how the log file is a fundamental feature in any database recovery mechanism. [4]
b) Identify THREE (3) DDL statements in SQL and the function of each statement
c) Describe the terms below:
i) Subquery
ii) Column aliases
QUESTION 6
[6]
[4]
Design an ER diagram for keeping track of information about votes taken in the U.S. House of
Representatives during the two-year congressional session. The database needs to keep track of
each U.S. state's Name (e.g. Texas, New York, California) and includes the region of the state
(whose domain is {North East, Midwest, Southwest, West}). Each CONGRESSPERSON in the House
of Representatives us described by their Name, and includes the District represented, the StartDate
when they were first elected, and the political Party they belong to (whose domain is {Republican,
Democrat, Independent, other}). The database keeps track of each BILL (i.e. proposed law), and
includes the BiiiName, the DateONote on the bill, whether the bill PassedOrFailed (whose domain
is {YES, NO}), and the sponsor (the congressperson(s) who sponsored - i.e., proposed -the bill).
The database keeps track of how each congressperson voted on each bill (domain of vote attribute
is {Yes, No, Abstain, Absent}).
Draw an ER schema diagram for the above application. (State clearly any assumption you make.) [20]
<<<<<<<<<< END >>>>>>>
11