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