Reference no: EM133087638
ITECH1400 Foundations of Programming
Question 1.
In this course six steps to problem solving were introduced. In your own words, state the sixth step and describe how it might be used in problem solving.
Question 2
The two software development methodologies discussed were the waterfall method and the more iterative agile development methodology. a) Briefly describe each model including a diagram. b) What are the main differences between the two models?
Question 3.
To write any procedural program only three programming structures are needed - Sequence, Selection & Repetition - was demonstrated by Boehm & Jacopini in 1966.
Draw diagrams which illustrate these three structures.
Sequence (code reading order): Code is read from left to right and top to bottom of the page
Selection (branching): Choices are made depending on certain conditions Repetition (loops): We can repeat a piece of code as many times as we wish
Question 4.
Re-write this for loop code fragment using only a while loop.
Question 5.
Give an example of one exception and the reason why it is raised. What happens if we don't use exception handling and the program raises an exception?
Question 6.
Explain what software libraries are and why we may decide to use them when developing our own programs. In your answer name two examples of specific software libraries.
Question 7.
Sort the following series of values into ascending order using the Selection Sort algorithm. Write out the complete row of numbers each time two values change places and circle the two values that have changed places.
Question 8.
List and briefly describe five (5) reasons why testing is important and why we write unit tests.
Question 9.
In the context of programming, briefly define the following terms: Performance, Efficiency and Optimisation.
Question 10.
Write what will be printed when this code is executed:
Question 11.
Draw a class diagram for a Person with four (4) attributes and four (4) methods. Include private and public attributes.
Question 12.
Write what will be printed when this code is executed:
def max(num1, num2):
if num1 > num2: result = num1
else:
result = num2
return result
def main():
i = 5
j = 2
k = max(i,j)
print("The larger number of", i, "and", j, "is", k) main()