funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that...

20
FunTech A-Level Computing Exam Exercises – Finite State Automata Question 1 – Answer Sheet 1 (a) What type of Finite State Automata is this? DETERMINISTIC FINITE STATE AUTOMATA 1 (b) Construct a Non-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using 3 states: 1 (c) Complete the table, using N/A where an input has no following state: Stat S 0 S 0 S 1 S 1 Inpu 0 1 0 1 1 0 S 0 S5 S 1 0 1 1 S 0 S 1 1 0 S5 S 2 0,1

Transcript of funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that...

Page 1: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 1 – Answer Sheet

1 (a) What type of Finite State Automata is this?

DETERMINISTIC FINITE STATE AUTOMATA

1 (b) Construct a Non-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using 3 states:

1 (c) Complete the table, using N/A where an input has no following state:

State S0 S0 S1 S1

Input 0 1 0 1

Next S0 , S1 S0 N/A S2

1

11 0

S1S5S0

0

0,1

S2S5

0 1

S1S0

Page 2: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 2 – Answer Sheet

2 (a) What type of Finite State Automata is this?

NON-DETERMINISTIC FINITE STATE AUTOMATA

2 (b) Construct a Non-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, containing three consecutive 0s:

2 (c) Complete the table, using N/A where an input has no following state:

State S0 S0 S1 S1 S2 S2 S3 S3

Input 0 1 0 1 0 1 0 1

Next S0,S1 S0 S2 N/A S3 N/A S3 S3

2

0,1

S1S5S0

0

0,10

S2 S3S5

0 0

S1

0,1

S0

Page 3: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 3 – Answer Sheet

3 (a) (i) Given the maze below, design a Finite State Automata to navigate it:

Using inputs: Up, Down, Right, and Left

3 (a) (ii) What type of Finite State Automata is this?DETERMINISTIC FINITE STATE AUTOMATA

3 (b) Complete the table, using N/A where an input has no following state:State S0 S0 S0 S0 S1 S1 S1 S1 S2 S2 S2 S2

Input U D L R U D L R U D L R

Next N/A N/A N/A S1 N/A S4 S0 S2 N/A S5 S1 N/A

State S3 S3 S3 S3 S4 S4 S4 S4 S5 S5 S5 S5

Input U D L R U D L R U D L R

Next N/A N/A N/A S4 S1 N/A S3 N/A S2 N/A N/A N/A

3

Finish

Start

Down

Up

UpLeftLeft

DownRight

S2 S5S5

Right

S1S0

Page 4: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 4 – Answer Sheet

4 (a) What type of Finite State Automata is this?

DETERMINISTIC FINITE STATE AUTOMATA

4 (b) Construct a Deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, containing 0 followed by 1:

4 (b) Complete the table, using N/A where an input has no following state:State S0 S0 S1 S1 S2 S2

Input 0 1 0 1 0 1

Next S1 S0 S1 S2 S2 S2

4

S0S5

110

0

S1

0,101

S2S5

10

S1S0

Page 5: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 5 – Answer Sheet

5 (a) What type of Finite State Automata is this?

NON-DETERMINISTIC FINITE STATE AUTOMATA

5 (b) Construct a Deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, containing two consecutive 0s followed by two consecutive 1s:

5

f

S3S5

S2S5

b

a

d

e

a

b

S5

S4

S0S5

a

c

S1

Page 6: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

5 (c) Complete the table, using N/A where an input has no following state:

State S0 S0 S1 S1 S2 S2 S3 S3 S4 S4

Input 0 1 0 1 0 1 0 1 0 1

Next S1 S0 S2 S0 S2 S3 S1 S4 S4 S4

Question 6 – Answer Sheet

6 (a) What type of Finite State Automata is represented by this table?

State S0 S0 S1 S1 S2 S2 S3 S3

Input 0 1 0 1 0 1 0 1

Next S1 S3 S0 S2 S3 S1 S2 S0

DETERMINISTIC FINITE STATE AUTOMATA

6 (b) Construct the above Finite State Automata, where S0 is the only finishing state:

6

10

1

S3S2

0

1

00

S1S0

Page 7: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

7

11 11

0

0

S3 S2

S0S5

0

0

S1

Page 8: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

6 (c) (i) Construct a Deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, which do not contain three consecutive 0s:

6 (c) (ii) Complete the table, using N/A where an input has no following state:State S0 S0 S1 S1 S2 S2 S3 S3

Input 0 1 0 1 0 1 0 1

Next S1 S0 S2 S0 S3 S0 S3 S3

8

S2S5S1S5S0S5

1

1

0

S3

0,1

100

Page 9: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 7 – Answer Sheet

7 (a) (i) What type of Finite State Automata is represented by the Adjacency matrix?

S0 S1 S2 S3 S4

S0 0 b a 0 0

S1 0 0 0 c a,d

S2 0 0 0 c,e d,f

S3 0 0 0 0 0

S4 0 0 0 0 0

DETERMINISTIC FINITE STATE AUTOMATA

7 (a) (ii) Draw the Finite State Automata described by the Adjacency matrix above, depicting no edges where a 0 is represented:

9

d

a

c

f

S3S5

S2S5

bd

eS4

S0S5

a

c

S1

Page 10: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

7 (b) Construct a Deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, containing even numbers of 0s and any number of 1s:

7 (c) Complete the table, using N/A where an input has no following state:

State S0 S0 S1 S1

Input 0 1 0 1

Next S1 S0 S0 S1

10

S0S5

110

0

S1

Page 11: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 8 – Answer Sheet

8 (a) (i) What type of Finite State Automata is represented by the Adjacency matrix?

S0 S1 S2 S3 S4 S5

S0 0 a a 0 0 b

S1 0 0 0 c d 0

S2 0 0 0 e f 0

S3 0 0 0 0 0 0

S4 0 0 0 0 0 0

S5 0 b 0 0 a 0

NON-DETERMINISTIC FINITE STATE AUTOMATA

8 (a) (ii) Draw the Finite State Automata described by the Adjacency matrix above, depicting no edges where a 0 is represented:

11

f

S3S5

S2S5

b

a

d

e

a

b

S5

S4

S0S5

a

c

S1

Page 12: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 9 – Answer Sheet

9 (a) (i) What type of Finite State Automata is represented by the Adjacency matrix?

S0 S1 S2 S3

S0 a b 0 b

S1 0 a a b

S2 0 0 0 b

S3 0 b 0 a

NON-DETERMINISTIC FINITE STATE AUTOMATA

9 (a) (ii) Draw the Finite State Automata described by the Adjacency matrix above, depicting no edges where a 0 is represented:

12

b

b

b

b

b

S3

S0S5

aa

a

S2S5

S1

a

Page 13: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

9 (b) Using the Finite State Automata you have drawn, decide whether the following inputs are Accepted or Rejected:

9 (b) (i) baabaACCEPTED

9 (b) (ii) ababaACCEPTED

9 (b) (iii) bbabbREJECTED

9 (b) (iv) bbaaaACCEPTED

9 (b) (v) bbbbaACCEPTED

13

Page 14: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 10 – Answer Sheet

10 (a) (i) What type of Finite State Automata is represented by the Adjacency matrix?

State S0 S0 S1 S1 S2 S2 S3 S3

Input 0 1 0 1 0 1 0 1

Next S0 S1 S1 S2 S2 S3 S3 S3

DETERMINISTIC FINITE STATE AUTOMATA

10 (a) (ii) Draw the Finite State Automata described by the Adjacency matrix above, depicting no edges where a 0 is represented:

14

0 0 0 0,1

11

S2 S3S5S0

1

S1

Page 15: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

10 (b) Using the Finite State Automata you have drawn, decide whether the following inputs are Accepted or Rejected:

10 (b) (i) 01010000REJECTED

10 (b) (ii) 01001110ACCEPTED

10 (b) (iii) 0111ACCEPTED

10 (b) (iv) 110000REJECTED

15

Page 16: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

Question 11 – Answer Sheet

11 (a) (i) What type of Finite State Automata is represented by the Adjacency matrix?

State S0 S0 S1 S1 S2 S2 S3 S3

Input 0 1 0 1 0 1 0 1

Next S0 S1 S0 S2 S0 S3 S3 S3

DETERMINISTIC FINITE STATE AUTOMATA

11 (a) (ii) Draw the Finite State Automata described by the Adjacency matrix above, depicting no edges where a 0 is represented:

16

0

0

00,1

11

S2 S3S5S0

1

S1

Page 17: funtechacademies.co.uk A Level/00... · Web viewNon-deterministic Finite State Automata that accepts all binary strings consisting of 1s and 0s, as long as they terminate in 01, using

FunTech A-Level Computing Exam Exercises – Finite State Automata

11 (b) Using the Finite State Automata you have drawn, decide whether the following inputs are Accepted or Rejected:

11 (b) (i) 0000110011001100REJECTED

11 (b) (ii) 0001110000000000ACCEPTED

11 (b) (iii) 1010101010000000REJECTED

11 (b) (iv) 11111111ACCEPTED

17