Covers entire course content based on labs and lecture quizzes. Good luck
Arrays can be passed in two ways; by individual elements or the whole array
True
Elements of an array, themselves individual values of a given data type, are passed by value from calling to the called function
True
The called function cannot identify whether the value it receives comes from an array, an individual variable, or an expression that evaluates to the expected type
True
Individual elements of an array can be passed by address through the use of the address operator
True
The reason that the C language does not pass whole arrays by value is the extra stress it would put on the memory of the computer to make a copy of an array
True
The name of an array is a primary expression whose value is the address of the first element in the array
True
Indexed references to individual elements of an array are simply calculated addresses where the index value is added to the address represented by the name of the array
True
Passing the array name to a function allows changes in the called function to be available back in the calling function after it terminates
True
When passing a whole array to the function the total size of the array is necessary in the function call
False
When passing a whole array to the function the total size of the array is necessary in the definition of the called function
False
It is a course standard to make use of a symbolic/defined constant to represent the size of a statically declared array
True
The conversion code to use for input or output of an array element depends on the data type of the array
True
Variables and loops are commonly used together to generate index values to access the elements of an array
True
Arrays in the C programming language use a one-based index
False
To pass the whole array to a function you need to use the name of the array followed by empty square braces [] in the function call statement
False
All elements of one array can be assigned to another through the use of the assignment operator and the name of each array (example: x = y)
False
If more than one element of an array are passed to a function in a single function call then those elements are passed by address
False
Using the name of an array in the data list of a single printf function will result in the output of all elements of the array
False
All arrays sent to a given user-defined function must be of the same defined size
False
To conserve memory the sorting of data is completed within the array rather than creating a second array
True
Several sort passes will be necessary to sort most data sets
True
From an efficiency point of view, it makes no difference whether the data is ultimately sorted largest to smallest or smallest to largest in an array
True
The bubble sort operates faster when moving the larger values to the highest index than when moving the smaller values towards index zero
False
The number of exchanges that can potentially occur on a given pass of the bubble sort may be greater than 1
True
To sort an array of N elements a N - 1 sort passes are required to guarantee that data always ends in a sorted state
True
The outer loop in each of the bubble sorting algorithm is responsible for ensuring the number of passes required are completed
True
Which is the largest value in the array after the loop?
A) 8
B) 11
C) 7
D) 12
E) None of the above
B
What is the output?
A) x[3] = 2
B) x[3] = 1
C) x[3] = 0
D) x[3] = -1
E) None of the above
C
What is the output?
A) x[6] = 6
B) x[6] = 8
C) x[6] = 4
D) x[6] = 7
E) None of the above
B
Using the name of an array in the data list of a single printf will result in the output of all elements of the array
False
It is a course standard to make use of a symbolic/defined constant to represent the size of a statically declared array
True
What is the value found at index 4 in the array after the code segment has been executed?
A) 7
B) 0
C) 9
D) -1
E) None of the other values provided are correct
E
What is the value found at index 4 in the array after the code segment below has been executed?
A) 11
B) 0
C) 22
D) 10
E) None of the other values provided are correct
A
The name of an array is a primary expression whose value is the address that stores the size of the array
False
Passing the array name to a function allows changes in the called function to be available back in the calling function after it terminates
True
All elements of a given array will make use of the same conversion code for the purpose of input or output
True
Which of the following values has the longest “streak” as defined in the programming problems for both lab 10 and lab 11?
A) 19
B) 23
C) 25
D) 17
C
When passing a whole array to the function the total size of the array is not used in the function call
True
Elements of an array, themselves individual values of a given data type, are passed by value from calling to called function
True
The value of a pointer variable can change during the execution of a program
True
The proper initialization of a pointer variable will include an address on the right side of the assignment operator with the pointer variable on the left
True
Working with an uninitialized pointer variable is a logical error
True
When we need to send more than one value back from a function, we use pointers
True
A user-defined function may be declared to return a pointer value
True
The name of an array is a pointer constant to its first element
True
The name of an integer array can be assigned to an integer pointer variable
True
When a whole array is passed to a function the called function can declare the array using the traditional indexing notation {} or as a simple pointer variable
True
The C programming language provides two options for requesting memory, static allocation and dynamic allocation
True
Static memory allocation requires that the declaration and definition of the memory be fully specified in the source program
True
Dynamic memory allocation uses predefined functions to allocate memory for data while the program is running
True
All of the memory management functions are found in the standard library (stdlib.h)
True
The malloc function allocates a block of memory that contains the number of bytes specified in its parameter
True
The memory allocated as a result of the malloc function is not initialized and we should assume that it will contain unknown values
False
If we need to know the size of any data type the sizeof operator will give us the exact size in bytes
True
The malloc function returns the starting address of the memory allocated
True
The result of the malloc function is assigned to a pointer variable
True
A pointer is a variable that stores a memory address as its value
True
The value stored by a pointer variable may be the location of another variable in the program
True
The data stored in the location to which a pointer is referring can be accessed and manipulated by the pointer
True
An asterisk character (*) is used in the declaration of a pointer variable. This asterisk can be attached to either the data type or the name of the variable (int *x or int* x)
True
A pointer that has been declared on the first line of a function definition will receive its initial value from the calling function
True
Another use of the asterisk character (*) is as the indirection operator
True
The indirection operator will access the value stored at the location to which the pointer references
True
What is the output?
A) a = 3
B) a = 5
C) a = 10
D) a = 11
E) None of the above
D
What is the output?
A) *y = 1
B) *y = 2
C) *y = 5
D) *y = 10
E) None of the above
B
What is the output?
A) result = 6
B) result = 5
C) result = 4
D) result = 3
E) None of the above
C
What is the output? (Assume successful malloc)
A) a[4] = 0.00
B) a[4] = 0.80
C) a[4] = 1.00
D) a[4] = 1.25
E) None of the above
B
Which of the following is the output generated by the code segment above?
A) Value: 4
B) Value: 3
C) Value: 5
D) None of the above
C
The memory allocated as a result of the malloc function is not initialized and we should assume that it will contain unknown values
True
The result of the malloc function is assigned to an array variable
False
Static memory allocation uses predefined functions to allocate memory for data while the program is running
False
If we need to know the size of any data type the sizeof operator will give us the exact size in bytes
True
A pointer that has been declared on the first line of a function definition will receive its initial value from the calling function
True
The proper initialization of a pointer variable will include the pointer variable on the right side of the assignment operator with an address on the left
False
The following declaration of a user-defined function may receive a whole integer array as a parameter: void someFx(int *);
True
The malloc function allocates a block of memory that contains the number of bytes specified in its parameter
True
The indirection operator is used to alter the location to which a pointer refers
False
To conserve memory the sorting of data is completed within the array rather than creating a second array
True
Both the sorted and unsorted lists exist within the same array as the process of sorting data continues
True
The goal of each sorting algorithm is to move data from the unsorted list to the sorted list of an array
True
A sort pass is the process of moving an element from the unsorted list to the sorted list
True
Several sort passes will be necessary to sort most data sets
True
From an efficiency point of view, it makes no difference whether the data is ultimately sorted largest to smallest or smallest to largest in an array
True
The selection sort will identify one value in the unsorted sublist to move and become a part of the sorted sublist
True
The bubble sort operates faster when moving the larger values to the highest index than when moving the smaller values towards index zero
False
The number of exchanges that can potentially occur on a given pass of the bubble sort may be greater than 1
True
The insertion sort takes a value from the unsorted sublist and inserts it into the proper location of the sorted sublist based on the values currently present in the sorted sublist
True
To sort an array of N elements N -1 sort passes are required to guarantee that data always ends in a sorted state
True
The outer loop in each of the three sorting algorithms is responsible for ensuring the number of passes required are completed
True
The selection sorting algorithm will complete one exchange involving at most two elements per pass
True
The bubble sorting algorithm will complete one exchange involving at most two elements per pass
False
The insertion sorting algorithm will complete one exchange involving at most two elements per pass
False
The selection sorting algorithm can only be used to sort data in an ascending order (from smallest to largest)
False
On the final pass through the selection sorting algorithm TWO values are brought over from the unsorted list into the sorted list
True
It is possible that during a single pass of the selection sorting algorithm that the order of the data in the array will be the same as it was after the previous pass
True
The bubble sorting algorithm compares neighboring elements in the unsorted list of the array and swaps their positions when they are not in the desired order
True
The bubble sorting algorithm is optimized to stop the sorting process when the array is detected as being in a sorted state
False
Once the selection sort places a value in the sorted list that value will never move again in the remainder of the passes
True
The insertion sorting algorithm begins with one value in the sorted list before the first pass
True
Searching assumptions for each statement unless specified otherwise:
The data in the array is unique
The amount of data in the array is equal to its capacity
The use of the binary search is always applied to a sorted array
True