4.4 (every spec covered) Flashcards

(84 cards)

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

What does a.e mean in regex

A

Matches any word that starts with a and ends with e

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

what does ^Hello mean

A

Matches any line that starts with Hello

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

What are regular expressions

A

Special sequences of characters that can be used to find or match patterns in text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
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
8
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
9
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
10
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
11
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
12
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
13
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
14
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
15
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
16
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
17
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
18
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
19
Q

What is cardinality and what is denoted by

A

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

|A|

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
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

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

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

A

Is defined as

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

In the context of BNF what does this symbol mean |

A

Or

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
In the context of BNF what does this symbol mean <>
Surrounds category names
26
In the context of BNF what does it mean items are ( Side by side )
they should appear consecutively or in sequence.
27
In the context of BNF what are terminal symbols
basic symbols or literals that appear in the language being defined. They cannot be broken further down.
28
What are the two ways of representing context free languages
Syntax diagrams BNF
29
What are syntax diagrams
graphical equivalent of BNF
30
In the context of syntax diagrams what does a rectangle represent
a non terminal symbol, which will be defined in another syntax diagram.
31
In the context of syntax diagrams what does an ellipses represent
a terminal symbol, cannot be further broken down
32
What is a finite state machine (1)
An abstract machine that can be in any one of a finite number of states Also a computational model used to represent execution flow
33
What are the characteristics of a finite state machine (FSM) (4)
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 4. has one or more final states
34
What is a finite state automaton (2)
1. An FSM which has no output is known as a finite state automaton 2. It has a set sequence for the final state
35
What is a mealy machine
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.
36
What is the notation used for mealy machine
input/output = 0/1
37
Functions of a mealy machine
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.
38
In order for source code of a given language to be translated into machine code:
All the rules of a given language must be defined totally ambiguosly
39
What does BNF consist of (3)
A set of terminal symbols A set of non-terminal symbols A set of production rules
40
what is the BNF representation for digits
::= 0|1|2|3|4|5|6|7|8|9
41
If letter has been defined as: ::= A|B|C|D...etc How do we define a two letter word
WORD ::=
42
What are the applications of regular expressions (3)
Searching and locating files and folders Find or search and replace text strings in a block of text Input validation
43
What is procedural abstraction
Procedural abstraction is a programming concept that involves breaking down complex tasks into smaller, reusable procedures
44
What is functional abstraction
Same as procedural abstraction, but whilst ignoring the internal computation and simply outputting the result
45
What is data abstraction
hiding the implementation details of data structures and exposing only the essential features
46
What is problem abstraction
Removing details from a problem until you can represent it in a way that it is possible to solve, as you reduce it to one that has already been solved.
47
What is composition abstraction
Combining of appropriate procedures to form compound procedures
48
What is automation
creating algoritihms implementing said algorithims in program code in order to solve problems
49
What is a finite state machine in logical terms
A model of computation used to design computer programs
50
What does the set of values denoted by N represent
Infinite set of natural number
51
What does the set of values denoted by Z represent
Set of all integers
52
What does the set of values denoted by Q represent
Set of all rational numbers
53
What does the set of values by R represent
Set of all real numbers
54
What is meant by an infinite set
A set that has no end value represented by ... at the end of the set
55
What does it mean if a set is countable
A set that can be counted off against a subset of the natural numbers
56
What is a subset
When every member of set is A is also a member of Set B this is a subset
57
What is a proper subset
If every member of A is in B, but b has additional values not in A, therefore A and B are not equal, The A is a proper subset of B
58
What does A/B mean in regex
Everything that is in set A but not in set B
59
Which symbol represents "is an element of"
60
What is parsing
Parsing is the process of analysing a sequence of symbols (such as text or code) to determine its grammatical structure based on a given set of rules (syntax)
61
What is parsing in the context of BNF
Working out if a statement is valid according to BNF production rules
62
What is meant by time complexity
How much time an algoritihm needs to solve a given problem
63
What is meant by space complexity
The amount of memory an algorithim requires to solve a given problem
64
What is meant by the permutation of a set of objects
The number of ways you can arrange those objects
65
what is meant by the domain, range and codomain of a function
Domain is All the possible inputs of a function Codomain is what the function could output (defined by the function). Range is what the function actually outputs.
66
What is meant by O(n) linear complexity
An algorithm whose performance is proportional to the size of the data set, where performance declines as the data set grows
67
What is meant by O(logn) linear complexity
An algorithm that halves the data set in each pass, making it efficient for large data sets
68
What is meant by the halting problem
Is it possible to write a program that given a description of another program and its inputs without executing the program, whether the given problem will halt. The answer is that there isn't
69
What is the universal turing machine
a single machine that can be used to compute any computable sequence. special type of Turing machine that can simulate any other Turing machine
70
what is information hiding
Hiding details not contributing to essential characteristics
71
what is representational abstraction
removing unnecessary details
72
what is abstraction by generalisation
Abstraction by generalisation is grouping by common characteristics.
73
what is a regular language
A set of strings that can be define by either: a regular expression or a finite state machine
74
What does (A\B) return
returns the elements in A but not in B
75
what is the link between regex and fsm
every regular expression has an equivalent finite state machine.
76
what does O(1) notation mean
Efficiency of algorithm is independent of input size
77
what are tractable problems
Problems that can be solved in polynomial time or less
78
What are intractable problems
No known polynomial time solution, heuristics are required to get an approximate solution
79
what are heuristic methods
methods that give approximate solutions to intractable problems
80
what does it mean if a problem is computable
A problem is computable if there exists an an algorithm that can solve it for all valid inputs
81
what does it mean if a problem is non-computable
No algorithim exists that can solve the problem in all cases eg. the halting problem
82
What are the ways to think about solving a problem
simulation, enumeration - list all cases trial and error, decrease and conquer
83
what is the concept of abstraction
The concept of abstraction is to reduce problems to their essential features
84