4.4 Theory of Computation Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a set in the context of regex

A

an unordered collection of values in which each value occurs at most once.

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

A language is regular if it can be represented by

A
  1. A regular expression
  2. A Finite State Machine
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If there is no symbol between symbols what does that mean

A

Members side by side must appear in that sequence

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

What does the pipe symbol mean|

A

Separates alternative options

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

What does the symbol * mean in context of regex

A

Indicates that there are zero or more of the preceding element

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

What does the symbol + mean in the context of regex

A

Indicates that there is one or more of the preceding elements

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

What does the symbol ? mean in the context of regex

A

Indicates that there are zero or one of the preceding element.

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

What does () symbol mean in the context of regex

A

Used to identify groupings

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

An 01 pair repeated any number of times

How is it represented in regex

A

(01)*

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

In the context of set comprehension

A = { x | x ∈ N ^ x != 0 }

define the variables

A

A represents the set

{}: This denotes a set. Sets are collections of distinct elements.

x: A variable that represents the elements of the set.

∣: The vertical bar is read as “such that” or “where”. separates the variable from the condition that the elements must satisfy.

natural numbers (N)

∈ = “is an element of”

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

What is a turing machine

A

A computer with a single fixed program expressed using:

A finite set of states in a state transition diagram.
A finite alphabet of symbols.
An infinite tape with marked off squares.
A sensing read-write head that can travel along the tape, one square at a time.

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

A⊆B

A

A is a subset of B

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

A⊂B

A

A is a proper subset of B

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

Difference between subset and proper subset

A

A is a proper subset of B if every element in A is also in B, but B has at least one extra element not in A

A normal subset does’nt have to satisfy this last condition.

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

What is the cartesian product

A

The cartesian product of two sets A and B is the set of all ordered pairs (a,b)

Let’s say A = {1, 2} and B = {x, y}.

The Cartesian product of A and B would be {(1, x), (1, y), (2, x), (2, y)}.

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

What is cardinality and what is denoted by

A

Cardinality- It represents the count of distinct elements within a set.

|A|

17
Q

In any one transition the turing machine can: (3)

A

Read the symbol on the tape.

Erase or write a new symbol on the tape.

Move the head left or right by a single machine.

18
Q

What is Backus Nuar Form

What is a meta language

A

a formal notation used to describe the syntax rules of a language unambiguosly

A language that describes a language

19
Q

Why does Backus Nuar form exist when there are RNF (2)

A

Because not every language or pattern can be represented as a regular expression

meta-languages such as BNF have been devised

20
Q

In the context of BNF what does this symbol mean ::=

A

Is defined as

21
Q

In the context of BNF what does this symbol mean |

A

Or

22
Q

In the context of BNF what does this symbol mean <>

A

Surrounds category names

23
Q

In the context of BNF what does it mean items are ( Side by side )

A

they should appear consecutively or in sequence.

24
Q

In the context of BNF what are terminal symbols

A

basic symbols or literals that appear in the language being defined.

They cannot be broken further down.

25
Q

What are the two ways of representing context free languages

A

Syntax diagrams

BNF

26
Q

What are syntax diagrams

A

graphical equivalent of BNF

27
Q

In the context of syntax diagrams what does a rectangle represent

A

a non terminal symbol, which will be defined in another syntax diagram.

28
Q

In the context of syntax diagrams what does an ellipses represent

A

a terminal symbol, cannot be further broken down

29
Q

What is a finite state machine (1)

A

An abstract machine that can be in any one of a finite number of states

30
Q

What are the characteristics of a finite state machine (FSM) (3)

A
  1. Can only be in one state at time.
  2. can change from one state to another in response to an event, known as a transition
  3. Defined by a list of its states and the conditions for each transition
31
Q

What is a finite state automaton (2)

A
  1. An FSM which has no output is known as a finite state automaton
  2. It has a set sequence for the final state
32
Q

What is a mealy machine

A
  1. A type of FSM
  2. generates an output on each state transition
  3. The output is determined by its current state and its current input.
33
Q

What is the notation used for mealy machine

A

input/output = 0/1

34
Q

Functions of a mealy machine

A
  1. Can be used to map an input sequence to an output sequence.
  2. And it is used in language parsing (language analysis)
  3. Can be used to translate from one language to another.
35
Q

In order for source code of a given language to be translated into machine code:

A

All the rules of a given language must be defined totally ambiguosly

36
Q

What does BNF consist of (3)

A

A set of terminal symbols
A set of non-terminal symbols
A set of production rules

37
Q

what is the BNF representation for digits

A

<digit> ::= 0|1|2|3|4|5|6|7|8|9
</digit>

38
Q

If letter has been defined as:

<LETTER> ::= A|B|C|D...etc

How do we define a two letter word
</LETTER>

A

WORD ::= LETTER >LETTER>

39
Q

What are the applications of regular expressions (3)

A

Searching and locating files and folders

Find or search and replace text strings in a block of text

Searching for identifiers in a computer program