Which of the following statements declares an array having 100 elements of type double?
double fred[0...100];
double[100] fred;
double fred[0:100];
double fred[100];
What is the minimum length that a character array can be dimensioned for if it is to hold a string with N characters?
0 (the compiler will automatically allocated as much memory as necessary to hold the string)
N+1
N
N-1
Which of the following statements best describes what an array is?
A collection of variables, all of the same data type, that are stored in a contiguous block of memory and share the same base name.
A collection of variables, possibly of different data types, that all have the same name.
A collection of variables, possibly of different data types, that are stored in a contiguous block of memory and share the same base name.
A collection of pointers to multiple memory locations each of which contains the same type of data.
If sizeof(double) = 8 and sizeof(int) = 2, which of the following declarations requires 80,000 bytes of memory?
double fred[1000][80]
int fred[20000];
double fred[80000];
double fred[100][100];
Arrays are passed to functions
by inference.
be reference.
via the symbol table.
by value.
If fred is declared as a 10x20 array of doubles, which of the following will not print out the value stored in fred[2][3]?
printf("%f", fred[43]);
printf("%f", *fred+43);
printf("%f", fred[2][3]);
printf("%f", *(fred+43));
If fred is declared as a 10x10 array of doubles, which of the following can be used to read a value from the keyboard and store the result in cell fred[2][3]?
scanf("%f", fred[2][3]);
scanf("%lf", fred[2][3]);
scanf("%f", &fred[2][3]);
scanf("%lf", &fred[2][3]);
What is the largest index that can properly be used to access an element in an array declared as having N objects?
0
N
N-1
N+1
Given the statement strcpy(s, "Bob"); what is the stored in cell s[3]?
'B'
'\0'
'b'
'o'
Given: double fred[20][50]; and given that sizeof(double) = 8, if the value of fred is 0x3000, at what memory address is fred[10][4] located?