Grade 12 - Comp. / Algorithms 12 exercises (100% corrected)

a
Fonctionterme(n)Pouride1ànU×U120FinPourRenvoyerUFonctionterme(n)Pouride1ànU115U×U120FinPourRenvoyerUFonctionterme(n)U115Pouride1ànU×U120FinPourRenvoyerUAlgorithme1Algorithme2Algorithme3 Fonctionterme1(A)n0U50000TantqueUAnU·U3000FinTantqueRenvoyernFonctionterme2(n)U50000Pouriallantde1ànU·U3000FinTantqueRenvoyerUFonctionterme3(n)U50000Pouriallantde0ànU·U3000FinTantqueRenvoyerU Fonctionsuite(n)U5Pouride0ànU12×FinPourRenvoyerUFonctionsuite(n)Pouride0ànU5U12×FinPourRenvoyerUFonctionsuite(n)U5Pouride0ànU12×RenvoyerUFinPourAlgorithme1Algorithme2Algorithme3 1. Repetitive structure E.6145 Consider the sequence u n defined for any natural number: u 0 = 115 ; u n +1 = 0.4 · u n + 120 Consider the three algorithm parts below, each presenting a function terme() taking an integer n greater than or equal to 1 for argument : Explain why the functions term() of the first two algorithms, called with the integer n , do not return the term of the se-quence u n of rank n . E.6147 Consider the sequence u n de-fined for any natural number: u 0 = 50000 ; u n +1 = 0.95 · u n + 3000 for any n N Consider the three parts of algorithms each presenting a func-tion f : Which of the above functions, by executing step by step and observing the successive values taken by the variable U , to ob-tain all the values of the terms in the sequence u n for ranks from 0 to n . E.6148 Consider the sequence u n de-fined for all natural numbers : u 0 = 5 ; u n +1 = 1 2 · u n + 1 for all n N 1 We want to write a function in an algorithm that takes a non-zero natural number n as an argument and returns the value of the term of rank n of the sequence u n Only one of the following three functions is suitable. Indicate which one and justify why the other two cannot give the expected result. 2 By calling the function f with the argument 9 , the vari-able U is successively assigned the following values : 5 3.5 2.75 2.375 2.185 2.0938 2.0469 2.0234 2.0117 2.0059 What conjecture can be made about the direction of vari-ation of this sequence? 2. Repetitive structure: study of the stop condition E.6150 We study the evolution of the population of a town, since 1 er January 2008 . The population of this town from 1 er January 2008 is consid-ered by the function f defined on 0 ; + by: f ( x ) = 3 1 + 2e 0.05 x where x denotes the number of years since 1 er January 2008 and f ( x ) the number of inhabitants in hundreds of thousands. It is assumed that f is increasing on 0 ; + Consider the following algorithm: X 0 As long as f(X) 2 X X+1 End As long as If we run this algorithm, then at the end of execution the variable X will have the value 28 . Interpret this result in the context of this problem. 3. Repetitive structure: studying the threshold of a sequence E.6146 Consider the sequence a n de-fined by: a 0 = 2500 ; a n +1 = 0.8 · a n + 400 1 Assume that the general term of the sequence a n can be expressed as : a n = 500 × 0.8 n + 2000 Deduce the limit of the sequence a n . 2 We propose the following algorithm: N 0 A 2500 As long as A 2000>50 A A × 0.8+400 https://chingmath.fr chapExoCorrec/6145 sacados/6145 Fonctionterme(n)Pouride1ànU×U120FinPourRenvoyerUFonctionterme(n)Pouride1ànU115U×U120FinPourRenvoyerUFonctionterme(n)U115Pouride1ànU×U120FinPourRenvoyerUAlgorithme1Algorithme2Algorithme3 chapExoCorrec/6147 sacados/6147 Fonctionterme1(A)n0U50000TantqueUAnU·U3000FinTantqueRenvoyernFonctionterme2(n)U50000Pouriallantde1ànU·U3000FinTantqueRenvoyerUFonctionterme3(n)U50000Pouriallantde0ànU·U3000FinTantqueRenvoyerU chapExoCorrec/6148 sacados/6148 Fonctionsuite(n)U5Pouride0ànU12×FinPourRenvoyerUFonctionsuite(n)Pouride0ànU5U12×FinPourRenvoyerUFonctionsuite(n)U5Pouride0ànU12×RenvoyerUFinPourAlgorithme1Algorithme2Algorithme3 chapExoCorrec/6150 sacados/6150 Extrait d'Asie Juin 2015 chapExoCorrec/6146 sacados/6146 Extrait du bac du Liban Juin 2014
Valeur deuValeur denu>4500(vrai/faux)57000vraivraifaux N N+1 End As long as a Explain what the value of variable N represents at the end of this algorithm. b Using the calculator, determine the value of variable N at the end of this algorithm and interpret the result. E.7007 Consider the sequence u n is defined by u 0 =5700 and for any natural number n by: u n +1 =1.015 · u n 300 Consider the following algorithm: u 5 700 n 0 As long as u>4500 u 1; 015 × u 300 n n+1 End As long as 1 Copy and complete the table below, adding as many columns as necessary between the second and last columns. 2 At the end of the algorithm’s execution, what is the value of the variable n ? Interpret this value in the context of the exercise. E.7017 Consider the following algorithm: U 4 N 0 As long as U<40 U 0; 92 × U+8 N N+1 End As long as 1 Copy the following table and complete it, adding as many columns as necessary. The values of U will be rounded to the tenth. Value of U 4 . . . . . . Value of N 0 . . . . . . Condition U < 40 vraie . . . . . . 2 Give the value of the variable N at the end of the execu-tion of this algorithm. E.7855 Maya has 20 e in her piggy bank on June 1 er 2018 . From that date onwards, each month she spends a quarter of the contents of her piggy bank and then puts 20 e more into it. For any natural number n , let u n be the amount of money in Maya’s piggy bank at the end of the n th month. We have : u 0 =20 . We assume that for any natural number n : u n +1 =0.75 · u n +20 We consider the following algorithm: U 20 N 0 As long as U<70 U 0.75 × U+20 N N+1 End While Display N 1 Copy and complete the table below, which outlines the different steps involved in executing the algorithm. Add as many columns as necessary in place of the dotted one. Round the results to two decimal places. . . . . . . . . . Value of U 20 . . . . . . . . . Value of N 0 . . . . . . . . . Condition U < 70 true true false . . . . . . . . . 2 What value is displayed at the end of the execution of this algorithm? Interpret this value in the context of the exercise. 4. Repetitive structure: finding the stopping condition E.6149 We consider the sequence u n defined by: u 0 = 20 ; u n +1 = 0.92 · u n + 3 1 On admits that the general term of the sequence u n admits for expression : u n = 17.5 × 0.92 n + 37.5 Deduce the limit of the sequence u n . 2 a Recopy and complete the following algorithm so that at the end of its execution the variable N represents the rank from which the terms of the sequence will have a value greater than or equal to 25 . U 20 N 0 As long as ... U 0.92 × U + 3 N N + 1 End As long as que b Using the calculator, determine the rank from which the terms of the sequence u n will for the first time be greater than or equal to 25 . https://chingmath.fr chapExoCorrec/7007 sacados/7007 Valeur deuValeur denu>4500(vrai/faux)57000vraivraifaux chapExoCorrec/7017 sacados/7017 chapExoCorrec/7855 sacados/7855 Extrait Liban Mai 2018 chapExoCorrec/6149 sacados/6149
E.6151 1 Determine by calculation the smallest value of the natu-ral number n such that : 250 + 1250 × 0.8 n < 500 2 We consider the sequence u n defined by: u 0 = 1500 ; u n +1 = 0.8 · u n + 50 for all n N Complete the algorithm below so that at the end of its execution, the variable u has the value obtained in the previous question : u 1500 n 0 While ...... do u ...... n ...... End While E.7856 Consider the sequence u n de-fined by u 0 =65 and for any natural number n : u n +1 = 0.8 · u n +18 We admit that : u n =90 25 × 0.8 n Consider the algorithm below : line 1 u 65 line 2 n 0 que ...... line 4 n n+1 line 5 u 0; 8 × u+18 line 6 Fin As long as 1 Copy and complete the line 3 of this algorithm so that it determines the smallest natural number n such that : u n 85 . 2 What is the value of the variable n at the end of the algorithm’s execution? 3 Calculate the result of the previous question by solving the inequation u n 85 E.7854 A company offers annual photo-copier maintenance contracts. The director of this company notes that, each year, 14 % additional contracts are signed and 7 are terminated. In 2017 , the company had 120 contracts. We model the situation with a sequence u n where u n is the number of contracts signed in year 2017+ n . Thus, we have : u 0 =120 1 Justify that, for any natural number n , we have : u n +1 = 1.14 · u n 7 2 Given its current structural capacity, the company can only take on 190 contracts. Beyond that, the company will have to hire more staff. We therefore want to know in which year the company will need to hire. To do this, we use the following algorithm: n 0 u 120 As long as ...... n n+1 ......... End As long as Display 2017+n a Copy and complete the algorithm above. b What is the year displayed at the end of the algorithm? Interpret this value in the context of the exercise. https://chingmath.fr chapExoCorrec/6151 sacados/6151 chapExoCorrec/7856 sacados/7856 chapExoCorrec/7854 sacados/7854