Revision on One-Dimensional Array


Wolmer’s Trust High School for Girls



Grade 11                                                        Teacher: Mrs. McCallum-Rodney


Revision on One-Dimensional Arrays


1.      Create a one dimensional array of type integer and size 10.

(a)    Define a void function Fill using input statement to input all elements of the array.

(b)   Define a void function Print to print all elements of the array.

(c)    Define a void function Swap to store the element of the array in reverse.

For example:
If: array contains  10, 9, 8, 7, 6, 5, 4, 3, 2, 1 =>> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

Call the function Print again after swapping its components from the Swap function.


2.      Use a one-dimensional array to solve the following problem: Read in 20 numbers, each of which is between 10 and 100, inclusive. As EACH number is read, print it only if it is not a duplicate of a number already read.


3.      Compute and output the average number in a ten-element array called LIST.  Output the values in LIST as well.


4.      E is n eight-member one-dimensional array.  Its contents are shown as follows:



















(a)    What is the content of E[4]

(b)   Write the subscripted variable name that should be used to refer to the location containing 57.

(c)    Write subscripted variable name that should be used to refer to the Rth position in the array E.

(d)   The value R, in (c) above, must have value within a range between what two numbers?


5.      Write a C program to calculate the test score for a student.

a) Write a function to accept the questions and answers for 10 questions, using 2 arrays.
b) Write a function to give test to students.  Show question and then ask for answer. Compare student answers with correct answer from array.  At the end of the test show the following output:

Name of Student xxxxxxxxx
Correct Answers xx
Wrong Answers xx
Percent of correct Answer = xx%


6.      Write a program to calculate commission report for EZ-Tech corporation. They have five sales people. Your program must ask input for 3 sales for each sales person. Add the sales for each sales person and calculate commission. Commission is given by using the following information

a) For first $1000.00 commission rate is 5%
b) For next $2500.00 commission rate is 7%
c) Over $2500.00 commission rate is 9%
Use array

Your output should look like

Commission Report

Name         Sale1   Sale2   Sale3   Total    Commission

Xxxxx       xxxxx xxxx    xxxx    xxxxx xxxx





Classwork / discussion - Monday Sept 10, 2012 

CW on arrays.txt CW on arrays.txt
Size : 1.251 Kb
Type : txt
Make a Free Website with Yola.