Computing Module - Final Exam Flashcards
(41 cards)
Arguments
Pieces of data that are sent to a function, which the function uses in calculations or other operations
Parameter Variables
Represent the inputs to the function, and are assigned the value of the arguments
Value-Returning Functions
Returns a value back to the part of the program that called it, used when the function should explicitly return a value. If a function contains NO return statement, None is automatically returned.
Lists
A collection variable that has an ordered sequence of elements, each element inside the list is called an item.
A list can hold multiple types of data
Count-Controlled Loops
A loop that iterates a specific number of times, and is written using a “for” statement. The for statement executes once for each item in the sequence.
Condition-Controlled Loops
A loop that will iterate as long as a condition is true, and is written using a “while” statement. The statement(s) under while loop iterate as long as the condition is true.
If statements
One way selection instruments, prevents an action from being performed if a condition is not right
If-else statements
Two-Way selection instruments, makes a choice between two alternative courses of action
If-elif-else statements
Multi-Way selection instruments, consider each condition until one evaluates to true or they all evaluate to false
Nested Decision Structures
Allow for consecutive decisions to be made, and a condition inside will only evaluate if the first condition evaluates to True
Nested Repetition Structures
A loop inside a loop, an inner loop goes through all of its iterations for one iteration of the outer loop
Preventing Software Bugs
Object oriented programming can improve the structure of large software systems, and software testing techniques can be developed and promoted
Black Box Software Testing
testing code without considering how it works, e.g we check to see if a given input produces desired output
White Box Software Testing
testing code knowing how coed is supposed to work, e.g. we check to see if each condition of an if statement will work when expected
Integration Software Testing
testing different sections of code working together; lets us test communication between different sections of code
Unit Software Testing
testing a specific section of code, e.g testing a single function
Software Bugs
error or flaw in computer program, causing unexpected results or incorrect behaviour
Test Plan
created to finding as many software bugs as possible, and ensuring software is bug free before release
Test Plan Cases
Normal Cases - expected inputs that produce a specific result
Boundary Cases- inputs that lie close to some parameter
Abnormal cases- empty lists, strings, files
Each input should have an expected output, if expected output does not match actual output, the result is a fail and vice versa
Text File
contains data that has been encoded as a text; using scheme such as ASCII or unicode
Binary File
contains data that has not been converted to text
File I/O
consists of opening, reading, modifying, and closing files; it can help with analyzing, interpreting, and storing data with python
Open function
‘r’ - open for reading only
‘w’- open file for writing
‘a’ - open a file to be written to
.read()
reads entire contents of file, and returns riles contents as string