Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSCI-2115 – Fall – 2021

Module 1 Quiz

1. Which of these statements best describes the formula: An : n > 0 ^ n < n2

(a) For all n, n is greater than 0 and n is less than n squared.

(b) For all n, n is greater than 0 or n is less than n squared.

(c) There exists n, n is greater than 0 and n is less than n squared.

(d) There exists n, n is greater than 0 or n is less than n squared.

2. Which of the following defines the set X of postive even integers?

(a)  {n e Z : n > 0} U {n e Z : n = 2m, m e Z}

(b)  {n e Z : n > 0} n {n e Z : n = 2m, m e Z}

(c)  {n e Z : n > 0}/{n e Z : n = 2m, m e Z}

(d)  {n e Z : n < 0} n {n e Z : n = 2m, m e Z}

3. Which of the following are solutions to the equation 42 + 96 = X(mod 13)?

I. 8

II. 13

III. 47

IV. 104

(a) I, II, and III

(b) I and III

(c) I, II, III, and IV

(d) II and IV

4. When formulating a proof by induction, what is the order of the proof?

I. State induction variable

II. Base cases

III. State induction hypothesis

IV. Induction step

(a) II, I, IV, III

(b) I, II, III, IV

(c) II, I, III, IV

(d) I, II, IV, III

5. Which of the following regular expressions specifies the language of all nonempty binary strings that have have exactly three 1s? E.g, 10101, 011100, 0100010010

(a)  (0*)1(0*)1(0*)1(0*)

(b) 0(1*)0(1*)0(1*)0

(c)  (0*)(1*)(0*)1*)(0*)(1*)(0*)

(d)  (0*)(∈|1)(0*)(∈|1)(0*)(∈|1)(0*)



6. Which of the following operations are used to construct regular expressions?

I. Alternation

II. Concatenation

III. Exclusion

IV. Repetition

(a) II, III, and IV

(b) I, III, and IV

(c) I, II, and IV

(d) I, II, and III

7. Which of the following characteristics are true for regular languages?

I. The language must be finite.

II. The language can be specified by a regular expression.

III. The language can recognized by a deterministic finite automaton.

IV. The language must contain e.

(a) I, II, and III

(b) I, III, and IIV

(c) II and III

(d) II, III, and IV

8. Which of the following conditions are necessary for a DFA to reject a string?

I. The DFA is not in a final state

II. The DFA is not in a start state

III. The DFA has read the entire string

IV. The DFA must perform at least one transition

I and II

I and III

(c) I, II and IV

(d) I, III and IV

9. What language does the following DFA recognize?

(a) All strings over the alphabet a, b that have three a’s

(b) All strings over the alphabet a, b that have four a’s

(c) All strings over the alphabet a, b that have no adjacent b’s

(d) All strings over the alphabet a, b that have three adjacent a’s


10. Consider the following implementation of a transition function for a DFA.

public  boolean  next(char  c)  {

switch   (state)  {

case  START:

if   (c  ==  ’X’)  {

state  =  STATE_1;

}

break;

case  STATE_1:

if   (c  ==  ’Y’)  {

state  =  STATE_2;

}

break;

case  STATE_2:

if   (c  ==  ’X’)  {

state  =  STATE_1;

}  else  {

state  =  START;

}

break;

}

return  isFinal();

}

What would be the state of the DFA after it had read the string XYXYY, assuming it started in the START state.

(a)  START

(b)  STATE 1

(c)  STATE 2

(d) Cannot be determined.

11.  [5 Marks]  Give a DFA that recognizes the language over the alphabet Σ = {x, y, z} of all words that comtain the substring xyz. For example, yxyz, and xyxzxyzxzy.