CISC181 Introduction to Computer Science Dr. McCoy Lecture 13 Clicker Questions October 13, 2009Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 101CISC181 Introduction to Computer ScienceDr. McCoyLecture 13Clicker QuestionsOctober 13, 2009Assuming that int a has a value of 3 and that integer array b has 7 elements, what is the correct way to assign the value of the sum of 3 and the third element, to the fifth element of the array?(a) b[ a + 1 ] = b[ a ] + 3;(b) b[ a + 1 ] = b[ a - 1 ] + 3;(c) b[ a ] + 1 = b[ a + 3];(d) b[ a + 2 ] = b[ a ] + 3;2Which statement would be used to declare a 10 element integer array c?(a) Array c = int[ 10 ];(b) c = int[ 10 ];(c) int Array c[ 10 ];(d) int c[ 10 ];3Which of the following is not a correct way to initialize an array?(a) int n[ 5 ] = { 0, 7, 0, 3, 8, 2 };(b) int n[] = { 0, 7, 0, 3, 8, 2 };(c) int n[ 5 ] = { 7 };(d) int n[ 5 ] = { 9, 1, 9 };ANS: (a)4Referencing elements outside the array bounds(a) can result in changes to the value of an unrelated variable(b) is impossible because C++ checks to make sure it does not happen(c) is a syntax error(d) enlarges the size of the array5Unless otherwise specified, entire arrays are passed __________ and individualarray elements are passed __________.(a) call-by-value, call-by-reference(b) call-by-reference, call-by-value(c) call-by-value, call-by-value(d) call-by-reference, call-by-reference6Which of the following is false about a function being passed an array?(a) it knows the size of the array it was passed(b) it is passed the address of the first element in the array(c) it is able to modify the values stored in the array(d) the array name is passed as an argument7A double subscripted array element declared as a[3][5]has how many elements?(a) 15(b) 14(c) 16(d) 88Given the following declaration, what is the value of b[ 1 ][ 0 ]?int b[ 2 ][ 2 ] = { { 1 }, { 3 , 4 } };(a) 0(b) 1(c) 3(d) this is not a valid declaration9Which of the following does not initialize all of its elements to 0?(a) int b[ 2 ][ 2 ];b[ 0 ][ 0 ] = b[ 0 ][ 1 ] = b[ 1 ][ 0 ] = b[ 1 ][ 1 ] = 0;(b) int b[ 2 ][ 2 ] = { 0 };(c) int b[ 2 ][ 2 ]; for ( int i = 0; i < 2; i++ ) for (int j = 0; j < 2; j++ ) b[ i ][ j ] = 0;(d) all of the above initialize all of their elements to
View Full Document