1) Figure out what the expression and/or statements evaluate to or print. 2) Short answer or fill-in the blank about C. Note - they're a bit mixed up in this file ... 1a) char c[10] = "jklmno"; for(int i=0; i<26; i++){ c[i] += 2; } printf("%s\n", c); answer: 2a) What is the difference between a signed integer and unsigned integer? Specifically, what is the difference between int x; unsigned int y; answer: 1b) int i = 64; i = i << 1; i = i | 0x12; i = i >> 3; printf("%i\n", i); Answer: 2b) What keyword identifies a loop that keeps track of a variable for you? Answer: for ** Note - this question is both too vague and too easy. 1c) int num = 123456; int i; for(i=0;i<3;i++) num1 = num1 + (1 << i); printf("%d",num1); what is the value of num1? answer: 2c) (True/False) A variable of an enumerated (enum) type only takes one value? Answer: True ** Note: question is vague and could be misunderstood. 1d) int a = 0x00; a |= 0xab; a &= 0x0f; a = ~a; a >> 2; printf("%d %x\n", a, a); 2d) What is struct used for? Struct is used for collecting variables that are related to create a new type. ** Note - too vague, it is better to ask something specific where it is easy to determine if you are correct or not. 1e) int main() int x=50; x = x%3+5; x = x>>1; printf("%d\n", x); Answer: 2e) How many bytes does a long double take in memory when using gcc on CS? Answer: (use sizeof) 1f) int i; char c[10] = "abcdef"; for (i = 0; c[i]; i++) c[i] += c[i] & 0x1; printf("%s\n", c); Answer: 1g) int i; char c[100] = "HeLLoWoRLD"; for (i = 0; c[i]; i++) printf("c[%d] '%c' -> %s\n", i, c[i], (c[i] & 32) ? "false":"true"); Answer: 1h). char c = 'a'; c += 4 + ('X'-'W'); c -= 2*2-1; c -= ('a'-'A'); printf("%c\n", c); printf("%d\n", c); answer: 2f. What happens when you use return in a function? Answer: The function is terminated and the value is returned. ** Note - too easy? 1i) int num = 70%8*2+4%3; 2g) What is the storage size and value range of an unsigned char on CS with gcc? ** Note - very nice, specific enough to easily tell if someone knows this or not based on their answer 1j) int main(int argc, char *argv[]){ char c = 'c'; c += c>>2; for(int i=1; i<4;i++) c = ++c | i; printf("%i\n", c); //prints 127 } 2h) What does the variable argc contain? Answer: the number of command lines arguments 1k) #include #include int main(int argc,char *argv[]){ float number=10; for(int i=0; i<=number; i++){ printf("%.0lf x %d = %.0lf\n", number, i, i*number); } printf("------------------\n"); for (int k=1; k<=number; k++){ printf("%.0lf / %d = %.2lf\n", number, k, number/k); } return 0; } 2i) What is a SWITCH statement in C? Answer: ** Note -- too vague