CUSTOMER_CODE SMUDE DIVISION_CODE SMUDE

advertisement
CUSTOMER_CODE
SMUDE
DIVISION_CODE
SMUDE
EVENT_CODE
SMUAPR15
ASSESSMENT_CODE MC0082_SMUAPR15
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
5146
a.Explain the five ways to describe a set.
QUESTION_TEXT
b.What is the value of
c.Define Deterministic Finite Automata.
a.(5 marks)
i.Describe a set by describing the properties of the members of the
set.
ii.Describe a set by listing its elements.
iii.Describe a set A by its characteristic function.
iv.Describe a set by recursive formula. This is to give one or more
elements of the set and a rule by which the rest of the elements of
the set may be generated.
v.Describe a set by an operation (say union, intersection,
complement etc ) on some other set.
SCHEME OF
EVALUATION
b.=(1/2)+(2/3)+(3/4)=23/12 (2 marks)
c.A DFA is 5-tuple or quintuple M=(Q, Σ, δ, q 0, F) where
Q is non-empty, finite set of states
Σ is non-empty, finite set of input alphabet
Δ is transition function, which is mapping from Q x Σ to Q. for this
transition function the parameters to be passed are state and input
symbol.
Based on the current state and input symbol, the machine may enter
into another state.
q 0∈Q is the start state.
F⊆Q is set of accepting or final state.
(3 marks)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72481
QUESTION_TEXT
Obtain a PDA to accept the language L={anb2n|n≥1}.
SCHEME OF
EVALUATION
The PDA to accept the given language is M = (Q, ∑, I’, δ, Z0, F)
where
Q = {q0, q1, q2}, q0 is the start state
∑ = {a, b}
Г = {a, Z0}, is the initial number of the stack, F= {q2} is the final
state. 5 Marks
The transitions δ are given by
5 Marks
δ(q0, a, Z0) = (q0, aaZ0)
δ(q0, a, a) = (q0, aaa)
δ(q0, b, a) = (q1, Λ)
δ(q1, b, a) = (q1, Λ)
δ(q1, Λ, Z0) = (q2, Λ)
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72482
QUESTION_TEXT
Show that the relation “a
relation on Z.
SCHEME OF
EVALUATION
Solution: Let a Z.
Reflexive: Since n divides a - a = 0, we have a a mod n.
Symmetric: Let a b mod n.
n divides a - b
n divides - (a - b)
n divides b - a
b a mod n.
Transitivity: Let a, b, c €Z such that a b mod n, b c mod
n.
n divides a - b, and n divides b - c
n divides ( a - b ) + ( b - c)
n divides a - c
a c mod n.
Hence the relation is an equivalence relation.
b mod n” is an equivalence
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72483
QUESTION_TEXT
Explain the Pigeonhole principle and prove it along with an
example.
SCHEME OF
EVALUATION
Solution:
Pigeonhole principle: If A and B are finite sets and |A| > |B|,
then there is no one-to-one function from A to B.2 Marks
Proof:
Basic step:
Suppose |B| = 0, then there is no function f: A B and so no one
to one function. 2 Marks
Induction Hypothesis:
Suppose that f is not one-to-one, provided that f: A  B, |A| >
|B|, and |B| ≤ n, where n≥0. 2 Marks
Induction Step:2 Marks
Suppose that f:A  B and |A| >|B| = n+1. Choose some a €
A) if there is another element
a ≠ a’€A, such that f(a) = f(a’), then obviously f is not a one-to-one
function, and we are done.
Example 2 Marks
QUESTION_TYPE
DESCRIPTIVE_QUESTION
QUESTION_ID
72484
QUESTION_TEXT
Explain the various types of grammars in detail
Solution:
Explanation of:
2 x5 = 10 Marks

Type 0 grammar or unrestricted grammar

Type 1 grammar or context sensitive grammar

Type 2 grammar or context free grammar

Type 3 grammar or regular grammar
SCHEME OF EVALUATION
Monotonic grammar
QUESTION_TYPE DESCRIPTIVE_QUESTION
QUESTION_ID
109986
Construct a grammar for the following language:
QUESTION_TEXT i.
ii.
i.
SCHEME OF
EVALUATION
L = {ai bj/i,j≥1, i j}
L = {0i1j/i j, i≥0 and j≥0}
Solution:
We decompose
where
Grammar for L1: Set of production for L1
A
 aA
A
 aB
B
 aBb
B
 ab,
where VT = {a, b} , VN = {A, B}
A is a starting symbol.
ii.
Solution: It is clear from the statement that it a string has n
number of 0’s as the prefix, this prefixed string should not be
followed by n number of 1’s, that is, we should not have equal
number of 0’s and 1’s. At the same time, 0’s should precede 1’s. The
grammar for this can be written as:
G = (VN, VT, , S) where
VN = {S, A, B, C}
VT = {0, 1}
Productions
:
S  0S1 (generates 0i1j recursively)
SA
(to generate more 0’s than 1’s)
SB
(to generate more 1’s than 0’s)
A  0A 0 (at least one 0 is generated)
B  1B 1 (at least one 1 is generated); and
S is the starting symbol.
(5 marks each)
Download