You are on page 1of 2

CS 100 – Computational Problem Solving

Fall 2017
Quiz 8

Time: 5 mins Total Marks: 10

Name: ___________________________________________

Roll Number: _______________________ Section: __________

Suppose the array b is defined as 



[10]

double b[] = {2, 3, 5, 7, 1, 11, 13};

Function sum is given below

double sum (double*a, int size)

double total = 0;

double* p = a;

for(int i = 0; i < size;i++)

{ total = total+*p;

p++;

return total;

What are the values of

a. sum(b, 7);
b. sum(b, 4);
c. sum(b + 3, 3);
d. sum(b, 0);
e. sum(NULL, 4);

You might also like