Computer Languages and Representations Flashcards

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

What is a factor of the Software crisis and when did the Software crisis begin?

A

Began - 1960s

High cost of producing software - software costs have been rising as hardware costs have been falling

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

How are Programs represented and Computation implemented in:

  1. Functional Programming
  2. Logic Programming
  3. Finite State Machines
A
  1. Programs are represented by expressions
    Computation is represented by reduction
  2. Programs are represented by clauses
    Computation is represented by proof
  3. Programs are represented by state machines
    Computation is represented by transitions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the foundations in Functional and Logic programming?

A

Functional Programming - lambda calculus

Logic Programming - first-order logic

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

Define a Function

A

A function transforms information recieved by inputs to information transmitted by output.

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

What are arguments and results in functions?

A

Argument = Inputs
Results = Outputs

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

What is a must for an equation to apply?

A

Argument must match the pattern for an equation

(Any argument matches a variable pattern)

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

What is a Pattern?

A

A pattern may describe the structure of the argument and name its components

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

What is a Guard?

A

A guard is a Boolean expression that must be true for the equation to apply.

(Guards often work with patterns)

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

Define “otherwise”

A

A special final guard that is always true.

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

How are functions used in programming?

A

The function f to an argument x is written as f x.

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

What is a Type?

A

Set of values with the same usage and behaviour.

(All of the values in one of these sets are the same kind of thing such as an integer)

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

What is a Type System?

A

The fundamental purpose of a type system is to prevent errors during the execution of the programs, by ensuring types match correctly.

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

What is Type Checking?

A

Ensures types are used consistently, and that these errors are avoided.

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

Define Static Type Checking

A

Happens before program execution

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

Define Dynamic Type Checking

A

Happens during program execution

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

What is a negative of Local Defintions?

A

Having all function at the top level of a script can lead to name space pollution - clashes caused by reuse of the same name.

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

What is a Where Definition?

A

A where definition allows one to name a value, and to use it in an expression.

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

What is a Let Definition?

A

A let definition allows one to name a value, and to use it in an expression.

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

What are the steps for Polya’s heuristic strategies?

A
  1. Understand the problem
  2. Devise a plan
  3. Carry out the plan
  4. Look back and reflect
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Explain Understanding the problem in Polya’s heuristic strategies.

A

Involves careful study. May seem obvious, but failure to understand the problem often explains a failure to solve it.

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

Explain Devising a plan in Polya’s heuristic strategies.

A

Involves identifying calclulations, computations or constructions that may be performed in order to obtain the solution

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

What are 3 key questions when Devising a plan?

A
  • Did you use all the data?
  • Did you use the whole condition?
  • Could you use a related problem, solved before?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Explain Carrying out the plan in Polya’s heuristic strategies.

A

Involves performing the steps in sequence to give the solution.

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

What are 2 key questions when Carrying out the plan?

A
  • Can you see each step is correct?
  • Can you prove each step is correct?
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Explain Reflecting in Polya’s heuristic strategies.

A

Taking time to consider what worked and what didn’t. The insights gained may make it easier to find solutions to future problems

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

What are 3 key questions when Reflecting?

A
  • Can you check the result?
  • Can you check the argument?
  • Can you use the result/method for some other problem?
27
Q

What is a design pattern?

A

It captures the idea of a good solution to a common design problem

They can make novices look like experts.

28
Q

What is the Generate-and-select design pattern?

A

Generator construct a large number of values that might be solutions to a problem.

Selector filters out those values that are solutions to the problem.

29
Q

What is the productivity paradox?

A

You can see computer age everywhere but in the productivity statistics

30
Q

What are the three explanations of the productivity paradox?

A
  1. Uneven/concentrated gains
  2. Implementation lags
  3. Mismeasurement
31
Q

Explain Uneven/concentrated gains in relation to the productivity paradox.

A

The gains are in few productive firms and sectors with limited weight in the overall economy.

32
Q

Explain Implementation lags in relation to the productivity paradox.

A

It takes considerable time for a new technologies to achieve critical mass, or for necessary complementary ones to appear.

33
Q

Explain Mismeasurements in relation to the productivity paradox.

A

Adopting new technologies can lead workers to move on from more productive adopting sectors to less productive ones, and so to negligible aggregate productivity growth.

34
Q

How do Artificial Neural Networks (ANNs) work behind the scenes?

A
  1. The core ANN is trained on text from the Internet to respond to a prompt with a list of most probable next words after the prompt
  2. The core ANN is tweaked by scoring its responses to sample queries. A second NN is trained on these scores to predict the most likely one to be assigned to a prompt.
  3. The second ANN is used in reinforcement learning to adjust the weights iin the core ANN so that its outputs are even most likely to satisfy humans
  4. Sometimes, data from user responses to LLM responses is fed back to fine-tune for still better results
35
Q

What are the concerns when using the large language models?

A
  1. Copyright
  2. Education
  3. Code quality
  4. Code security
  5. Not an expert
36
Q

What is the Education concern when using large language models?

A

Good solutions to many assignments can be completed directly, reducing their challenge and worth

37
Q

What is the Code quality concern when using large language models?

A

No guarantee of code quality when using a large language model, and a code review will need to be conducted before code is deployed.

38
Q

What is the Code security concern when using large language models?

A

No guarantee of code security when using a large language, and a security audit will need to be conducted before code is deployed

39
Q

What is the information concern when using large lanuage models?

A

It is not an expert - doesn’t know and will confabulate if necessary, mixing high-quality text with low quality rubbish

40
Q

Define List Processing

A

Is naturally recursive. The result of a computation on a list is often most easily described in terms of its head and a recursive computation on its tail, until a base case list is reached

41
Q

Define the Head of a list

A

First item of list

42
Q

Define the Tail of a list

A

The rest of the items (not including the first)

43
Q

What is a List Comprehension?

A

Items generated from one list are transformed or tested to give items of another

44
Q

What is a Conditional Expression?

A

A conditional expression evaluates to one expression or the other, depending on the value of a Boolean expression

45
Q

What is a Case Expression?

A

A case expression evaluates to the expression for a given case
- A case expression may have a base case

46
Q

What is nub used for in Haskell?

A

Removes duplicate elements from a list.
- Only keeps the first occurrence of each element, preserving the order.

47
Q

What is Lit used for in Haskell?

A

Refers to literals which represent basic constant values like numbers, characters or strings

48
Q

Why is Code Copying bad?

A

Error-prone
- Errors must be fixed in every copy

Inefficient
- Space must be allocated for each copy

49
Q

What are the 5 types of Data Objects?

A
  1. Numbers
  2. Atoms
  3. Variables
  4. Compound terms
  5. Lists
50
Q

Define a Number

A

Either an integer or floating point

51
Q

Define an Atom

A

A constant that does not have a numerical value. It begins with a lowercase letter, or its quoted

52
Q

Define a Variable

A

A variable stands for a term that is to be determined. It begins with an uppercase letter or underscore

53
Q

Define a Compound Term

A

Consists of a functor followed by a sequence argument terms in brackets

54
Q

Define a List

A

made up of elements (possibly of different type) enclosed in square brackets and separated by commas

55
Q

What does the rule mean:

                                              h :- t1, t2, ... tk.
A

Has a declarative reading: h is true if t1, t2, … tk are all true

Has a procedural reading: to compute h compute t1, t2, … tk

56
Q

How does a logic programming language work?

A

Will generate one permutation at a time, on demand from the tester, backtracking to consider further permutations.

57
Q

How does an Sum predicate work?

A

The sum predicate adds up the items in a list

58
Q

How does a Member predicate work?

A

The member predicate is true when an element is a member of a list

59
Q

How does an Append predicate work?

A

An append predicate appends two lists

60
Q

How does a Reverse predicate?

A

A reverse predicate reverses a list

61
Q

How does Next row computations work?

A

A next row may be computed from the current one by adding adjacent integers

62
Q

How do Funnel Computations work?

A

The result of a funnel computation with a top row of numbers is recursively that of a funnel computation with a next row of numbers, until a row with just one number is reached, and the result is that number.

63
Q
A