Topics 1-3 Flashcards

1
Q

What’s a high-level language?

A

Designed for humans, easier to learn/use.Incl. libraries of pre-built automations (‘functions’). E.g. Python, Java, C++.
Must be translated into machine language for CPU to understand.

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

What’s a low level language?

A

Close to what computer speaks, difficult for humans to read. Include assembly languages & machine code.

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

What is an Interpreter?

A

Translates high-level language into machine code one instruction at a time, immediately executes that instruction, then moves to the next & repeats.
No intermediate Program is saved.

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

What is a Compiler?

A

Translates complete high-level program into machine language program. Complete translation before execution. Result can be executed repeatedly without further translation.

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

5 steps in the Program Development Cycle?

A
  1. Design the program
  2. Write the code
  3. Correct syntax errors
  4. Test the program
  5. Correct logic errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Explain 2 ways to design/visualise a program:

A

Using Pseudocode (describing steps in plain speech as though to a person).
With a Flowchart diagram.

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

What is Pseudocode?

A

Pseudocode is a model computer program written in informal language that has no syntax rule

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

What 3 step process does a computer program usually follow?

A

Input | processing | output
Input: data received by program while running.
Processing: Perform operation on input (e.g. mathematical calculation).
Output: Produce desired information/response.

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

Instruct python to produce an output using the ____ function.

A

print(desired output)

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

How can I explain what’s going on in my code?

A

Comments are identified with a leading hash character. Python ignores everything to right of this on the line. Used to explain & identify components of the program for yourself & future users

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

Why use comments?

A

Comments (Python; indicated by leading hash character) are ignored by translator program; meant for humans. Offer explanation of parts of the program, enabling easier understanding, editing etc. For others and yourself, when you come back later.

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

How can I enter multi-line comments?

A

’’ Triple quotation marks:’’’
“”” These are used often to document the code; e.g. right at the top of a program describing functions, inputs & outputs”””

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

What’s a variable?

A

A value stored in the computers memory; that the program can store, update & retrieve.

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

variable = data… what is the equals sign here?

A

The assigment operator. It creates and/or updates the variable, named/addressed with vaue to its left, and assigning it the value to its right.

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

Python has strict variable naming rules:

A

Variable names:
- cannot be a Python keyword
- cannot contain spaces (use underscores for variable_name)
- first character must be a letter or an underscore
- otherwise contain only letters, digits, or underscores
- are case sensitive.

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

What variable data types have we learned?

A

int – for positive and negative integer numbers.
float – for positive and negative real numbers.
str – for character strings.
bool - boolean yes/no value

17
Q

How does the interpreter assign data type for a numeric literal? (A number written in the program.)

A

Presence of a decimal point. ‘2.0’ = float. ‘2’ = integer.

18
Q

Will this work?
….
if statement
print(‘string’)

A

No! Missing the colon after the if statement.
If statement:

19
Q

Are these variables different?
number_input
Number_input

A

Yes, variable names are case sensitive.

20
Q

What’s special about this variable?
NUMBER_INPUT

A

by convention, variables in all caps are ‘constants’; unchanged during program run. Reduces possible errors - enter value only once.
May be changed before running (e.g. reserve bank interest rate, needs updating in code when changed).

21
Q

Shape meaning in flowchart:
Rectangle?

A

Process - an instruction to be carried out by the program.

22
Q

Shape meaning in flowchart:
Parallelogram?

A

Input/output - represents entry by user or display of data by the program.

23
Q

Shape meaning in flowchart:
Diamond?

A

Selection/Decision structure (if condition, then action…)`

24
Q

Shape meaning in flowchart:
Oval?

A

Terminal - indicates start and end of a program.

25
Q

What’s the difference between Iterations, Repetitions & Loops?

A

None. All interchangeable terms for ‘circular’ structures used to handle repetitive tasks in programs.

26
Q

What do passwords have to do with loops?

A

Password entry is a data validation loop. While input != password, keep looping through ‘sorry, that wasn’t correct, try again’.