• An array is not ________.
    • a consecutive group of memory locations
    • subscripted by integers
    • pointer-based
    • a dynamic entity
  • Which statement is false?
    • The brackets used to enclose the subscript of an array are not an operator in C
    • To refer to a particular element in an array, we specify the name of the array and the position number of the element in the array.
    • The position number within an array is more formally called a subscript.
    • Array element seven and the seventh element of an array do not mean the same thing. This is a frequent source of off-by-one errors.
  • Which statement would be used to define a 10 element integer array c?
    • Array c = int[ 10 ]
    • c = int[ 10 ];
    • int Array c[ 10 ];
    • int c[ 10 ];
  • Constant variables
    • can be assigned values in executable statements
    • do not have to be initialized when they are defined
    • can be used to specify array sizes, thereby making programs more scalable
    • can be used to specify array sizes, but this makes programs harder to understand
  • Assume string1 is a character array. Which of the following operations does not produce a string?
    • string1[] = "test";
    • string1[] = { 't', 'e', 's', 't', '' };
    • string1[] = { 't', 'e', 's', 't' };
    • string1[] = " ";
  • Suppose a program contains the code for (i = 1; i < = 10; i++) n[ i ] = 0; Which statement about this code must be true?
    • It contains an off-by-one error
    • It contains a syntax error.
    • It is initializing the first 10 elements of an array.
    • It is initializing successive elements of an array.
  • If there are fewer initializers than elements in the array, the remaining elements are __________.
    • deleted
    • ignored
    • initialized to empty
    • initialized to zero
  • The following array definition int n[ 5 ] = { 32, 27, 64, 18, 95, 14 };
    • is correct
    • causes a syntax error because there are only five initializers and six array elements.
    • causes a logic error because there are only five elements but there are six initializers.
    • causes a syntax error because there are six initializers but only five array elements.
  • Which statement is true?
    • A symbolic constant is an identifier that is replaced with replacement text by the C preprocessor after the program is compiled
    • Using symbolic constants to specify array sizes makes programs run faster
    • Preprocessor directives are not C statements.
    • The #define preprocessor directive must end in a semicolon.
  • Which statement is true regarding the statement ++frequency[ responses[ answer ] ];
    • This statement increases the appropriate frequency counter depending on the value of responses[ answer ].
    • This statement increases the appropriate answer counter depending on the value of frequency[ responses ].
    • This statement increases the appropriate responses counter depending on the value of frequency[ answer ].
    • This statement produces a syntax error because subscripts cannot be nested.
  • Which statement is false?
    • C has no built-in bounds checking to prevent the computer from referring to an array element that does not exist.
    • The programmer is responsible for implementing array bounds checking.
    • Referring to an element outside the array bounds is a syntax error.
    • Referring to an element outside the array bounds is a logic error.
  • Which statement is false?
    • The string termination character is called the null character.
    • The string string actually occupies 7 characters in memory.
    • The character representation of the last character in memory of a string is .
    • A character array representing a string should be defined as large as the actual number of characters in the string minus the terminating character; C automatically provides the space for the terminating character.
  • The definition char string1[] = "first"; is equivalent to:
    • character string1[] = { 'f', 'i', 'r', 's', 't', '' };
    • char string1 = { 'f', 'i', 'r', 's', 't', '' };
    • string1[] = { 'f', 'i', 'r', 's', 't' };
    • char string1[] = { 'f', 'i', 'r', 's', 't', '' };
  • Which statement is false?
    • Function scanf reads characters into memory from the keyboard until the first input whitespace character is encountered
    • Function scanf can write beyond the boundary of the array into which input is being placed.
    • Function printf does not care how large the array it is printing is.
    • When using scanf, you must always precede with the & operator the name of each variable into which inputs are being placed
  • Which statement is false?
    • A static local variable exists for the duration of the program.
    • A static local variable is visible only in the control structure in which it is defined.
    • A static local array is not created and destroyed each time the function is entered and exited, respectively.
    • Arrays that are defined static are automatically initialized once at compile time.
  • Which of the following is false about a function being passed an array?
    • it knows the size of the array it was passed
    • it is passed the address of the first element in the array
    • it is able to modify the values stored in the array
    • all of the above are true
  • To pass an array to a function, specify
    • the name of the array without any brackets.
    • the name of the array preceded by an empty pair of brackets.
    • the name of the array followed by a pair of brackets including the size of the array.
    • the name of the array followed by a pair of brackets including a number one less than the size of the array.
  • Which statement is false?
    • C automatically passes arrays to functions using simulated call by reference.
    • When C passes an array to a function, the called function normally can modify the element values in the callers original array.
    • The name of an array is actually the address of the first element of the array.
    • When an array is passed in a function call, the calling function knows precisely where in the called functions memory the passed array is.
  • Calculating which of the following normally requires the data to be sorted first
    • mean
    • median
    • mode
    • total
  • The maximum number of comparisons needed for the binary search of a 2000 element array is
    • 9
    • 15
    • 11
    • 14
  • Which of these is generally thought of as a high-performance technique?
    • bubble sort
    • linear search
    • binary search
    • iteration
  • Which of the following statements is false?
    • The linear searching method works well for small arrays.
    • The linear searching method works well for unsorted arrays
    • The binary search algorithm eliminates from consideration one half of the elements in a sorted array after each comparison.
    • The binary search terminates only when the search key is equal to the middle element of a subarray
  • A sorted array of a million elements can be searched by a binary search in __________ or fewer comparisons.
    • 10
    • 20
    • 30
    • 999,999
  • Which of the following does not initialize all of the array elements to 0?
    • int b[ 2 ][ 2 ]; b[ 0 ][ 0 ] = b[ 0 ][ 1 ] = b[ 1 ][ 0 ] = b[ 1 ][ 1 ] = 0;
    • int b[ 2 ][ 2 ] = { 0 };
    • int b[ 2 ][ 2 ]; for ( int i = 0; i < 2; ++i ) for (int j = 0; j < 2; ++j ) b[ i ][ j ] = 0;
    • all of the above initialize all of their elements to 0.
  • Which initialization is not performed by the following definition? int b[ 2 ][ 2 ] = { { 1 }, { 3, 4 } };
    • b[ 0 ][ 0 ] is set to 1
    • b[ 0 ][ 1 ] is set to 1
    • b[ 1 ][ 0 ] is set to 3
    • b[ 1 ][ 1 ] is set to 4
  • Pointers cannot be used to
    • find the address of a variable in memory.
    • reference values directly.
    • simulate call-by-reference.
    • manipulate dynamic data structures.
  • A non-pointer variable name __________ references a value and a pointer variable name __________ references a value.
    • directly, directly
    • directly, indirectly
    • indirectly, directly
    • indirectly, indirectly
  • The definition int *count;
    • is a syntax error because only pointers can be defined with * notation.
    • is a compile-time error.
    • is a logic error.
    • is a correct definition of integer pointer count.
  • Which statement about pointers is false?
    • They can be defined to point to objects of any data type.
    • The indirection operator * distributes to all comma-separated variable names in a definition.
    • The letters Ptr in a pointer variable name are optional.
    • A pointer may be initialized to 0, NULL or an address
  • The statement y =
    • assigns the address of the variable y to pointer variable yPtr.
    • assigns the address of the variable yPtr to pointer variable y.
    • is a compilation error.
    • is a logic error.
  • The unary * and __________ are complements of one another.
    • /
    • ^
    • &
    • |
  • Which statement is false?
    • All function calls in C pass arguments call-by-value.
    • Call-by-reference enables a called function to modify variables in the calling function.
    • Call-by-value is always more efficient than call-by-reference.
    • In C, programmers use pointers and the indirection operator to simulate call-by-reference.
  • What method should be used to pass an array to a function that does not modify the array and only looks at it using array subscript notation?
    • A constant pointer to constant data.
    • A constant pointer to nonconstant data.
    • A nonconstant pointer to constant data.
    • A nonconstant pointer to constant data.
  • Which of the following gives the number of elements in the array int r[ ]?
    • sizeof ( r )
    • sizeof ( *r )
    • sizeof ( r ) / sizeof ( int )
    • sizeof ( *r ) / sizeof ( int )
  • An expression such as sizeof( arrayName ) / sizeof( double ) might typically be used to determine
    • the size of an array
    • the number of elements in an array
    • the number of elements in half an array
    • the size of an element of an array
  • Given that k is an integer array starting at location 2000, kPtr is a pointer to k, and each integer is stored in 4 bytes of memory, what location does kPtr + 3 point to?
    • 2003
    • 2006
    • 2012
    • 2024
  • Comparing pointers and performing arithmetic on them is meaningless unless
    • they point to members of the same array
    • they point to arrays of the same type
    • they point to arrays of equal size
    • they point to different locations
  • Assuming that t is an array and tPtr is a pointer to that array, what expression refers to the address of element 3?
    • *( tPtr + 3 )
    • . tPtr[ 3 ]
    • &t[ 3 ]
    • &t[ 3 ])
  • If bPtr is assigned b (the name of an array), then array element b[ 3 ] can alternatively be referenced with the pointer expression __________.
    • bPtr + 3
    • b[ bPtr + 3 ]
    • *b [ bPtr + 3 ]
    • *( bPtr + 3)
  • Which statement is false?
    • In C, a string is essentially a pointer to its first character.
    • Arrays may contain pointers.
    • Each entry in an array of strings is actually a pointer to the first character of a string.
    • The size of an array of strings is the sum of the lengths of the strings.
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.