Resources | Revision Questions | Computer Science
Click on a question to view the answer
Write pseudo-code to implement a function that takes a 1D array of integers and a positive integer 'n' as input. The function should calculate the sum of the first 'n' elements of the array and store the result in a variable called 'sum'. Assume the array is indexed from 0.
Consider an array of integers representing sales figures for a week. Write pseudo-code to determine if the total sales for the week are greater than 1000. The pseudo-code should include a loop to iterate through the array and a conditional statement.
Write pseudo-code to implement a function that takes a 2D array of integers and two positive integers, 'row' and 'col', as input. The function should calculate the product of all the elements in the specified row and store the result in a variable called 'product'. Assume the array is indexed from 0 for both rows and columns.