158.337 Database Development - Massey (Albany) - Exam - S1 2012
158.337 Database Development - Massey (Albany) - Exam - S1 2012
158.337 Database Development - Massey (Albany) - Exam - S1 2012
337 SC
ALB
Distance/Internal
MASSEY UNIVERSITY
ALBANY CAMPUS
EXAMINATION FOR
158.337 DATABASE DEVELOPMENT
SECTION A
64 Multi-choice questions (Scantron Card) 64 * 0 .75 = 48 Marks
SECTION B
24 True / False questions (Scantron Card) 24 * 0.5 = 12 Marks
SECTION C
One question (Blue Answer booklet) 40 Marks
Scantron Cards
Ensure that your name and identification number are entered on your Scantron Card.
Record your answer on your Scantron card by putting a solid horizontal pencil line
through the character representing the ‘best’ answer to the question with a blunt 2B
or 3B pencil, please. The Scantron Card will not read properly if you do not follow
these instructions. At the conclusion of the examination hand in the Scantron Card
separately.
Page 1 of 19
1201/158.337 SC
ALB
Distance/Internal
SECTION A
Attempt all the following questions. There is one (1) correct answer.
Record the answer that applies best on your Scantron card.
The Scantron Card has five options. Ignore the fifth option (e)
(Total Marks = 48)
Page 2 of 19
1201/158.337 SC
ALB
Distance/Internal
9. Emerging data models used to support large scale distributed Web architectures
such as Twitter are NOT geared towards __________________.
a. eventual consistency
b. performance consistency
c. transaction consistency
d. eventual, performance and transaction consistencies
C1 C2 C3 C4 C5
10. C1 → C2
11. C4 → C5
Page 3 of 19
1201/158.337 SC
ALB
Distance/Internal
13. Given Figure 2, which SQL statement(s) will add PRIMARY KEY and FOREIGN KEY
in the table LINE.
Figure 2
14. If you use a surrogate key, you must ensure that the candidate key of the entity in
question performs properly through the use of the ___________________
constraints.
a. UNIQUE and NOT NULL
b. CHECK and UNIQUE
c. REFERENCES
d. DEFAULT
Page 4 of 19
1201/158.337 SC
ALB
Distance/Internal
15. A ____ trap occurs when you have one entity in two 1:M relationships to other
entities, thus producing an association among the other entities that is not expressed
in the model.
a. surrogate
b. design
c. fan
d. time-variant
16. Which of the following does NOT match the string ‘_T%’ when used with the LIKE
operator?
a. MT
b. MTW
c. T
d. MTWRF
17. Given the following table (Table 1), which statement is FALSE?
Table 1
STUDENT_CLASSIFICATION
HOURS_COMPLETED CLASSIFICATION
Less than 30 Fr
30 - 59 So
60 - 89 Jr
90 or more Sr
18. Which statement would be used to select all students with more than one grade?
a. WHERE COUNT(grade) > 1
b. WHERE COUNT(grade) >= 1
c. HAVING COUNT(grade) > 1
d. HAVING COUNT(grade) >= 1
Page 5 of 19
1201/158.337 SC
ALB
Distance/Internal
20. BCNF can be violated only if the table contains more than one ____ key.
a. primary
b. candidate
c. foreign
d. secondary
A B C D
Page 6 of 19
1201/158.337 SC
ALB
Distance/Internal
26. When we use a SQL statement inside a PL/SQL block that returns more than one
row, we use a(n) __________ cursor.
a. explicit
b. implicit
c. fetch
d. join
Case: A database to keep track of expenses made during business trips for each
salesperson is designed as follows:
SalesPerson (Sales_Person_ID, FName, LName, Start_Year)
Trip (Trip_ID, From_City,To_City, Departure_Date, Return_Date)
Expense (Trip_ID, Account_Num, Amount)
31. The ___________ set operator is essential for each join operation.
a. CARTESIAN
b. PROJECT
c. UNION
d. UNION ALL
Page 7 of 19
1201/158.337 SC
ALB
Distance/Internal
32. Which of the following syntax is used for queries within a PL/SQL block?
a. SELECT <column_list> FROM <table_name>
INTO <declared_variables> WHERE <condition>
b. SELECT <column_list> INTO <declared_variables>
FROM <table_name> WHERE <condition>
c. SELECT <column_list> FROM <table_name>
WHERE <condition> INTO <declared_variables>
d. SELECT <column_list> INTO <declared_variables>
FROM <table_name> WHERE_BY <condition>
33. When we use a surrogate key as the primary key of an entity, we say that the entity
is _____________.
a. strong
b. weak
c. moderate
d. typed
34. Consider the following dependencies among attributes. This table structure can be
normalised further to ________.
A+B C, D, E, F
EF
a. 2NF
b. 3NF
c. 4 NF
d. BCNF
35. Consider the following dependencies. The table structure is currently in _______.
A+B C, D, E, F
A C, F
DE
a. 1NF
b. 2NF
c. 3NF
d. 4NF
36. In ANSI/SPARC model architecture which of these levels represent a view used by
the application program?
a. Physical
b. Internal
c. External
d. Conceptual
Page 8 of 19
1201/158.337 SC
ALB
Distance/Internal
37. The ___________ SQL command modifies an attribute’s values in one or more rows
in a table.
a. INSERT
b. UPDATE
c. COMMIT
d. SELECT
39. Which of the following is a valid PL/SQL statement to request ST_SALARY from
STAFF table into a local variable V_SALARY?
STAFF
ST_STAFFNO
ST_NAME
ST_POSITION
ST_SALARY
40. If the following statement is executed, what happens to the triggers that exist for the
STAFF table?
DROP TABLE STAFF;
a. The triggers are disabled.
b. The triggers are dropped.
c. The triggers are not affected.
d. The triggers status is marked as INVALID.
41. A host/bind variable called g_result is declared. The variable g_result can be
accessed in a PL/SQL block by referencing it as
a. g_result
b. :g_result
c. #g_result
d. &g_result
Page 9 of 19
1201/158.337 SC
ALB
Distance/Internal
44. In the given PL/SQL block, we will display p_phone_formatted by using a(n)
________ variable.
CREATE OR REPLACE PROCEDURE phone_fmt_sp
(p_phone IN VARCHAR2, p_phone_formatted OUT VARCHAR2)
IS
BEGIN
p_phone_formatted := '(' || SUBSTR(p_phone,1,3) || ')' ||
SUBSTR(p_phone,4,3) || '-' || SUBSTR(p_phone,7,4);
END;
.
/
a. anchored
b. cursor
c. host
d. scalar
Page 10 of 19
1201/158.337 SC
ALB
Distance/Internal
47. The ____ command is used with the ALTER TABLE command to modify the table for
deleting a column.
a. DROP
b. DELETE
c. REMOVE
d. ERASE
48. Review the following IF statement. What is the resulting value if lv_amt_num has a
value of 1200?
BEGIN
IF lv_amt_num > 500 THEN
lv_ship_num :=5;
ELSIF lv_amt_num > 1000 THEN
lv_ship_num :=8;
ELSIF lv_amt_num > 1700 THEN
lv_ship_num := 10;
ELSE
lv_ship_num :=13;
END IF;
DBMS_OUTPUT.PUT_LINE(lv_ship_num);
END;
a. 5
b. 8
c. 10
d. 13
Page 11 of 19
1201/158.337 SC
ALB
Distance/Internal
50. The ____ statement in SQL combines rows from two queries and returns only the
rows that appear in the first set but not in the second.
a. UNION
b. UNION ALL
c. INTERSECT
d. MINUS
51. Which query is used to list a unique value for V_CODE, where the list will produce
only a list of those values that are different from one another?
a. SELECT ONLY V_CODE FROM PRODUCT;
b. SELECT UNIQUE V_CODE FROM PRODUCT;
c. SELECT DIFFERENT V_CODE FROM PRODUCT;
d. SELECT DISTINCT V_CODE FROM PRODUCT;
52. A(n) _________ join requires the use of a table alias to mimic the referencing of two
different tables, when in reality, they are the same table.
a. Union
b. Recursive
c. Cartesian
d. Alias
55. If an entity can exist apart from one or more related entities, it is said to be ____-
independent.
a. business
b. existence
c. relationship
d. weak
Page 12 of 19
1201/158.337 SC
ALB
Distance/Internal
56. As long as two transactions, T1 and T2 access _______ data, the order of execution
is irrelevant to the final outcome.
a. shared
b. common
c. unrelated
d. locked
57. The scheduler guarantees that the execution of concurrent transactions will yield the
same result, as though the transactions were executed one after the other to ensure
transaction ________________.
a. atomicity
b. durability
c. isolatability
d. serializability
58. The ____ scenario describes a fully distributed DBMS with support for multiple data
processors and transaction processors at multiple sites.
a. multiple-site processing, single-site data
b. single-site processing, multiple-site data
c. single-site processing, single-site data
d. multiple-site processing, multiple-site data
59. ______________ means that the database will be in a permanent consistent state
after the execution of a transaction.
a. Atomicity
b. Durability
c. Isolation
d. Serializability
60. A(n) ____________ condition occurs when two or more transactions wait for each
other to unlock data.
a. deadlock
b. exclusive lock
c. binary lock
d. two-phase lock
61. Which of the following statement is FALSE about the Transaction Log (TL)?
a. TL stores the beginning and end of the transaction.
b. TL stores the type of operation (update, delete, etc) performed by each
SQL request.
c. TL plays a crucial role for database recovery and concurrency
management.
d. TL reduces the processing overheads of a DBMS.
Page 13 of 19
1201/158.337 SC
ALB
Distance/Internal
64. Each time a new product is created, it must be added to the product inventory, using
PROD_QOH in a table named PRODUCT.
Suppose you are a manufacturer of product ABC, which is composed of parts A,
B, and C. If a product ABC is created, then parts inventory, using PART_QOH in
a table named PART, must also be reduced by one for each of the parts A, B, and
C.
PRODUCT PART
PROD_CODE PROD_QOH PART_CODE PART_QOH
ABC 1,205 A 567
B 98
C 549
Page 14 of 19
1201/158.337 SC
ALB
Distance/Internal
SECTION B
66. One of the disadvantages of stored procedures is that they increase network traffic.
a. True
b. False
67. Entity integrity is enforced automatically when the primary key is specified in the
CREATE TABLE command sequence.
a. True
b. False
68. You cannot insert a row containing a null attribute value using SQL.
a. True
b. False
70. With partial dependencies, data redundancies occur because every row entry
requires duplication of data.
a. True
b. False
Page 15 of 19
1201/158.337 SC
ALB
Distance/Internal
72. A Boolean variable in a PL/SQL block can hold three types of values – TRUE, FALSE
and BLANK.
a. True
b. False
74. The DUAL table consists of two rows and one column.
(DUAL = DoUble rows + A coLumn)
a. True
b. False
75. The following statement is invalid and when executed will result in an ORACLE
error.
SELECT SYSDATE, 'Exam Time', student_id
FROM student
a. True
b. False
76. Given the following business rules, we will place the foreign key in DEPARTMENT
table:
An EMPLOYEE manages zero or one DEPARTMENT; each DEPARTMENT is
managed by one EMPLOYEE.
a. True
b. False
77. Relationship participation and relationship strength refer to the same issue for
recursive relationships.
a. True
b. False
78. A view is not dropped when its corresponding tables are dropped.
a. True
b. False
79. The COUNT(*) function can be used to include NULL values in its results.
a. True
b. False
Page 16 of 19
1201/158.337 SC
ALB
Distance/Internal
81. A field-level lock allows concurrent transactions to access the same row, as long as
they require the use of different fields within that row.
a. True
b. False
Questions 82 – 84 are based on the two tables – MACHINE and BOOTH – shown in
Figure 4
Figure 4
MACHINE BOOTH
MACHINE_PRODUCT MACHINE_PRICE BOOTH_PRODUCT BOOTH_PRICE
Chips 1.25 Chips 1.5
Chocolate Bar 1 Chocolate Bar 1.25
Energy Drink 2 Energy Drink 2
85. Given the following three business rules, PATIENT is in a ternary relationship
i. A DOCTOR writes one or more PRESCRIPTIONs.
ii. A PATIENT may receive one or more PRESCRIPTIONs.
iii. A DRUG may appear in one or more PRESCRIPTIONs.
a. True
b. False
86. Constraints defined in a table can be disabled and can also be dropped.
a. True
b. False
Page 17 of 19
1201/158.337 SC
ALB
Distance/Internal
88. Cardinality expresses the minimum and maximum number of entity occurrences
associated with one occurrence of the related entity.
a. True
b. False
contd……
Page 18 of 19
1201/158.337 SC
ALB
Distance/Internal
SECTION C
(Total Marks = 40)
Table 2
(20 marks)
b) Use the above information to create an entity relationship diagram (ERD).
Use only Crow’s Foot notations in your diagram. Flag the primary and foreign
keys. Also add appropriate association names to your diagram and mark
relationships as identifying or non-identifying.
(20 marks)
NOTE: Use good naming conventions. You can add more attributes based on any
further assumptions you make.
Page 19 of 19