Programming Module Flashcards
What is binary
0s and 1s, 0 = Off, 1 = On
Simplifies data storage, and processing in computers
What is hexadecimal
0-9 normal decimal
A = 10, B = 11, C = 12, D = 13, E = 14, F = 15
What is control structures
Guide the flow of program, ensuring logical execution
What is sequence in control structures
Code runs line by line, one after the other
Straightforward, step-by-step processes
What is selection in control structures
Conditional statements (if, elif, else)
Decisions based on conditions
Choose paths based on criteria
What is iteration in control structures
Loops (for, while)
Execution of code repeatedly, based on given task
What is modular coding
Breaking down program into separate, manageable, sections into functions / modules
What is the benefits of modular coding
Readability / Maintainability of code
Promotes code reusability, allows for easier debugging & testing
Allows for collaboration, as can assign members certain roles
What is the best practices of modular coding
Use meaningful names: Name functions & variables clearly
Keep functions short: Each function should perform single task
Reuse functions: Use functions to avoid code duplication
What are functions
Block of code designed to perform particular tasks
Reduces code that isn’t needed
def function_name (parameters):
What are parameters in functions
Variables listed in parentheses in function definition
Placeholders as values passed to function
What are arguments in functions
Actual values / variables passed to functions when called
What is local scope in variables
Variables declared inside function
Accessible only within function
Use to prevent interference between functions
What is global scope in variables
Variables declared outside any function
Accessible throughout program
Minimise global variables, avoid unintentional modifications
What are data types
Store & manipulate data
Essential for creating variables & constants in code
What are integers
Whole number without decimal, efficient memory, fast processing
What are floats
Number that includes decimal point
Requires more storage than integers
What are strings
Sequence of characters enclosed in quotes, easy manipulation & concatenation
What are booleans
Either true or false, enhances decision-making in code
What is pseudocode
High-level representation of algorithms in a detailed yet readable description
What is the investigation phase in the framework for development
Identify & Understand the problem
Specify what the software needs to do to solve the problem
Create a timeline for the development process
What is the design phase in the framework for development
Design data structures, how data will be organised, stored, accessed
Design and test algorithms that form software
What is the evaluate phase in the framework for development
User Acceptance testing, ensure software meets needs and is user-friendly
Developer retrospective, development team reviews process, identifies success and areas for improvement
What is the develop phase in the framework for development
Develop & Debug the code, according to the designs in a programming language
Perform unit testing, to ensure individual components / functions of software work as intended
What is Validate Input Before Processing in good programming practices
Prevents errors, ensure game behaves as expected
What is Use Meaningful Variable Names in good programming practices
Enhances code debugging
What is Use of Constants for Readability and Maintenance in good programming practices
Makes easier to update values and understand the code
What is Use of Comments to Explain Code in good programming practices
Aid understanding, especially for complex logic
What is Appropriate Use of Standard Control Structures in good programing practices
Appropriate managing of the flow of a program
What is Use of Appropriate Indentation and White Space in good programming practices
Improves readability of code
What is One Logical Task Per Module in good programming practices
Simplifies code debugging, enhances code reuse
What is Meaningful Names For Modules in good programming practices
Simplifies code debugging, enhances code reuse
What is Exception Handling in good programming practices
Ensures game can gracefully handle errors without crashing
What is benefits of using structured algorithms
Ease of development
Ease of understanding
Ease of modification
What is Ease of Development in benefits of using structured algorithms
Allows for easy development of the algorithm
What is Ease of Understanding in benefits of using structured algorithms
Allows for understanding of the code
What is Ease of Modification in benefits of using structured algorithms
Allows for easy modification of algorithm
What is algorithm
Step-by-step procedure to solve a problem
What is a modular approach
Break down problems into smaller, manageable modules, enhances overall algorithm efficiency
Ease of maintenance, code reusability, collaborative development
How do you develop modular code
Effective function design
Parameter passing techniques
Return values
Collaborative coding sessions
What are structure charts as a design tool
Visual representation of system’s hierarchical structure
Breaks down system into component modules / subsystems
What is purpose of structure charts as a design tool
Modular design
Clarity, provides clear overview of structure
Communication tool among team members
Maintenance, simplifies debugging & maintenance
What is good structure chart practices
Keep it simple
Consistent naming
Regular updates
What are the steps to creating a structure chart
Identify the major modules
- Break down the modules into sub-modules
Establish the calling relationships between modules
Refine chart to improve clarity and efficiency
What is the use of stubs to represent incomplete modules
Placeholder code used to represent incomplete modules / functions
Allows development to continue if certain parts of code not fully implemented
Define function with correct name & parameters, but with simplified / dummy code
How do you load an array and print its contents
Loop through array using for loop
Print every element
How do you add the contents of an array of numbers
Initialise a variable ‘sum’ while will hold the final value
Loop through array using for loop
Add the value of each element to ‘sum’ variable
How do you identify position of minimum or maximum value
Initialise two variables ‘min’ and ‘max’ which will hold the minimum and maximum values respectively
Set the value of both to first element in array
Loop through array using for loop
If the element value is less then ‘min’, update the ‘min’ value to the element value
If the element value is more than ‘max’, update the ‘max’ value to the element value
How do you open file for read, write, and append
Creates new file, truncates existing one
“r” = Read (Process data), “w” = Write (Write to file), “a” = Append (Append to end of file)
file = open(“file.txt”, “r”) (Python)
OPEN file.txt AS file (Pseudocode)
How do you write and append content to a file
Write method, overwrites existing content, writes single line to file
Writelines method, writes multiple lines from list, appends lines to file
Applies for both writing and appending
How do you close a file
Close file after to avoid resource leaks
CLOSE filename (Pseudocode)
filename.close() (Python)
What is testing all pathways through algorithm
Test data covers all possible paths within algorithm, complete coverage
Eg. Algorithm with if-else, test data that triggers both the if & else parts
What is boundary condition testing
Focus on values above, below, or at upon which decisions are based
What is testing where the required answer is known
Test data for which output already known to verify correctness
Ensure algorithm returns expected result for given input
What is type and range checking
Algorithm correctly handles different data types
Algorithm operates within acceptable input range
What is desk checking
Manually walk through algorithm with test data
Use trace tables
What are trace tables
Tracks value of variable at each step of algorithm’s execution, flow of execution through program / algorithm
Record each change in variable values and Boolean comparisons to each line of code executed.
Clear visualisation of program’s behaviour during execution
What are stepping through coded solutions
Executing a program one instruction or line at a time, sometimes with debugger
Closely examine behaviour and track flow of execution
Technique allows programmers to identify errors, understand complex logic, and observe changes in variable values and program state at each step
How do you use print statements to debug code
Help understand flow of execution, which sections have been executed
State of variables at various points of program
Be strategic about placement, remove / comment out unnecessary print statements afterwards
What are syntax errors
Source code of program contains mistakes, does not adhere to rules & grammar of programming language
What are runtime errors
Error during program running after being successfully compiled
What are logic errors
Bug in program that causes program to operator incorrectly, but doesn’t terminate / crash program
What is an API
Set of rules & protocols that allow different software applications to communicate with each other. Specifies how software components should interact, what requests can be made, and what data will be returned
What is purpose of APIs
Acts as a bridge, allowing one piece of software to talk to another, regardless of underlying technology, allowing data exchange
Reduces development time & costs by reusing existing services / components through integration, don’t have to write from scratch
Allows scaling of application by integrating third-party services
Allows developers to update functionality of code, without changing application code that uses it
What are Limitations of APIs
Higher response times, API might be performing unnecessary calculations, using up needed resources
May cause inefficient data transfer, and scalability issues
Poor design makes it hard for developers to integrate it into their application
What does API stand for
Application Programming Interface
Example of an API can be used to integrate third-party services into an application
A food delivery platform that integrates with Google Maps to give user’s visibily into their orders progress
A weather app retrieves real-time data from the weather bureau to show you the weather in the weather app
Is ethical and legal implications in software development crucial
Yes
What is intellectual property (IP)
Legal rights granted to owners of software code, algorithms, other creations
- Protect unique work of developers, ensure that they have control over their creations
- Protected by copyrights, patents, trademarks
What is plagiarism & acknowledgement of code
Copying someone else’s code without permission / proper acknowledgement
Ethical practices require acknowledging use of someone else’s IP
Include comments in code / documentation to cite sources
What is australian copyright laws
Copyright protection automatic upon creation of work, doesn’t require registration
Developers must ensure they have right to use, modify, distribute software
What is software licensing
Grant permissions to users under specific conditions, detailing how software can be used, modified, distributed
Proprietary Software Licences, Open Source Licences
What is software piracy
Unauthorised copying, distribution, or use of copyrighted software
Fines, imprisonment, liability for damage