Software Development Flashcards
How do you find the minimum number in a list?
set min to array(0)
for index = 1 to _ if array(index) < min then min = array(index) end if end for
How do you find the maximum number in a list?
set max to array(0)
for index = 1 to _ if array(index) > max then max = array(index) end if end for
Count Occurrences
receive target from keyboard
numfound = 0
for index = 1 to _ if array(index) = target then numfound = numfound + 1 end if end for
Linear Search (Fixed Loop)
receive target from keyboard
found = false
pos = 0
for index = 1 to _ if array(index) = target then found = true pos = index end if end for
Where can an actual parameter be found?
Procedure Calls
example: CALL GetDimensions(UserLen, UserBre)
Where can a formal parameter be found?
Procedure definitions
example: PROCEDURE GetDimensions(length, breadth)
What is meant by ‘the scope of a variable’?
The extent of code in which a variable can be accessed and modified.
Where can a global variable be accessed?
From any part of the program.
They do not have to be passed into procedures as parameters because the procedure can access it without doing so.
What is a disadvantage of a global variable?
It reduces the modularity of a program and should be avoided wherever possible.
Where can a local variable be accessed?
Only within a procedure or function. They are declared within a sub-program.
They are not passed in or out and can only be used in the sub-program they were declared in.
What is a disadvantage of using a local variable?
They cannot be accessed from out with their own sub-program, which limits their scope.
What is a dry run?
A dry run is the process of a programmer manually working through their code to trace the value of variables. There is no software involved in this process.
The programmer would sit down with a pen and paper and manually follow the value of a variable to check that it was used and updated as expected.
What are trace tables used for?
to allow programmers to trace the value of variables as each line of code is executed.
What is a breakpoint
A breakpoint is a point in the program where the code will stop executing.
What is a watchpoint?
When the code will stop at each individual value in order to check if it is the expected outcome.