3.2 - programming Flashcards
downsides of constants?
if value must be changed, must change value in all instances of it in program
difference between indefinite and definite iteration?
indefinite = loop until condition met
definite = terminates after known amount of steps
what is 15 mod 2
1 (remainder)
what is 15 div 2
7 (integer division)
sign of not equal to?
equal sign with cross diagonal
command to select a particular character in a string?
POSITION(variable name, place)
what is the command to select a particular part of a string?
SUBSTRING (variable name, begin character, end character)
what is command to give number of characters in a string?
LEN (variable name)
another word for data structures?
abstract data types
what is an array?
a data store designed to store a set of data that is all of the same data type
first step of writing an array?
declare name and how big you want it to be
ie.
array ClassList [5]
how would writing an element in an array look?
ClassList [0]
can 2D arrays have different data types?
no, each element must have same data type
what would [3,1] and [0,2] be in the following array?
0 1 2 3 4 0 30 35 32 25 22 1 29 21 29 25 28 2 27 23 32 26 19
25, 27
left then right
what is a record?
an element in a table made up from a collection of different data types
what kind of loop is an increment needed?
in a while loop, not a for loop
what is a parameter?
a variable used to pass data into a subroutine
positives of subroutines?
- more understandable programs
- less chance of making errors
difference between function and procedure?
function returns values, procedures do not
how do you store the output of a function?
assign variable to call function
FUNCTION greet( )
name1