U1T1 - Programming Flashcards

1
Q

What is a computer program?

A

A specific set of ordered
instructions to be performed by a computer.
The program represents a solution to a problem.

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

What does a computer require to function?

A

Programs.

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

Where are program instructions executed?

A

In the CPU.

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

What is an IDE?

A

Integrated Development Environment. Combines a text editor with program-running functionality. Often includes features like debugging and text completion.

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

What is debugging?

A

Detecting, locating and correcting bugs (mistakes)., usually by running program. Run program using test data to fully test every part of program.

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

What is a bug?

A

Logic errors such as telling computer to repeat an operation but not how to stop repeating.

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

What is text completion?

A

Like predicted tense on phones. A.K.A. Intellisense.

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

Why do we need the translation process?

A

Computer system only understands machine code. i.e. program in python can’t be run directly, it must be translated. Source code is translated. It becomes object code which is understood.

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

What does the translator in the translation process do?

A

Checks program syntax, giving diagnostics. Translates program into object code.

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

What are diagnostics?

A

Syntax-error messages.

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

What are the 3 main types of translators?

A

Assemblers, Compilers and Interpreters.

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

What is an assembler?

A

Converts assembly language mnemonics into machine code.

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

What does an interpreter do?

A

Converts each instruction of source code into object code as program is run. Better interactive environment, but slower. Program is translated each time it’s executed.

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

What does a compiler do?

A

Converts entire source code into machine code so it can be run without further translation. Error correction is tedious.

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

What are the 3 main errors in programming?

A

Syntax, runtime and logical.

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

What is a syntax error?

A

Code doesn’t follow rules of programming language. e.g. Missed bracket, no speech marks, spelling error.

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

What is a runtime error?

A

When program runs, error occur. e.g. trying to divide a number by o or open a nonexistent file.

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

What is a logical error?

A

Program runs but gives unexpected results. e.g. mathematical operators used incorrectly < rather than >, no brackets around a calculation.

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

What is an algorithm?

A

A recipe that describes the exact steps needed for the computer to solve a problem or reach a goal.

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

What is pseudocode?

A

A set of specific instructions which are very similar to computer code, but not specific to any one computer. Must write start and end.

21
Q

What is a flowchart used for?

A

Clearly identify steps in a process that is to be programmed.

22
Q

What is syntax?

A

Set of rules on how to use and organise statements in a programming language.

23
Q
What are the commands used to do these functions in python?:
Multiplication
Remainder
Exponent
Whole Number Division
A

*
%
**
//

24
Q

What is the order of operation in programming?

A

BIDMAS - Brackets, Indices, Division, Multiplication, Addition, Subtraction.

25
Q

What are variables?

A

Reserved memory locations to store values.

26
Q

What happens when you create a variable?

A

You reserve some space in memory.

27
Q

Where must the data used in a program be stored whilst it’s running?

A

In main memory.

28
Q

What do we use for variables so we can refer to them in memory?

A

Names

29
Q

What does the name of a variable refer to?
What does each variable have and what does this determine?
What is necessary when we assign a value to a variable?

A

Location of data item in memory.
Data type, what we can do with the data + how much space it takes up in memory.
Variable name must be created before value is assigned.

30
Q

Why is it important to choose the correct data type in programming?

A

It determines what actions we can perform on the data. e.g. Can’t add a text string by an integer.

31
Q

What are the 4 different programming data types?

A

Strings, integer, real and boolean.

32
Q

Describe strings.

A

Series of characters, in quotation marks (single/double). We can add them together (e.g. ‘birth’ + ‘day’ = ‘birthday’

33
Q

Describe integers.

A

A whole number (positive/negative). We can use a range of mathematical operations on them (+/-)

34
Q

Describe real as a data type.

A

Enables us to store a number with a fractional part. Sometimes called a decimal, float or double.

35
Q

Describe BOOLEAN.

A

Value can be True/False, Yes/No.

36
Q

What does python assume about all data entered using input ( )? Unless?

A

It’s a string. Type is cast into different data type. e.g. int(input).

37
Q

What are functions and procedures?

A

Blocks of organised code which perform specific tasks. We can reuse them to make code more efficient.

38
Q

What are built-in functions?

A

Ready made functions. e.g. print ( ) and input ( )

39
Q

What is a procedure?

A

Self contained block of code that performs a task e.g. calculate average of 2 numbers. May return a value, but doesn’t have to.

40
Q

What is a function?

A

Self contained block of code which performs a task. e.g. Asks for data input, checks it’s valid. Always returns a value.

41
Q

When you create programs, what must you ensure they are?

A

Easy to read, understand and maintain.

42
Q

How can programming issues be made easier to solve?

A

Break them down into a series of smaller steps which can be easier to understand or solve. The total solution is created when all the smaller sub-problems have been solved.

43
Q

What are the 3 constructs in structured programming?

A

Sequence, selection and iteration.

44
Q

What is source code?

A

A series of language statements written to solve a problem. The language the program is written in.

45
Q

What is iteration?

A

Repeating instructions/processes over + over again (for/while loop)

46
Q

What are while loops?

A

Conditional loops as they continue to loop until a condition is met.

47
Q

What are for loops?

A
Loops for set number of times (number range or items in a list)
Usually range (num) - goes up to but doesn't include num.
48
Q

Bubble Sort

A

Up and down line swapping numbers if one on right is smaller.

49
Q

Insertion Sort

A

Uses temp to switch numbers.