2c Flashcards
Define abstraction
Process of removing excessive details to arrive at a representation of a problem that consists of only the key features. Often involves analysing what is relevant to a given scenario and simplifying a problem based on this information (representational abstraction)
What is abstraction by generalisation
Process of removing excessive details to arrive at a representation of a problem that consists of only the key features. Often involves analysing what is relevant to a given scenario and simplifying a problem based on this information (representational abstraction)
Define data abstraction
Details about how data is being stored are hidden. E.g stacks and queues
What is the need of abstraction
Allows non experts to make use of a range of systems or models by hiding information that is too complex or irrelevant to the systems purpose
Enables more efficient software design
Reduces time spent on projects
Prevents unnecessarily large program
Define thinking ahead
Thinking about the different components of a problem and how to handle them in the best way possible
Means designing strategies for programs is easier and intuitive to use
Define preconditions
Requirements which must be met before a program can be executed
Specifying preconditions means subroutine can safely expect the arguments passed to certain criteria
Reduces length and complexity of code
Saves time needed to debug and maintain a longer program
Makes subroutines more reusable
What are libraries
Contain commonly used functions for reuse, including queues, stacks, classes and subroutines
Define decomposition
Breaking down a complex problem or system into smaller parts that are more manageable and easier to understand.
What are the advantages of reusable components
More reliable
Already been tested
Saves money, time and resources
Can be reused in future projects (- compatibility issues)
Define thinking procedurally
Large complex problem is continually broken down into smaller subproblems.
Makes project easier to manage and can be divided between a group of people
Define paradigm
The approach used when developing a piece of software
Define sequence
Code is executed line by line from top to bottom
Define branching
Particular block of code is run if a specific condition is met
Define iteration
Count controlled (block of code executed certain number of times)
Condition controlled (block of code is executed while a condition is met)
Define scope
Section of code in which the variable can be accessed
Define local variable
Can only be accessed within the subroutine in which they were defined
Deleted once subroutine ends
Ensure subroutines are self contained
Define global variables
Accessed across the whole program
Danger of being unintentionally edited
Not deleted until program terminates, requires more memory
Define modular programming
Technique used to split large, complex programs into smaller, self contained modules
Easier to divide tasks between a team
Each component can be dealt with individually
Improves reusability
Examples of modularity
Breaking down problem into sub problems
Functions and procedures
Passing by value
Giving address of parameter to subroutine
Define IDE
Program that provides a set of tools to make it easier for programmers to write, develop and debug code
List features of IDE
Stepping
Variable watch
Breakpoint
Source code editor
Debugging tools
List stages in the software development cycle (SDLC)
Analysis
Design
Development
Testing
Implementation
Evaluation
Maintenance
Explain waterfall lice cycle
Stages are completed in sequence
Clear structure
To make change all stages must be revisited
Low user involvement
Lack flexibility
No risk analysis
Explain agile methodologies
Aim to improve flexibility
Adapt quickly to user requirements
Different sections developed in parallel
Working prototype delivered early on
Less focus on documentation
High user satisfaction
Explain extreme programming
Example of agile model
High quality and highly usable software
Programmers work no more than 40hrs per week
Hard to produce high quality documentation
Explain spiral model
Manages high risk projects
Four stages:
Analysing requirements
Pinpointing and mitigating risks
Development, testing and implementation
Evaluating to inform the next iteration of
Project terminated if too risky
Specialist risk accessor hired
Lack of focus on code efficiency
Define RAD
Iterative methodology
User requirements gathered using focus group
Incomplete version given to user by trial
User feedback used to generate improved prototype
Final prototype matches user requirements fully
Used when user requirements are incomplete or unclear
Code may be inefficient
Fast pace
Late changes may reduce code quality
Define algorithm
Set of instructions used to solve a problem
Qualities of a good algorithm
Clearly defined inputs
Valid output for defined input
Able to deal with invalid inputs
Must always reach a stopping condition
Well do documented
Well commented
Define alpha testing
Carried out in house by software development teams
Bugs are pinpointed and fixes
Define beta testing
Carried out by end users
Feedback from users informs next stage of development
Define white box testing
Carried out by software development teams
Internal structure of program is recognised
All possible routes through program are tested
Define black box testing
Testers are not aware of internal structure of the software
Test plan traces through inputs and outputs
Purpose of a trace table
Records when and which variables are updated
Explain time complexity
Time taken to solve particular problem
Measured with bi-o notation to show effectiveness
Notation for constant time complexity
0(1)
Time taken for algorithm independent from number of elements inputted
Notation for linear time complexity
0(n)
Time taken is directly proportional to the number of elements inputted
Define space complexity
Amount of storage an algorithm takes
Define algorithm
Series of steps that complete a task
How to reduce space complexity on an algorithm
Perform all of the changes on the original pieces of data
How to reduce time complexity on an algorithm
Reduce the number of embedded for loops as possible
Explain a linear search algorithm
Traverses through every item one at a time until it finds the item it is earthing for
Explain binary search algorithm
Divides and conquers
Only applied on sorted data
Explain bubble sort algorithm
Passes through the list evaluating pairs of items and ensuring the larger value is above the smaller value
Explain what a stack is
First in last out data structure
How to check size of stack
size()
How to check if stack is empty
isEmpty()
How to return top element of stack
peek()
How to add to stack
push(element)
How to remove top element from stack and return removed element
pop()
Explain what a queue is
First in first out data structure
Front holds position of first element
Back stores next available space
How to check size of queue
size()
How to check if queue is empty
isEmpty()
How to return top element of queue
peek()
How to add to queue
enqueue(element)
How to remove element at the front of the queue and return it
dequeue()
How does bubble sort work?
Makes comparisons and swaps between pairs of adjacent elements
How does insertion sort work?
Inserts elements into the correct position
What is the pseudocode for a linear search algorithm
Function linearsearch (search,data[])
Position=-1
For i = 0 to data.length-1
If data [i] == search then
Position=i
Break
Endif
Endfor
Return position
End function
What is the pseudocode for binary search algorithm
Function binary search (search,data[])
Position= -1
Lower=0
Upper= data.length-1
While lower < = upper
Mid=(lower+upper) DIV2
If data [mid]== search then
Position=mid
Elseif data [mid]< search
Lower=mid+1
Else
Upper=mid-1
Endif
End while
Return position
End function
Write bubble sort algorithm
Procedure BubbleSort (data[])
Swapped=True
While swapped == True:
Swapped = false:
For n=0 to data.length-2:
If data [n]>data[n+1]:
Temp=data[n+1]
Data [ n+1]=data[n]
Data[n]=temp
Swapped=True
End if
Endfor
End while
End procedure
What is the insertion sort algorithm
Procedure InsertionSort(data[])
For i = 1 to data.length -1
Current data = data[1]
Position=i
While (position >0 AND data[position-1]> current data)
Data[position]=data[position-1]
Position= position-1
End while
Data [position ]= current data
End for
End procedure