S2 - Programming (Done) Flashcards Preview

Computing - GCSE > S2 - Programming (Done) > Flashcards

Flashcards in S2 - Programming (Done) Deck (56)
Loading flashcards...
1

What are the main data types ?

Integer(INT), real(or float)(REAL), boolean(BOOL), character(CHAR), string(STRING).

2

How much memory does an integer take up ?

2 bytes or 4 bytes.

3

How much memory does an real take up ?

4 bytes or 8 bytes.

4

How much memory does an boolean take up ?

1 bit is needed but 1 byte usually used.

5

How much memory does an character take up ?

1 byte.

6

How much memory does an string take up ?

1 byte for every character in the string.

7

How do you change from a string to an integer in pseudo-code ?

STRING_TO_INT( '1' )

8

How do you change from an integer to an string in pseudo-code ?

INT_TO_STRING( 1 )

9

How do you change from a string to a real in pseudo-code ?

STRING_TO_REAL( '1' )

10

How do you change from a real to a string in pseudo-code ?

REAL_TO_STRING( 1.0 )

11

What are the basic arithmetic operators ?

Addition, subtraction, multiplication, division, integer division(DIV) - only works with integers and remainder(MOD or %) - only works with integers.

12

What is a constant ?

Something that can't be changed in the program, trying to will result in an error. They're assigned a value at design time.

13

What is a variable ?

Something that can be changed, meaning that a variables value can be changed at any point throughout the program making them much more useful than constants.

14

What does the string manipulation LEN(string) do ?

Returns the number of characters in that string.

15

What does the string manipulation POSITION(string, character) do ?

Returns the position of the occurrence of a certain character in a given string.

16

What does the string manipulation SUBSTRING(x, y, string) do ?

Extracts a substring from the original string starting at position x and finishing at position y.

17

What is a nested IF statement ?

An IF statement inside another IF statement, allowing you to check more conditions once you've established that the previous condition is true or false.

18

What are ELSE-IF statements ?

Used to check multiple conditions and give different outputs depending on which condition is true, different from nested IF statements as they only check more conditions if the first one is false.

19

What is a CASE statement ?

They check the value of a variable, used when you want the program to perform different actions for different values of the same variable.

20

What is a repeat-until loop ?

Controlled by a condition at the end, keeps going until condition is true, always run the code inside them at least once and you get an infinite loop if condition is never true.

21

What is a while loop ?

Controlled by a condition at the start, keeps going while condition is true, never run the code inside if condition is initially false and you get an infinite loop if the condition is always true.

22

What is a do-while loop ?

Controlled by a condition at the end, keeps going while condition is true, always run the code inside them at least once and you get an infinite loop if the condition is always true.

23

What is a FOR loop ?

An example of a count controlled loop, repeating the code inside them a fixed number of times.

24

What is a nested iteration statement ?

Where the program contains a loop within another loop, where every time the outer loop repeats the inner loop completes a full set of iterations.

25

What are the three boolean operators you need ?

AND, OR and NOT.

26

In what order are boolean operations carried out ?

Brackets, NOT, AND then OR.

27

What is a potential use of boolean operators ?

In selection and iteration statements to check multiple conditions.

28

How can random integers be generated in pseudo code ?

RANDOM_INT(x, y)

29

When would you use random number functions ?

When you don't want the program to run the same thing every time.

30

How can you generate multiple random numbers in one command ?

Nest the function to create a random number within a FOR loop to get a set amount of numbers.