Save
computer science
cs paper 2
2.2 programming fundamentals
Save
Share
Learn
Content
Leaderboard
Learn
Created by
anisah
Visit profile
Cards (73)
What are the three programming constructs used to control the flow of a program?
Sequence
,
Selection
,
Iteration
View source
What does the Sequence construct in programming refer to?
Structuring code into a logical,
sequential
order
View source
How does the Selection construct function in programming?
It involves decision making using
if statements
View source
What is the purpose of the Iteration construct in programming?
Repeating code using
for
or
while loops
View source
What is the role of variables in programming?
To
store
data
in programs
View source
What is the specification code for the OCR exam board related to data types?
J277
View source
What are the two parts of a variable?
The
data value
and the
identifier
View source
What is a character in programming?
A single character, such as a
letter
,
number
, or punctuation symbol
View source
Give an example of a character data type.
T
View source
Why is it important to use sensible identifiers for variables?
They help other
programmers
understand the purpose of the code
View source
What is a string in programming?
A
sequence
of characters, including letters, numbers, and punctuation
View source
What is the difference between local and global variables?
Local variables are used within a specific
subroutine
, while global variables can be used anywhere in the
program
View source
Provide an example of a string data type.
Harry Waters
View source
What is an integer in programming?
A
whole number
View source
What are the advantages of using local variables in programming?
They save
memory
and are
easier
to
debug
View source
Give an example of an integer data type.
475
View source
What are the advantages of using global variables?
They can be used anywhere in the
program
and make maintenance easier
View source
What is a real number in programming?
A
decimal number
View source
What is an array in programming?
An array is a
static
data structure
that can hold a
fixed
number of data elements.
View source
Provide an example of a
real
number
data
type.
65.3
View source
What is a constant in programming?
Data that does not change in
value
as the program runs
View source
What must each data element in an array be?
Each data element must be of the same
data type
.
View source
What is a Boolean data type?
An answer that only has two
possible
values
View source
Give an example of a constant in mathematics.
Pi
, which is approximately 3.14159
View source
What is the index in an array?
The
index
is a number that indicates the
position
of an
element
in the
array.
View source
Give examples of Boolean values.
True
/
False
View source
What are comparison operators used for in programming?
To compare two
data values
View source
What is the index of the first element in an array?
The first element in an array always has an index of
0
.
View source
Why are telephone numbers stored as strings instead of integers?
Because they may contain
leading zeros
and
special characters
View source
What are the most common arithmetic operators?
Add (
+
), Subtract (-), Multiply (*), Divide (/)
View source
What does casting mean in programming?
Converting the value of a variable from one
data type
into another
View source
How can you traverse an array in programming?
You can use a for loop to display each data element in order.
View source
What does modulo division reveal?
The
remainder
from the last whole number
View source
What happens when you try to insert a new value into an array?
You cannot insert new values, but you can change the value of
existing
elements.
View source
In Python, which command is used to cast an input into an integer?
int()
View source
What is the result of
9
%
4
9 \% 4
9%4
?
1
View source
What is the purpose of the str() command in Python?
To
cast
a variable into a string
View source
What does integer division reveal?
The
whole number
of times a number can be divided into another number
View source
What is the result of
9
/
/
4
9 // 4
9//4
?
2
View source
What is an example of overwriting an element in an array?
Overwriting the
fourth
element (
Daphne
) with a new value (
Laura
).
View source
See all 73 cards