paper 1 Flashcards
What is in structured programming?
- decomposing into manageable sub tasks, which can be written individually as sub routines
- modularising (using subroutines)
*using parameters
*using return variables
*using local variables
Why use structured programming?
- easier to test structured programs as each module can be tested individually
- individual subroutines can be fixed and updated, without affecting the rest of the program
- the subroutines can be re-used for future programs
- programmers can work on one program, as each module can be written individually
*coding may be easier
What is authentication?
the process of check a user is who they say
What is INPUT validation?
checks that the data meets a certain criteria before passing into the program
What are the types of input validation?
*range: checks that the data is within a specific range
*presence: checks that data has actually been entered
*format: checks that the data has the correct format
*look-up: checks the data against a table of acceptance values
*length: checks the data correct length
why should programs be easy to maintain?
- change parts of the source code, without the risk of causing problems elsewhere in the code
How can you improve the maintainability of the code?
*comments explaining key features
*indentation to clearly see the flow of the program
*only using global variables where necessary, as they affect the rest of the code, variables with local scope will not affect the rest program, when other programmers change this variable it won’t affect the other part so he program
*variable names are enough for the reader to understand
What are the different types of errors?
*syntax error
*logical error
What is a syntax error?
When the compiler or interpreter doesn’t understand something you have typed because it doesn’t follow the rules or grammar of the programming language
How would you use the python in range function for pseudocode?
Why are meaningful identifiers names used?
Describes the purpose of the variable
makes the code easier to understand and maintain
What are the different types of test data ?
🟢normal data
🟢boundary valid data
🟢boundary invalid data
🟢erroneous data
What are trace tables ?
Helps to find logical errors
What is time efficiency in algorithms?
Measures things like the number of time memory was accessed and the number of CPU cycles taken to execute commands
Define ‘algorithm’
The sequence of steps that can be followed to complete a task
Define decomposition
The breaking of a problem into a number of sub problems, so that each sub problems accomplishes an identifiable task, which might itself be further subdivided
“Abstraction “
The process of removing unnecessary detail from a problem
Why are data types used?
Each data type is allocated a different amount of memory, using the correct data types makes the code more memory efficient, robust and predictable
Define constants
Define variables
What is an algorithm?
An algorithm is a sequence of steps that can be followed to complete a task.
What is decomposition?
Breaking a complex problem into sub problems until each task is manageable, then solving each one individually
What is abstraction?
Removing unnecessary detail from a problem so you are left with important bits, simplifying the task
What is algorithmic thinking?
A logical way of getting from the problem to the solution. Acknowledging if certain bits of code can be reused
What must you always do in pseudocode?
Declare variables
What is efficiency in programming?
How much time is needed to a run a particular algorithm and how much space is needed
Which one is more efficient a bubble sort or a merge sort?
A merge sort
Splits and then merges instead of swapping each pair
Which is more efficient binary search or a linear search?
Binary search
Only when list is ordered
Keeps on cutting of half rather than checking each number
How would you address questions about abstraction?
1-definition
2-important detail
3-unnecessary detail
How do you address questions about decomposition?
1- definition
2- two questions you can think of to sub section
What is considered ‘time’ in programming?
How may number of times memory was accessed
The number of CPU cycles taken to execute the command
is a computer program an algorithm ?
Why use the correct data types?
As each data type is allocated a different amount of memory , using the correct data types makes the code more memory efficient , robust and predictable
What is program flow ?
The order in which statements are executed in a program
- can be controlled used selection and iteration
Write a pseudocode that creates a 6 digit username.
With the first 3 letters being from town first three letters
Then the second 2 digits being their current age
The last digit is the last letter of their surname
Why use meaningful identifiers ?
What are arrays ?
A data structure where data values of the same type are stored and defined under one variable name.
Why are subroutines good ?
🔵can be tested individually making it easier to debug .
🔵can be recalled many times within the program , rather than repeating sections of code (more efficient)
🔵can be stored as separate modules and reused in other programs
What is a local variable
A variable that can only be used within the structure that they have been declared .
✅cannot and are not affected by anything outside a subroutine (same variable name can be used elsewhere )
✅✅
What is a data type?
Specification is what type of value a variable has.
What are the five data types?
Integer
Real/float
Character
String
Boolean
What is an integer?
A numerical data type for whole numbers
2/4 bytes
What is a real/float ?
A numerical data type for decimal numbers
4/8 bytes
What is a character?
A single alphanumerical symbol
1 byte
What is a string?
A data type for one or more alphanumerical characters.
* can be a number or string
1 byte for each character