Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

4QQMN506 Mock Exam questions and solutions

Question 1 [25 marks]

With the aid of a flow-chart describe how Python works in detail?

Question 2 [25 marks]

 

a)           What is the syntax of a simple class definition?   [10 marks]

b)          What are the correct parenthesis brackets for lists, tuples, dictionaries and sets? Explain each of these

built-in data types in detail.  [10 marks]

c)           Which data type would most appropriately be used to represent the following data values? [5 marks]

i.       The number of months in a year (12)

ii.       The area of a circle (eg 32.45)

iii.       The current minimum wage expressed as 10.50

iv.       The approximate age of the universe (12,000,000,000)

v.       Your name

Question 3 [25 marks]

a)    Explain how to display a directory of all of the functions in a given module. [5 marks]

b)   Explain how to display help information on a particular function in a given module. [5 marks]

c)    As a professional you will have to deal with clients, who would expect you to solve their problems with the aid of programming. With the aid of flowcharts clearly describe the “Waterfall” model of software development.

[15 marks]

PART B Practical

Question 4 [25 marks]

The greatest common divisor (GCD) of two positive integers, A and B, is the largest number that can be evenly divided into both of them. Euclid’s algorithm can be used to find the greatest common divisor (GCD) of two positive integers.

You can use this algorithm in the following manner:

 

1.    Compute the remainder of dividing the larger number by the smaller number.

2.    Replace the larger number with the smaller number and the smaller number with the remainder.

3.    Repeat this process until the smaller number is zero.

 

The larger number at this point is the GCD of A and B. Write a program that lets the user enter two integers and then prints each step in the process of using the Euclidean algorithm to find their GCD.

An example of the program input and output is shown below: