Programming Flashcards

1
Q

What data types are there?

A

Integer
Real
Character
String
Boolean

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

What does this data type mean?
Boolean

A

True or False

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

What does this data type mean?
Real

A

Decimal numbers

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

What does this data type mean?
Integer

A

Whole numbers

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

What does this data type mean?
Character

A

A single alphanumeric character

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

What does this data type mean?
String

A

One or more alphanumeric characters

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

What are the limitations of different data types?

A

integers and real numbers cannot be concatenated, ie joined together.

numbers held in strings cannot be subject to mathematical operations.

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

What is casting?

A

When a programmer needs to change the data type of the contents of a variable.

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

What is a computer program?

A

Sequences of instructions for a computer.

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

What is a sequence?

A

a set of instructions that follow on one from another

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

What is an instruction?

A

A single action that can be performed by a computer processor

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

What is a selection?

A

A decision within a computer program when the program decides to move on based on the results of an event.

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

What is an iteration?

A

The repetition of a block of statements within a computer program.

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

What is execution?

A

The process of a program being run on a computer.

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

What are the two types of iteration?

A

Definite iteration (also known as count-controlled iteration)
Indefinite iteration
(also known as condition-controlled iteration)

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

What is a variable?

A

A variable is a named piece of memory that holds a value

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

What is an identifier?

A

A variable’s name is known as an identifier.

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

What is the naming convention?

A

It can contain letters and numbers but must start with a letter.
It must contain at least one letter - at the start of the name.
It must not contain special characters or punctuation characters. An underscore can be used. Spaces are not allowed.
The name should be meaningful.

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

What does assignment mean?

A

Giving a variable a value is known as assignment

20
Q

What is declaration?

A

Most programming languages require a variable to be identified before a value is assigned to it. It is explicitly declared.

21
Q

What is a constant?

A

A constant is a named piece of memory where the value cannot be changed while a program runs

22
Q

What is a global variable?

A

A global variable is one that can be accessed and changed throughout the whole program

23
Q

What is a local variable?

A

Local variables only exist within a particular subroutine.

24
Q

Why are local variables better than global variables?

A

Using local variables rather than global variables makes it easier to debug a program as the value of that variable can only be read or changed within one subroutine.
Another advantage of local variables is memory efficiency. Once a subroutine has finished running, the memory used for all local variables is removed

25
Q

What is a condition?

A

In computing, this is a statement that is either true or false.
A computation depends on whether a condition equates to true or false.

26
Q

What is an iteration?

A

There are times when a
program needs to repeat certain steps until told otherwise, or until a
condition has been met.

27
Q

What process is otherwise known as looping or repetition

A

Iteration

28
Q

Why are iterations useful?

A

Iteration allows programmers to simplify a program and make it more
efficient. Instead of writing out the same lines of code again and again, a programmer can write a section of code once, and ask the program to
execute the same line repeatedly until no longer needed.

29
Q

What is a count controlled iteration or definite iteration

A

When a program needs to iterate a set number of times

30
Q

What type of loop does a definite iteration use?

A

a FOR loop. A FOR loop uses an extra variable called a loop counter that keeps track of the number of times the loop has been run.

31
Q

Why, by using iteration, is a program simplified, less error prone and more flexible?

A

there are fewer lines of code, meaning fewer opportunities for typing errors to creep in
to increase or decrease the number of iterations, all the programmer has to do is change the loop’s end value

32
Q

What is a FOR STEP loop?

A

add the keyword STEP to the first line of a FOR loop to determine how much the stepper variable increases or decreases by with each iteration.

33
Q

What type of loop does an indefinite iteration use?

A

WHILE loops
- uses the statements
WHILE and ENDWHILE

REPEAT UNTIL loops
- uses the statements REPEAT and UNTIL

34
Q

What does a WHILE loop do?

A

WHILE loops test the condition at the beginning of the loop. If the condition is met, the code within the loop is executed before the program loops back to test the condition again.

35
Q

How does a REPEAT UNTIL loop work?

A

REPEAT UNTIL loops function in the same way as WHILE loops, with one major difference - the condition is tested at the end of the loop.

36
Q

What’s the main difference between a WHILE loop and a REPEAT UNTIL and DO WHILE loops?

A

With a WHILE loop, the code within the iteration may never be executed. With a REPEAT UNTIL loop, and a DO WHILE loop the code is always executed at least once

37
Q

How does a DO WHILE loop work?

A

DO WHILE loops function in the same way as REPEAT UNTIL loops, with the WHILE condition being tested at the end of the loop

38
Q

What does selection mean?

A

Selection is a programming concept where a section of code is run only if a condition is met

39
Q

How does selection work?

A

Selection works by testing a condition. The test gives a Boolean result - TRUE or FALSE.

40
Q

What statements would selection use?

A

Selection is implemented using IF THEN ELSE statements.

41
Q

What is a subroutine?

A

Subroutines are smaller, named sections of code that are written within a larger program.

42
Q

What are some positives of subroutines?

A

Subroutines are usually small in size, which means they are much easier to write, test and debug.
They are also easy for someone else to understand.
As they are written outside of the main program, subroutines can be saved separately as modules and used again in other programs.

43
Q

What are the two types of subroutines?

A

procedures
and
functions

44
Q

What is a procedure subroutine?

A

A procedure is a subroutine that performs a specific task.

45
Q

What is a function subroutine?

A

A function works in the same way as a procedure, except that it manipulates
data and returns a result back to the main program.

46
Q

What’s the difference between a procedure and a function?

A

Procedures perform a specific task but do not return a value. Functions manipulate data and return a value to the main program.
Functions have a return line.

47
Q

What is nested selection
or nested iteration?

A

Nested selections are when If statements are within more if statements.

Nested iterations are when For or While loops are within another For or While loop.