You are on page 1of 8

PRACTICE TEST

Chapter 14: Finite Automata and Languages

INSTRUCTIONS: Answer each question below. Once you finish taking the test, check
the answers provided in the Answer Key at the end of this test.

1. If u = abc and v = cda then the concatenation of u and v is


A: cdaabc
B: abcda
C: abccda
D: none of the above

For exercises 2 through 8, Let M be the DFA given by Q = {q0, q1, q2}, = {0, 1}, q0 is
the initial state, F = { q2}, and  is given by

2. What state is M in after processing the string 111?


A: q0
B: q1
C: q2
D: none of the above

3. What state is M in after processing the string 1100?


A: q0
B: q1
C: q2
D: none of the above

4. What state is M in after processing the string un, where u = 101?


A: q0
B: q1

©2010 Cengage Learning Asia Pte Ltd


C: q2
D: none of the above

5. Is the string w = 111 accepted by M?


A: yes, since * (q0, w)  F
B: yes, since * (q0, w) = q1
C: No, since * (q0, w)  F
D: none of the above

6. Is the string w = 1100 accepted by M?


A: yes, since * (q0, w)  F
B: yes, since * (q0, w) = q1
C: yes, since * (q0, w)  F
D: none of the above

7. Is the string un, where u = 101 accepted by M?


A: yes, since * (q0, w)  F
B: yes, since * (q0, w) = q1
C: no, since * (q0, w)  F
D: none of the above

8. Describe the inputs that M will accept.


A: any string that ends in 01
B: any string that ends in 10
C: any string that ends in 11
D: none of the above

9. Let A = {w | w  {0, 1}* , w has finite length, and w ends in 110}. Is A a regular
language?
A: yes, since L(M) = A
B: no, since L(M) 
C: cannot be determined
D: none of the above
10. Let M be a DFA with n states. If L(M) , then there is string w in L(M) such
that the length of w is

©2010 Cengage Learning Asia Pte Ltd


A: less than n
B: greater than n
C: equal to n
D: none of the above

11. Let M be a DFA with n states. If L(M) is infinite then there is a string w in L(M)
such that the length of w, |w|, is
A: n  |w| < 2n
B: n < |w| < 2n
C: n < |w|  2n
D: none of the above

12. If L and M are two regular languages on , then


A: L  M is a regular language
B: L  M is a regular language
C: both a and b
D: none of the above

13. Let M be the NDFA (Q,  , q0,  , F) and w  *. Then w is accepted by M
provided
A: * (q0, w)  F = 
B: F * (q0, w)
C: * (q0, w)  F  
D: none of the above

14. Let M be the NDFA (Q,  , q0,  , F), in the corresponding DFA Md = (Qd,  , q0d,
d , Fd) what is Qd equal to?
A: Q
B: F
C: the power set of Q
D: none of the above

15. Let M be the NDFA (Q,  , q0,  , F), in the corresponding DFA Md = (Qd,  , q0d,
d, Fd) what is Fd equal to?

©2010 Cengage Learning Asia Pte Ltd


A: {A  Qd | A  F =  }
B: {A  Qd |A  F  }
C: the power set of Q
D: none of the above

16. Let M be the NDFA (Q,  , q0,  , F), let the corresponding DFA Md = (Qd,  ,
q0d, d, Fd) then
A: L(Md)  L(M)
B: L(Md) = L(M)
C: L(M)  L(Md)
D: none of the above

17. If L is a language accepted by an NDFA, then


A: L is regular
B: L is not regular
C: L may or may not be regular
D: none of the above

For exercises 18 through 21, Let M be the FSM given by M = (Q, , , q0, , ),
where Q = {q0, q1, q2},  = = {0,1}, and  and  are given below

18. If the input string is 1010 then the output string is


A: 0010
B: 1101
C: 0001
D: none of the above

19. If the input string is 00110101 then the output string is


A: 11111010

©2010 Cengage Learning Asia Pte Ltd


B: 00000101
C: 00000111
D: none of the above

20. Does M accept the string 1010? Explain


A: yes, output is 1
B: yes, output is 0
C: no, output is 0
D: none of the above

21. Does M accept the string 00110101? Explain


A: yes, output is 1
B: yes, output is 0
C: no, output is 0
D: none of the above

22. Is every regular language a context-free language?


A: yes
B: no
C: cannot be determined
D: none of the above

23. Is every context free language a regular language?


A: yes
B: no
C: cannot be determined
D: none of the above

For exercises 24 through 30, Let M be the DFA whose transition diagram is

©2010 Cengage Learning Asia Pte Ltd


24. What are the states of M?
A: {q0, q1, q2}
B: {0, 1}
C: cannot be determined
D: none of the above

25. What are the input symbols of M?


A: {q0, q1, q2}
B: {0, 1}
C: cannot be determined
D: none of the above

26. What is the initial state of M?


A: q0
B: q1
C: q2
D: none of the above

27. What is (q1, 1) equal to?


A: q0
B: q1
C: q2
D: none of the above

28. What can a string end in and be accepted by M?

©2010 Cengage Learning Asia Pte Ltd


A: 01
B: 11
C: 10
D: none of the above

29. What can a string end in and not be accepted by M?


A: 00
B: 11
C: 10
D: none of the above

30. What is the language accepted by M?


A: all strings that end in 00
B: all strings that end in 11
C: all strings that end in 10
D: none of the above

©2010 Cengage Learning Asia Pte Ltd


Answers:

1. C 2. B 3. C 4. A 5. C 6. A 7. C 8. D 9. A 10. A
11. A 12. C 13. C 14. C 15. D 16. B 17. A 18. A 19. B 20. C
21. A 22. A 23. B 24. A 25. B 26. A 27. C 28. A 29. D 30. D

©2010 Cengage Learning Asia Pte Ltd

You might also like