Question: Exercise 1 : Answer the following questions : (a) What is a function? (b) What does the Read instruction mean (variable1, variable2, ...) (c) What
Exercise 1 :
Answer the following questions :
(a) What is a function?
(b) What does the Read instruction mean (variable1, variable2, ...)
(c) What is time complexity?
Exercise 2 *:
Develop a procedure that provides the grade of a student (passable, fairly good, good or very good) according to his score on a 20-point exam. The grade obtained by the student is the only parameter of the procedure.
- If the student has a mark between 10 and 11.99, the grade is Fair.
- If the student has a mark between 12 and 13.99, the grade is Fairly Good.
- If the student has a mark between 14 and 15.99, the grade is Good.
- If the student has a mark of 16 and above, the grade is Very Good.
Exercise 3 *:
Develop an algorithm that allows you to read an integer X, which calculates the sum of the prime X integers which precede x and which display this sum
Exercise 4 *:
Let be the following recursive function:
1. TestRecursive function (Tab: Array, x: integer): integer
2. Variables
3. Value: integer
4. Start
5. If (x == 0) then
6. Value 0
7. Otherwise
8. Value RecursiveTest (Tab, x-1) + Tab [x]
9. End
10. Return (Value)
11.End
(a) What does this function do?
(b) Transform this recursive function into an iterative function.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
