Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using the following function prototype which statement about the argument passed

ID: 3843156 • Letter: U

Question


Using the following function prototype which statement about the argument passed to parameter A is true void F(const int A[], int Cnt); The argument is modified when changes are made to parameter A in function F. The argument passed to parameter A must always have the same number of elements, every time function F is invoked. Changes can not be made to parameter A in function F. Every element of the argument passed to parameter A must be initialized prior to invoking function F. Given the declaration char sentence[15]; and that the data entered from the keyboard is: The game is today what is the value stored into sentence by the statement: cin >> Sentence; The The game is The game is tod None of the above. The Newton-Raphson method algorithm for locating the root of a function is guaranteed to locate a root in a known number of iterations. A. TRUE B. FALSE A better approximation of the area under a curve is by decreasing the trapezoid number used. A.TRUE B.FALSE Which of the following is a disadvantage of the Newton-Raphson method? It converges more rapidly than many other methods. It requires you to be able to determine the derivative of the function which may not be easy to do. It may diverge if the guess is not close enough to the root of the equation. You have to guess many times to get a single root. If a subscript in a C++ program is outside of the declared range for that array an error message specifying that the subscript is out of range will always be generated. A. True b. Flase Assuming the declaration statement char sentence[] = "Breath deeply"; the statement cout

Explanation / Answer

28. Option C is true, we cannot make changes to parameters that has been passed as constant (const is keyword for constant).

29. Option A will be the answer because using cin>>sentence, a character array reads input upto a newline or whitespace. It uses whitespace as end of input.

30. False. We need to repeat Newton-Raphson method again and again until we get the root of the equation, we can not figure out exactly how many iterations needed prior to solving.

31. True.

32. Option D. We have to guess many times to get a single root.

33. The statement is False because C++ does not check for array upper bounds.

34. True. It will print the whole text i.e., "Breath Deeply" because C++ will copy the whole string in the character array sentence.

35. Option D i.e., 10 because array index starts from 0. myArray[1][2] means data stored in second row and third column.

BLUE BOOK:

I.

Program execution steps:

If N < 10 i.e., 2 < 10 then iterate again.

If N < 10 i.e., -1 < 10 then iterate again.

If N < 10 i.e., 10 < 10 which is false, so exit loop.

4. B = B * 2 = 10 * 2 = 20

5. Displaying Output: (N,A,B) = (10,42,20)

Note: cout<< is used to display data.

6. returning 0 and exiting function.

II.

From the loops, we can say that the array has 4 rows and 2 columns because L is iterating from 3 to 1 and array has indices starting from 0 and L has been used as the row index and M is iterating 2 times from 0 to 1 and M has been used as the column index.

Suppose Array B is like:

Output:

6 5

9 81

4 7

Iteration 1 Read N = 5 A = A + N + B = 3 + 5 + 6 = 14 B = B + 1 = 6 + 1 = 7 If N < 10 i.e., 5 < 10 then iterate again.