
CSC3405/CSC3605
Review for Final
Write a recursive method to print a string backwards.
Write an iterative method to print a string backwards.
Write a recursive method to compute the factorial of a number.
Write an iterative method to compute the factorial of a number.
1) Write a function that takes 2 arrays of 10 integers as arguments, and returns true if all of the
elements in the first array match (in order) all of the elements of the second array.
2) Write a function verify that takes an array of integers and the size of the array. The
function returns true if the first element of the array is equal to the sum of the rest of the
elements, false if not.
3) Write a method(function) that reads integers from the input until the first non-zero integer
is found. Return this number.
4) Write a method (function) that takes an array of integers, the size of the array, and an
integer skip as parameters. The method returns the sum of all numbers in the array,
skipping the first skip elements.
5) Write a program that reads an account balance (at the start of the month), the total value
of deposits (for the month), the total value of withdrawals (for the month), and displays
both the final balance and the net change to the balance.
6) Write a program that reads integers count and marker from the input. It then reads count
integers. Of these integers, the program prints the first integer after any time marker
appears. For example, input of "8 0 0 2 3 0 0 -3 0 10" should result in output of "2 0 -3 10".
Notice that in this input, count = 8 and marker = 0 and there are 8 integers following the
input of 8 and 0.
7) Write a function shuffle that takes an array of 20 integers and then shuffles the integers
using the following algorithm: For each element X of the array, generate a random number
N between 0 and 19, inclusive. Swap X with the element that corresponds to N.
1