What is an enum?
What is a defined set of named constants?
True or false:
The following book holds data on id, charId, and dewey.
union book{
int id;
char charId;
double dewey;
}
What is False?
What is the output of the following code?
f(int x){
return x*x
}
int num = (f(10), 23)
fprintf(num);
What is 23?
What does the -D preprocessor command do?
What is defines a macro variable?
What is the value of RED in both enums?
enum colors{
YELLOW, RED, BLUE = 23
}
enum colors{
YELLOW=24, RED, BLUE=28
}
What is 1 and 25?
What is the biggest issue with scanf() and how do you fix it?
What is buffer overflow and limiting the max number of characters being read in by doing %maxNums?
ex: to read in max of 7 characters, use "%7s"
What does the following code print:
#define COURSE 2
#ifdef COURSE
printf("Course exists.")
#elif COURSE==2
printf("Course 2")
What is "Course exists."?
What does the data memory segment contain?
What is global and static local variables?
How would I declare that a variable called directions (as in N,E,S,W,NW,NE,SE,SW) in the following struct uses the least amount of space in memory possible?
struct maze{
???? direction ???
}
What is unsigned int directions: 3;?
What does perror() do?
What is takes in a string and prints it out to stderr?
What will be the result if I input "Hello World"?
char input_string[10];
printf("Enter a string: ");
scanf("%s", input_string);
What is error/undefined behavior?
What is in the symbol table?
What is functions and global variables that the file provides or uses?
What is the size of the following struct in bytes?
struct room{
unsigned int desks: ? // can be at most 2
unsigned int chairs: ? // can be at most 4
unsigned int bulbs: ? // can be at most 9
}
What is 2, 3, 4?
What is 2 byte?
What is the size of the following book?
union book{
int id;
char charId;
double dewey;
}
What is 8 bytes?
What is the output of the following code:
int a = 2;
a = a << 2;
printf("%d\n",a);
int b = 2;
b = b >> 2;
printf("%d",b);
What is 8 and 0?
Write code to dynamically allocate memory for an integer array with 20 values.
What is int * ptr = (int *) malloc(sizeof(int)*20);