Six of C's primitive types
What are char
, short
, int
, long
, float
, double
?
The operators used to get the memory address of a variable and to get the value at a memory address
What are &
and *
?
This program segment stores uninitialized global variables
What is the BSS segment?
The format specifier to print a string
What is %s
?
Line that defines a constant named SIZE with the value 16
What is #define SIZE 16
?
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)
?
The process of deciding when programs get to run on the CPU
What is scheduling?
The output of
char x[] = "Hello MOPS"; x[1] = 'a'; x[5] = 0; printf("%s\n", x);
What is Hallo
?
Result of the following program:
int x = 5; int y = x++; return y - x;
What is 1
?
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
?
The three jobs of an operating system
What are protection, abstraction, and resource management?
The line needed to read an integer into the variable x
What is scanf("%d\n", &x);
?
The output of this program:
#define FIVE 2+3 #define ALPHA FIVE*5 #define BETA 4/ALPHA printf("%d\n", BETA);
What is 17
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
?
The structure that maps virtual memory addresses to physical addresses
What is a page table?
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'