Programming Key Terms Flashcards
Define the term algorithm.
An algorithm is a set of instructions that performs a task.
What are the different types of data types?
Char
Boolean
Integer
Float
String
What is a constant?
A constant is a variable that can never be altered.
Give the pseudocode for printing “Hello World”
OUTPUT “Hello World”
Give the pseudocode for asking the user to input a string, and store it in the variable ‘string’.
string <– USERINPUT
What does the DIV operator do?
Gives an integer for every division, or the quotient.
10 DIV 4 = 2
What does the MOD operator do?
Returns the remainder of the operation.
3 MOD 2 = 1
What is the key term for converting a variable from one data type to another?
Casting
How can we convert a string to an integer in pseudocode?
STRING_TO_INT(variablename)
What are comments for in a program?
Describes the purpose of the program and helps other programmers understand the program
What is sequence?
Lines of code that are executed in order
OUTPUT “Hello”
OUTPUT “World”
What is selection?
A statement where a certain condition must be met
IF var = TRUE THEN
OUTPUT “TRUE”
ENDIF
What is iteration?
Repetition of a section of code.
For loop
While loop
REPEAT UNTIL loop (pseudocode)
Write the pseudocode for finding a random integer between 1 and 6, and store it in a variable.
var = RANDOM_INT(0, 6)
What is an array?
A data structure that can store multiple items of data of the same data type.
An array has a fixed length.
How do indexes work?
Indexes start from 0, for example array[0] would be the first item in the array
How can an array be declared in pseudocode?
array nameofarray[20]
An array has been created of length 20
Print “Hello World” 10 times using a for loop in pseudocode.
FOR i <– 0 TO 10:
OUTPUT “Hello World”
ENDFOR
What are functions and procedures an example of ?
Subroutines
What is a function?
A function will always return a value after processing takes place
What is a procedure?
A procedure executes code in a subroutine but does not execute anything
What is a subroutine?
A named, self-contained section of code that performs a specific task
What are parameters?
Parameters are values that can be entered into a subroutine that are processed.
e.g. SUBROUTINE add(a, b)
total <– a + b
return total
ENDSUBROUTINE
a and b are parameters in this subroutine
What are the advantages of subroutines in a program?
Break down a large section of code into smaller, more manageable sections (decomposition)
Can be used multiple times easily
Each one can be tested separately, making it easier to debug
Splits the workload
Easier to change is requirements become different
What is data validation?
Data validation ensures that data is of the right type, e.g. data must be between 3 and 7 characters long, or data must be an integer
What are the different types of validation?
Presence check - if data has been entered
Type check - if data is a integer, or string
Format check - if an email address is
formatted correctly
Length check - if data is of the right length
Range check - if data is between the right length
What is authentication?
Authentication routines are used to check that someone is who they claim to be.
What is a local variable?
A local variable is a variable declared within a subroutine that is not recognised anywhere else in the program
What is a global variable?
A variable that is declared in the main program and is recognised in a subroutine.
What are trace tables used for?
Trace tables are used to determine the output of a program, or the purpose of a program, or try and find errors in a program
What is a syntax error?
An error where the code written does not conform to the rules of the language
What is a logical error?
The program runs but does not work as the programmer intended.
What are the three different types of data tests?
Normal data - typical data that will work
Erroneous data - data that will cause an err
Boundary data - data that test the boundary e.g. between 1, and 10, testing with 1.
What is abstraction?
The removing of unnecessary details in order to solve a problem.
What is abstraction?
The removing of unnecessary details in order to solve a problem.