StinerQuiz - Quiz 5 minimum function What should the...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Quiz 5 minimum function What should the missing line be in the following function that is supposed to find and return the minimum value in the array? int getmin( int array[ ], int n ) { int i, min = array[ 0 ]; for ( i = 1; i < n; i++) /* missing ______A_____________ */ min = array[ i ]; return min; } a. if (min > array[ i ]) b. if (min < array[ size ]) c. if (min > array[ n ]) d. if (array [ i ] < array[ i + 1 ]) e. if (array[ i ] < 0) output 2 What is the output of the following code segment? int i, n[10]; for (i = 0; i < 10; i++) n[ i ] = i + 1; for (i = 1; i < 10; i++) printf("%d ", n[ i ]); a. 1 2 3 4 5 6 7 8 9 b. 2 3 4 5 6 7 8 9 10 c. 0 0 0 0 0 0 0 0 0 d. 0 1 2 3 4 5 Ans: B
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
punctuation The position number contained within square brackets after an array name is called the subscript or ______________. a. index b. argument c. prototype d. integral Ans: A storing values in an array After the following code executes, what are the values of the elements in array test? int test[ 4 ] = { 1, 6, 9, 3 }; int m; for (m = 0; m < 4; m++) test[ m ] = test [ 4 - m - 1 ]; a. 3 9 9 3 b. 3 9 6 1 c. 0 0 0 0 d. 1 1 1 1 Ans: A creating an array Which of the following correctly declares an array with 6 floating point values? a. float values[ ]; b. float values[ 5 ]; c. float values[ 6 ]; d. float array values [ 6 ]; Ans:C calling functions with array parameters Which of the following is an appropriate header for a function that takes two integer arrays as parameters and doesn’t return anything? a. int myfun (array1, array2) b. int myfun (int array1[ ], int array2[ ]) c. void myfun (int array1[ ], int array2[ ]) d. void myfun (int array1, int array2) Ans:C starting point The first element of an array has index ___________. a. 0 b. 1 c. n d. -1 Ans: A punctuation The index for an array element is written inside ____________ after the array name. a. square brackets [ ]
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

StinerQuiz - Quiz 5 minimum function What should the...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online