Revision notes AQA Flashcards
1 In mathematics which of the following are integers:
8 5 103 –1.33 1¾ 98 3.14 1500.45 –935 (7 marks)
8 5 103 98 –935
What is a real data type?
A real data type contains numeric data in a decimal form. It is used in
situations where more accurate information is required than an integer
(a whole number) can provide.
Give two reasons why a programmer would wish to use an integer
data type rather than a real data type.
Storage: Real data takes up more memory than integer data; The
number has decimals.
Processing speed: Calculations using real numbers takes longer than
using whole numbers held as integers.
Consider the following sentence and write it as a Boolean: (4 marks)
When the door is open and it is cold outside I have to wear my coat.
If (“door is open”) AND (“is cold outside”) then “wear coat”
or
If door=1 AND cold=1 then coat
In programming what is a ‘string’?
A string, or text, data type is capable of holding any alphanumeric
character (letters, numbers or symbols). It is also capable of storing
non-printable characters, such as carriage returns, punctuation
characters and spaces. The data within a string data type can consist of
a combination of letters, numbers and symbols.
What is a ‘variable’ in programming? (1 mark)
Variables are data entities whose values can be altered when a program
is compiled. As their name implies, their values vary.
What does the following code do? (3 marks)
If (($wet && $cold) || ($poor && $hungry)) {
Print “I’m sad!”;
}
The ‘print’ statement is executed if wet AND cold are both true OR if
poor AND hungry are both true.
What is the study of data structures about? (1 mark)
The study of data structures is about organising data so that it is
suitable for computer processing.
Explain the term ‘concurrent’.
‘Concurrent’ means happening at the same time as something else.
Explain, using an example, the term ‘one-dimensional array’.
A one-dimensional array is a list of variables. To create an array, you must
first define an array variable of the desired type. One-dimensional arrays
in Python and PHP allow a list of items to be stored with the capability of
accessing each item by pointing to its location within the array, for example:
carMakers = [“Ford”, “Land Rover”,
“Vauxhall”, “Nissan”, “Toyota”]
or
<?php $carMakers = array[Ford, Land Rover,<br></br>Vauxhall, Nissan, Toyota]; ?>
Explain the difference between one- and two-dimensional arrays. (2 marks)
Two-dimensional arrays are nothing more than an array of arrays, in
other words an array in one row and another in the next row.
Why is the first element in an array usually [0] not [1]? (2 marks)
It is common practice within programming for the first element
within an array to be given an index of zero rather than 1, because
0 is considered by most mathematicians to be a real number
between –1 and 1and so in languages wherearrays are positively
indexed, zero is the first number (negative indexes are not possible).
Look at the following array.
carMakers = [“Ford”, “Land Rover”, “Vauxhall”,
“Nissan”, “Toyota”]
Use a coded solution to identify ‘Toyota’ as the car_name. (2 marks)
<?php <br></br> $car_name = carMakers[4];
?>
Program Flow Control
Explain with simple examples the basic building blocks of coded solutions. (3 marks)
The basic building blocks are: sequence, selection and looping.
- Sequence example: Set, Input, and Output statements
- Selection example: Conditional, if and if–else statements
- Looping example: Iteration, While and Do–While statements
Represent the following code as a simple flowchart. (4 marks)
if condition is true
then
perform instructions in Block1
else
perform instructions in Block2
endif
Design a simple flowchart to show the actions of a single move in a snakes
and ladders game.
What is the purpose of procedures and functions in programming
languages?
Procedures and functions allow the repetition of certain sections of a
program or calculation many times.They also assist in themodulation
of code by allowing themselves to be called from any point within a
program solution.
What is the main difference between a procedure and a function?
(2 marks)
A function carries out actions and returns a value to the main
program. A procedurecarries out actions without returning a value.
scope of variables, constant, functions, and procedure
What is global scope?
A variable that can be accessed from anywhere within the project that
contains its declaration as well as from other projects that refer to that
initial project.
In terms of scope, briefly describe what is meant by: (2 marks)
a) local variable
b) global variable.
The scope of a local variable is the procedure in which it is declared.
The scope of a global variable is the whole program.