Topic 1 Computational Thinking and Topic 6 Problem Solving Flashcards

1.1 (9-12 & 14), 1.2 (18-23), 1.3 (24-28), 1.4 (35), 1.8 (105)

1
Q

Define a “syntax error”

This is a category of error.

A

An error in the use of the programming language.

e.g a missing ‘:’ or a misspelled keyword

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

Define a runtime error.

This is a category of error.

A

An error which causes a program to crash.

e.g ‘divide by sero’ and ‘index out of range’

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

Define a logic error.

A

An eror which causes incorrect or unwanted behaviour(s).

e.g using the wrong arithmetic operator or mixing up variable names.

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

What is syntax?

A

The rules that govern how the pieces of a programming language can be put together to make meaningful instructions

Similar to grammar and punctuation in english.

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

What is IDE?

A

It is a package that helps programmers to develop program code.

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

What is a reserved word?

A

Any keyword in the programming language that programmers aren’t allowed to change.

^ So use for variables etc.

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

What is a comment?

A

A way for programmers to annotate code so their logic is clear to the reader. Comments aren’t executed.

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

What is a literal?

A

Values in code, such as numbers or characteristics inside quotes. They can’t be changed during execution.

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

What is a variable?

A

A name associated with containers which programmers use to hold data. Their contents can be changed during execution.

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

What is a program?

A

An algorithm which has been converted into program code to be executed.

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

What is program code?

A

The implementation of an algorithm in a human-readable form that can be translated into a form to execute on a computer.

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

Define ‘debugging’.

A

The process by which a programmer finds and corrects errors in code.

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

What does IDE stand for?

A

Integrated Development Environment.

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

What is carriage return?

A

The character generated inside the computer when a user presses the Enter key on the keyboard.

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

What is a console?

A

The place where the output from a program is displayed.

This could be directly on a device or in a window of another app, such as IDE.

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

What is a high level language?

A

A programming language resembling human language.

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

What is a low level language?

A

A programming language that is closer to machine code than human language and requires a detailed knowledge of a particular CPU’s architecture to write.

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

What is a type error?

A

An error that occurs when an operation is attempted that is invalid for that type of data.

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

What is a name error?

A

An error that occurs when a name is used that is not known about (often a misspelt variable name.)

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

What is a zero division error?

A

An error that occurs when you attempt to divide a number by zero.

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

Define ‘keyboard interrupt’.

A

When a program is interrupted by the keyboard when pressing control+c

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

Who was the creator of boolean?

A

George Boole.

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

What is decomposition?

A

The breakdown of a problem into smaller, more manageable parts, which are then easier to solve.

24
Q

What is abstraction?

A

The loss of detail until you end up with the essential features of something so we can understand what people are trying to communicate.

25
Q

The higher level of abstraction…

A

The less detail required.

26
Q

What is an algorithm?

A

A precise method for solving a problem consisting of a sequence of step-by-step instructions that solve a specific problem.

27
Q

What decides a successful algorithm?

A
  • Accuracy
  • Consistency
  • Efficiency
28
Q

Define ‘execution’.

A

The process by which a computer carries out the instructions of a program.

29
Q

What does a flowchart do?

In the context of 1.2 algorithms and programs.

A

Represents an algorithm graphically.

30
Q

Describe the steps that help produce programs that execute on a computer.

A
  • Analyse (understand the problem and how to solve it)
  • Design (develop a solution in the form of an algorithm)
  • Implement (translate the description of the solution into a programming language)
  • Debug and test
  • Evaluate (make judgements on the solution and consider changes in favour of efficiency)
31
Q

Define ‘arithmetic operator’.

A

A symbol used to perform a calculation on two numbers.

32
Q

What are the 7 arithmetic operators?

and what do they do?

A
  • + (addition)
  • - (subtraction)
  • * (multiplication)
  • / (division (including decimal places))
  • // (integer division (ignoring remainders))
  • % (modulus (divides and returns remainder)
  • ** (exponentiation (raise the first value to the power of the second value))
33
Q

What is camel case?

A

Creating a variable name which has no space between words and has the second word starting with a capital letter.

34
Q

Which of these variable names are valid?

  1. 8HouseNumber = 288
  2. houseNumber = 288
  3. house Number = 288
  4. house_number = 288
  5. import = 288
A
  1. INVALID - begins with a number
  2. valid
  3. INVALID - includes a spcae
  4. valid
  5. INVALID - ‘import’ is a reserved word within python
35
Q

What are the 5 data types?

and their python keywords

A
  • Integer (int)
  • Real (float)
  • Boolean (bool)
  • Character (str)
  • String (str)
36
Q

What does an integer do?

A

Stores whole numbers without a fractional part (decimal place).

37
Q

What does a real do?

A

Stores whole numbers with a fractional part (decimal place).

38
Q

Describe ‘boolean’.

A

Only has two possible values: true or false.

39
Q

What does a character do?

A

Stores a single character or symbol.

40
Q

What is a string?

A

A sequence of one or more characters or symbols.

41
Q

When writing strings and using characters in code, you must enclose it in…

A

Quotation marks.

In python, strings and characters are treated the same way.

42
Q

Define ‘declaration’.

A

This happens when a variable is named and the computer allocates it a location in its memory. The amount of memory varies based on the data type.

43
Q

Define ‘initialisation’.

A

The assigning of the very first value to a variable.

44
Q

Define ‘function’.

A

A subprogram that performs a specific task and can be used at any point in the program. High-level programming languages have many useful built in functions but you can also create your own.

45
Q

What does the type() function do in python?

A

Determines the data type of a variable.

46
Q

What is a type conversion?

A

A temporary change of data type of an operation or instruction which allows it to be performed.

47
Q

Name the 2 ways a type conversion can take place.

A
  • Coercion
    An operation or instruction requires a change of data type and this is done automatically
  • Conversion
    Written code written by you which explicitly causes a change of data type.

Conversion can use: ‘int()’, ‘str()’, ‘float()’, ‘bool()’, ‘list()’

48
Q

State the names and symbols of the 6 relational operators.

A
  • Equal to: ==
  • Not equal to: !=
  • Greater: >
  • Greater than or equal to: >=
  • Less than: <
  • Less than or equal to: <=

Remember these !!!

49
Q

What is a relational operator?

A

Symbols that are used to compare two values.

50
Q
A
51
Q

What is a logic gate?

A

The basic component of digital circuits, taking one or two inputs and producing a single output based on a rule

52
Q

What is a truth table?

A

Table showing all possible combinations of the inputs & outputs of an operator.

53
Q

What are the 3 main logic gates?

A

NOT, AND & OR

NOT -> Output is opposite of input
AND -> Outputs 1 only if all inputs are 1
OR -> Outputs 1 if any of the inputs are 1

54
Q
A
54
Q

Match the symbol to the operator.


🌛

I’m not giving you the operators. Figure it out.

A

▷ - NOT
◗ - AND
🌛- OR

55
Q

Fill in the truth table:
A|B|A OR B| NOT (output)
0|0|…………|1
0|.. |…..1…..|0
..|0|…………|0
..|..|…………|0

A

You should’ve gotten…

A|B|A OR B| NOT (output)
0|0|……0…..|1
0|1|……1…..|0
1|0|……1…..|0
1|1|……1…..|0

56
Q

How do you calculate the amount of variations in a table?

A

amnt. of possible valuesamnt. of variables

For example if there are 2 possible values and there are 5 variables, the amount of options is 25