
True/False Questions:
1. Compiler will give error information when invalid subscript is used to refer to one
element in an array. F
2. Two different struct types may not have the same member names. F
3. The strcmp(s1,s2) function has 2 parameters and 3 possible return values. T
4. We can access a dynamically allocated string through a char pointer variable. T
5. A linear search requires an array to be previously sorted. F
6. For a 4000 element array, a binary search would require 14 elements to be tested at most.
F
7. When an array is passed as an argument to a function, the array elements are duplicated
for use in the function. F
8. The typedef keyword is used for defining a new name for an existing type. T
9. The two function headers, int calculate(int a[], int b[]) and int
calculate( int *a, int *b) are equivalent in the sense that both of them can take
two array names as arguments. T
10. The following declaration allocates memory for one struct variable: F
struct student_info {
int level;
char department[10];
}
11. A linked-list structure can contain the same data as an array of structs. T
12. The size of a struct variable can be smaller than the summation of sizes of all its
elements. F
13. Variable-length array can be declared as global variable (outside any function). F
14. Since an array name can be interpreted as a pointer the following code is correct. F
int main(void) {
char pointer[5];
pointer++;
}
15. An array of size 10 will require 9 passes through the array (at the most) using a bubble
sort. T
Multiple Choice Questions:
16. Which of the following is the last character in ALL strings? D
A. '\n '
B. '\s '
C. '\t '
D. '\0 '
E. ' EOF'
17. What format is used to display a string in a printf()? E
A. %c