Enums & Bit-Field
Unions & I/O
Guess the Output
Random!
100

What is an enum?

What is a defined set of named constants?

100

True or false:

The following book holds data on id, charId, and dewey.

union book{

        int id;

       char charId;

       double dewey;

}

What is False?

100

What is the output of the following code?

f(int x){

return x*x

}

int num = (f(10), 23)

fprintf(num);

What is 23?

100

What does the -D preprocessor command do?

What is defines a macro variable?

200

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?

200

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"

200

What does the following code print:

#define COURSE 2

#ifdef COURSE

printf("Course exists.")

#elif COURSE==2

printf("Course 2")

What is "Course exists."?

200

What does the data memory segment contain?

What is global and static local variables?

300

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;?

300

What does perror() do?

What is takes in a string and prints it out to stderr?

300

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?

300

What is in the symbol table?

What is functions and global variables that the file provides or uses?

400

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?

400

What is the size of the following book?

union book{

        int id;

       char charId;

       double dewey;

}

What is 8 bytes?

400

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?

400

Write code to dynamically allocate memory for an integer array with 20 values.

What is int * ptr = (int *) malloc(sizeof(int)*20);

M
e
n
u