You are on page 1of 2

CS 100 – Computational Problem Solving

Fall 2017
Quiz-6

Time: 10 min Total Marks: 10

Name: ___________________________________________

Roll Number: _______________________ Section: __________

a. Write array function that returns the smallest-element in the array. [7]

Example 1 Example 2

5 36 12 27 2 32 29 28 35 72 31 77 68 95 72 87 74 68 85 35
2 31

int smallest_array(int arr[], int size)

}
b. What is wrong with the following loop? Explain two ways of fixing the error.
[3]

int values[10];


for (int i = 1; i <= 10; i++)

{ 

values[i] = i * i;

} 
 


You might also like