C Syntax
Pointers
OS & Memory
I/O and strings
100

Six of C's primitive types

What are char, short, int, long, float, double?

100

The operators used to get the memory address of a variable and to get the value at a memory address

What are & and *?

100

This program segment stores uninitialized global variables

What is the BSS segment?

100

The format specifier to print a string

What is %s?

200

Line that defines a constant named SIZE with the value 16

What is #define SIZE 16?

200

 int arr[5] = {2, 4, 6, 8, 10}; 

An expression equivalent to the following (not using the index operator):

 arr[3] 

What is *(arr+3)?

200

The process of deciding when programs get to run on the CPU

What is scheduling?

200

The output of

char x[] = "Hello MOPS";
x[1] = 'a';
x[5] = 0;
printf("%s\n", x);

What is Hallo?

300

Result of the following program:

int x = 5;
int y = x++;
return y - x;

What is 1?

300

The output of this program:

char *a[] = {"Mechanics", "of", "Programming", "S"};
char **b[] = {a, a+2};
b[0]++;
printf("%s\n", b[0][1]);

What is Programming?

300

The three jobs of an operating system

What are protection, abstraction, and resource management?

300

The line needed to read an integer into the variable x

What is scanf("%d\n", &x);?

400

The output of this program:

#define  FIVE    2+3
#define  ALPHA   FIVE*5
#define  BETA    4/ALPHA
printf("%d\n", BETA);

What is 17

400

The output of this program:

void foo(int *x, int *y, int *z) {
	*x += *y * *z;
}

int main(void) {
	int n = 2;
	int k = 3;
	foo(&n, &k, &k);
	foo(&k, &n, &k);
	printf("%d, %d\n", n, k);
}

What is 11, 36?

400

The structure that maps virtual memory addresses to physical addresses

What is a page table?

400

The bug in this program to find the length of a string:

int string_len(char *s) {
	int i = 0;
	while (s[i] != '0') {
		i++;
	}
	return i;
}

What is comparing s[i] with '0' instead of 0 (or '\0'

M
e
n
u