1. Which of the following are illegal C++ identifiers. Justify your answer. a) weight b) 34 c) 8Z d) L1 e) min.value 2. Identify the C++ keywords. a) else b) while c) int_rate d) int 3. Examine the following syntactically valid program. Identify potential problems. #include int main() { int z; int y; cin >> y; z = z + y; cout << endl << z; return 0; } 4. Convert the following into C++ expressions. a) 1 / z(x + y) b) xy + xz - 3 c) x + y/2 d) (x + y)/ 2 e) (a + b)c 5. Examine the following C++ code fragments. Identify and correct potential problems. a) if (x == 3); x++; else x=x + 3; b) if (x == 3) x=x + 3; else; x++; c) if (x == 3) x=x + 3 else x++; d) int x=1, while (x < 10); tot = tot + x; x++; 6. Evaluate the following C++ expressions. Assume a and b have been intialized and have been set to 20 and 9 respectively. a) a%b b) a/b*b c) (a*b)/b d) (a/b)*b 7. Examine the following. Comment on potential problems and suggest an appropriate fix. a) int x = 2.56; b) double x = 3/2; c) double x, y; y = (3/2) * x + 2.1; d) double x, y; y = double(3/2) * x + 2.1; 8. Consider the following function definition. Write the code fragment (say for your main program) that could be used to invoke this function. int testfunc (int a, int b) { return a + b; } 9. Convert the following switch statement to a nested if structure. int sum=0; switch(x) { case 1: sum = sum + 1; cout << "Add one \n"; break; case 2: sum = sum + 2; cout << "Add two \n"; break; case 3: sum = sum + 3; cout << "Add three \n"; break; default: cout << "Ouch \n"; break; } 10. Examine the following code and determine the output. a) int i=1; while (i<=10) { if (i<5 && i != 2) cout << "X"; i++; } b) int i; for (i=1; i<=10; i=i+3) cout << "X"; 11. Rewrite the following as a for loop. a) int i=1; while (i<=5) { cout << "loop\n"; i=i+2; } b) int j=10; while (j>0) { cout << "loop\n"; j--; }