2.2.1 FINAL Programming techniques Flashcards

(15 cards)

1
Q

What is a data type?

A

A classification of data into groups

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

What is an integer?

A

Used to represent whole numbers, either positive or negative

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

What is a real?

A

Used to represent numbers with a fractional part, either positive or negative

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

What is chr?

A

Used to represent a single character such as a letter, digit or symbol

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

What is a string?

A

Used to represent a sequence of characters

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

What is boolean?

A

Used to represent true or false values

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

What is casting?

A

When you convert one data type to another data type

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

What is a programming construct?

A

Determines the order in which lines of code are executed

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

State the 3 types of programming constructs

A

Sequence, Branching, Iteration

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

What is a sequence?

A
  • Refers to lines of code which are run one line at a time
  • The lines of code are run in the order that they are written from the first line of code to the last line of code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a selection?

A
  • The flow of the program is interrupted and a condition is tested
  • Outcome of the condition will then determine which lines/block of code is run next. Two ways to write selection statements:
  • IF statement: test conditions sequentially
    SWITCH statement: test an expression against multiple possible constant values
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is an iteration?

A
  • Repeating a line or block of code using a loop. It can be:
  • Count controlled: When the code is repeated a fixed number of times (for loop)
  • Condition controlled: When the code is repeated until a condition is met (while loop)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a SWITCH/CASE statement?

A
  • Type of conditional statement that provides an alternative way to perform multiple comparisons based on the value of an expression
  • Useful when you have a single expression that you want to compare against multiple possible values
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a for loop?

A

Count controlled loop that will repeat a fixed number of times

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