Professional Documents
Culture Documents
ASSESSMENT : COMP202PA
PATTERN
TIME : 10:00 am
This paper is suitable for candidates who attended classes for this
module in the following academic year(s):
2015/2016,2016/2017
2016/17-COMP202PA-001 -EXAM-135
© 2016 University College London . . TURNOVER
COMP202P Logic and Database Theory Examination 2016-17
1. DATABASES
a) Some of the statements 1 to 12 below about databases and database design may be false. In your
answer books, say whether each statement is true or false. You will gain one mark for a correct
answer but you will lose half a mark for an incorrect answer (the lowest mark you can receive for
all of this part of the question is zero). You may state that you don't know the answer, in which
case no marks will be gained or lost. If you are unsure about an answer then you may provide a
brief explanation for the answer you have given and this will be taken into account if your answer
is incorrect. [12]
1) All of the following are often given as advantages of database management systems: (i)
control of data redundancy; (ii) data consistency; (iii) more information from the same
amount of data; (iv) improved data integrity; (v) improved security; (vi) sharing of data;
(vii) reduced vulnerability to catastrophic failure.
2) An attribute domain is the set of all the theoretically possible values an attribute might
have.
3) A multi-valued attribute is an attribute which has different utilities for different users.
4) A Weak Entity Type is an entity which depends only weakly on other entities.
6) The 'lossless-join' property of tables that have been decomposed through normalisation
means that the loss of data from joining those tables is reduced.
7) Boyce-Codd Normal Form requires that any field or combination of fields on which
another field is dependent could have been a primary key of the table.
9) When translating an entity relationship diagram into a database schema, if two entities
have a one-to-one relationship with mandatory participation on both sides, then you
should combine the two entities into a single table.
10) The relational data model requires that a many-to-many relationship between entities is
not recorded in a separate table.
11) A table with a primary key is automatically in first normal form (1NF).
12) A table whose primary key is a composite of every field must necessarily be in third
normal form (3NF).
b) The schema for a retailer's database is shown below (primary keys are underlined)
customers (custlD. firstname, familyname, town, state)
i) Write a SQL query to find how many customers there are in each state [8]
ii) Write a SQL query containing a sub-query to find how many customers bought more than 2 of
the same item in a single order. [8]
c) The schema below is of a database that records who played what role in which film and for how
many minutes they were on screen etc. Primary key fields are underlined, each table has a
Some of the statements about the schema that follow may be false. In your answer books, write the
index number for each statement and say whether the statement is 'true', or 'false', or you 'don't
know' whether it is true or false. You will gain one mark for a correct answer but you will lose
half a mark for an incorrect answer (the lowest mark you can receive for all of this part is zero).
[5]
Rolf
COMP202P CONTINUED
[Question 1 continued]
Hi) The composite key of FilmNo and actorNo won't be sufficient for the Film/Actor/Role table
because an actor may play the same role in different films.
iv) Removing all partial dependencies from this schema results in three additional tables.
v) One additional table will be created in moving this database from second to third normal form.
[Total: 33 marks]
b. For each of the following non-deterministic finite state machines with null transi
1.
a,b ( q\ ) a, b
start—>( <?o
2.
start
[6 marks]
c. For each machine in the previous question, write down a regular expression that
d. For each of the following regular expressions, define a deterministic FSM that ac
1. ({aaa)\(aba))*
2. b((aa) * \(aaa)*)b
[7 marks]
e. Prove that the following language is not a regular language: the set of words over
[Total=33 marks]
COMP202P CONTINUED
3. Let L be a first-order language with two constants C = {c, d}, no function symbols
F = 0 and four predicate symbols P = {R, S, =, E}, where R and B are unary and E, =
are both binary and written infix. Interpret the nodes satisfying R as 'red', the nodes
satisfying B as 'blue' and the pair of nodes satisfying E as the edges of a graph.
a. Write down first order formulas that express the following statements
[6 marks]
[6 marks]
c. Define a first-order formula <f>n{x, y) which holds when 'there is a path from x to y
of length at most n', where n > 0. You may use a recursive definition.
[7 marks]
e. Using the compactness theorem, what can you conclude about the class of all con
nected graphs?
[7 marks]
[Total=33 marks]