Lecture 1 Flashcards

1
Q

Why give names to values in expressions?

A
  1. Reuse names instead of values (imagine having to repeat a flot with 12 digits every time I want to re-use it)
  2. Make code easier to read and modify
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How are expressions evaluated in Python?

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

What are the values of meters and feet variables after each line is executed?
~~~
meters = 100
feet = 3.2808 * meters
meters = 200
~~~

A
  1. meters = 100 and feets does not exist
  2. meters = 100 and feet = 328.08
  3. meters = 200 and feet = 328.08

Note that feets is not update after meters has been changed on 3rd l

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

What is the definition of an algorithm?

A

It is a finite list of instructions
describing a set of computations that when executed on a set of
inputs will proceed through a sequence of well-defined states and
eventually produce an output.

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

What is the definition of flow of control?

A

It is the order in which the instructions from an imperative program is executed.

By default, instructions are executed one after another,** starting from the top. However, we can change this by using, flow control statements (e.g. if statements).

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

Explain primitives

A

Primitives are the building blocks, like atoms, of a programming language.

The primitive constructs in Python include literals (e.g., the number 3.2 and the string ‘abc’) and infix operators (e.g., + and /).

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

Explain syntax

A

Syntax determines when the combination of primitives is legal. See examples below in Python

3.2 + 3.2 - syntatically valid
3.2 3.2 - not syntatically valid

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

Explain static semantics

A

Statics semantics determines that syntatically correct code is meaningful.

3.2 + 'hello world' is syntatically correct but fails in terms of static semantics

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

Explain semantics

A

Semantics is the meaning of code that is both syntatically correct and has proper statics semantics.

Code can only be interpreted in one way by computers.

It can happen that the programmer was not able to convey the desired meaning to the code he/she created, and execution of program by the computer does not yield the expected outcome.

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

What is the Church-Turing thesis?

A

Is the thesis that if a problem is computable, then a Turing Machine can compute it.

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

What is the concept of Turing completeness?

A

Whenever a proposed programming language is able to simulate a Turing Machine, this language is said to be Turing complete.

The interest part is solution in one Turing-complete programming language can be converted to another as long as the latter is also Turing complete.

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

What is a flowchart?

A

It is a visual representation of the flow of control from an imperative program.

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

What is source code?

A

It is the code written by the programmer as the programmer was the source for the code written.

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

What is the difference between interpreted and compiled programming languages?

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

What is the difference between low-level versus high-level programming languages?

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

What is the difference between general versus targeted to an application domainprogramming languages?

A