Programming Languages (Quiz 1-4) Flashcards

1
Q

The mathematical models are called machines and the types of inputs on which they operate successfully call the language of the machine.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A finite set of fundamental units out of which we build structures is called

A

Alphabet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Λ is a word with no letter.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The language which has no words is denoted by

A

ɸ (phi)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

The set of words is always finite but alphabets can be infinite.

A

False. (Set of words is infinite, the alphabet is finite)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Given an alphabet Σ, the closure of Σ (or Kleene star), denoted by Σ+, is the language containing all words made up of finite sequences of letters from Σ, including the empty string Λ.

A

False. Σ*, not Σ+.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which of the following is true for Σ = {x}? (What will the Kleene-Star contain?)

A

It will contain Λ and finite sequences of letters in the alphabet. Σ * = { Λ, x, xx, xxx, …} .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

If S = {xx, xxx},

and xxxxxxx Є S*,

then which of the following is the factor of S:

A

xx|xx|xxx and xx|xxx|xx.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The Kleene closure of a language S always produces an infinite language unless S = ɸ or S = {Λ}.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If S = {a, b, Λ } than S+ = { Λ, a, b, aa, bb, ab, ba, …}.

A

True, Kleene-Star contains Λ while Positive Closure does not.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A recursive definition is characteristically a three-step process.

A

True.

  1. Specify the basic words
  2. Rules for constructing new words from ones already known
  3. Declare that no word except those constructed by following rules 1 and 2 are in the language
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

∑ = {x}

Rule 1 Λ is in L1.

Rule 2 if w is any word in L1, then xw is also in L1.

What is this L1 = ?

A

x*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Rule 1 x is in L1.

Rule 2 if w is any word in L1, then xxw is also in L1.

What is this L1 = ?

A

X odd

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

language(ab) ≠ language(ab)*

A

True.
(ab) = ab, aabb, aaabbb, …
(ab)* = ab, abab, ababab, …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Consider the language T (language whose words are constructed from either a or c followed by some b’s) defined over the alphabet Σ whereas Σ = {a, b, c}

Which of the following is true for language T? (define language T)

A
T = language((a+c)b*) 
T = {a, c, ab, cb, abb, cbb, abbb, cbbb, …}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Regular expression (a+b)a(a+b) + b* can be simplified into what?

A

(a+b)*

17
Q

(a+b)a(a+b)a(a+b)* and babab* are equivalent regular expressions which accept all words that have exact two a’s.

A

False. First regular expression contains AT LEAST 2 a’s, while the second expression contains EXACTLY 2 a’s.

18
Q

Let S = {a, bb} and T = {a, ab} then ST =?

A

ST = {aa, aab, bba, bbab}

19
Q

For all regular expressions, there is some language associated with it.

A

True. Regular expressions guide you to accepted words in the language.

20
Q

The regular expression must be infinite if the language defined is infinite.

A

False, Regular expression must be infinite.

21
Q

There is not necessarily a unique FA that accepts a given language.

A

True

22
Q

Every language that can be accepted by an FA can be defined by a regular expression.

A

True

23
Q

When an input that has not been completely read reached a state (final or otherwise) that it cannot leave because there is no outgoing edge that it may follow. The input or the machine __________at that stage.

A

Crashes

24
Q

Every finite automaton is a transition graph. But not every TG satisfies the definition of an FA.

A

True

25
Q

Every language that can be defined by FA can also be defined by TG.

A

True

26
Q

Every language that can be defined by a TG may or may not be defined by RE.

A

False, if it’s defined by TG then it can also be defined by RE.

27
Q

In the case of r1+r2, the resultant final state will be only those where x and y both are final states.

A

False, it’s either-or.

28
Q

For the language defined by r*, the start state must be the final state.

A

True, cover the case for Λ.

29
Q

Every FA is also NFA.

A

True, FA is part of TG, and TG is part of NFA, and FA is part of NFA.

30
Q

Every TG is also NFA.

A

True

31
Q

In the Mealy machine, the output string has the same number of characters as the input string has letters.

A

True, a/0, b/1, …

32
Q

Moore machine and the mealy machine does not define a language by accepting and rejecting input.

A

True

33
Q

If L is a language over the alphabet S, the complement of L, written L’ is the language of all strings of letters from S that are words in L.

A

False, the complement of L, L’, is the language of all strings of letters from S that are NOT words in L. (Still contains letters from the same alphabet, just not the words in L)

34
Q

If there is an FA that accepts the language defined by r1 and an FA that accepts the language defined by r2, then there is an FA that accepts the language r1+r2.

A

True

35
Q

If there is an FA that accepts the language defined by r1 and an FA that accepts the language defined by r2, then there is an FA that accepts the language defined by their concatenation r1r2.

A

True

36
Q

If there is an FA that accepts the language defined by r, then there is an FA that accepts the language defined by r*.

A

True