ASU CSE 240 MIDTERM COMPLETE
ANSWERS GRADED A+
◉ A name given to a storage location
Answer: Variable
◉ Fixed value that the program may not alter during its execution
Answer: Constant
◉ A name given to a storage location that stores an address
Answer: Pointer
◉ In a C program, how many parameters are allowed for main
Answer: C allows empty parameters or two parameters for main
◉ The following code prints "hello" (T/F)
if (2+2+2)
printf("hello")
Answer: True
◉ Primitive data types in C
Answer: float, double, char, int, void
, ◉ These data types are NOT primitive in C
Answer: bool, short, String, long
◉ what is the output of the following code:
#include <stdio.h>
int main() {
int a[5]={3,1,5,20,25};
int i,j,m;
i=*(a+1) - 1;
j=a[1] + 1;
m=a[j] + a[i];
printf("%d,%d,%d",i,j,m);
return 0;
}
Answer: 0, 2, 8
◉ char, unsigned char, signed char and int are all numeric
(integer) types in C (T/F)
Answer: True
◉ in C, when you pass an array as a parameter to a function, what
is actually passed?
Answer: The address of the first element in the array
ANSWERS GRADED A+
◉ A name given to a storage location
Answer: Variable
◉ Fixed value that the program may not alter during its execution
Answer: Constant
◉ A name given to a storage location that stores an address
Answer: Pointer
◉ In a C program, how many parameters are allowed for main
Answer: C allows empty parameters or two parameters for main
◉ The following code prints "hello" (T/F)
if (2+2+2)
printf("hello")
Answer: True
◉ Primitive data types in C
Answer: float, double, char, int, void
, ◉ These data types are NOT primitive in C
Answer: bool, short, String, long
◉ what is the output of the following code:
#include <stdio.h>
int main() {
int a[5]={3,1,5,20,25};
int i,j,m;
i=*(a+1) - 1;
j=a[1] + 1;
m=a[j] + a[i];
printf("%d,%d,%d",i,j,m);
return 0;
}
Answer: 0, 2, 8
◉ char, unsigned char, signed char and int are all numeric
(integer) types in C (T/F)
Answer: True
◉ in C, when you pass an array as a parameter to a function, what
is actually passed?
Answer: The address of the first element in the array