Download 15 Questions of Programming Concepts - Practice Exam | CSCI 261 and more Exams Computer Science in PDF only on Docsity! CSCI261 Lecture Questions Nitty Gritty C++ This worksheet is for your use during and after lecture. It will not be collected or graded, but I think you will find it a useful tool as you learn C++ and study for the exams. Explain all false answers for the “True or False” questions; in general, show enough work and provide enough explanation so that this sheet is a useful pre-exam review. I will be happy to review your answers with you during office-hours, via Email, or instant messaging. 1. State whether each variable declaration is valid C++; if it is not, explain why. (a) double O2pct; (b) integer X; (c) let a_crowd = 3; (d) bool switch = false; (e) const E = exp(1); (f) double oxygen%; (g) const int ROWS(1024); (h) bool register; (i) int 2TooMany = 3; (j) PI const double = 3.14; 2. Consider the variable declaration: int X; Does X have a value immediately after this line of code is executed by the CPU? What term do programmers use to describe the value of X? Can you predict the value of X? 3. Explain the difference between binary operators and unary operators. 4. What is the C++ value for 3 + 12 % 5 * 5? Explain your reasoning. 5. In the context of C++ operators, what does the word precedence mean? Which operator has the highest prece- dence, which has the lowest precedence? 6. Calculate the final values for the variables x, y, and z given their initial values and the C++ statements operating on them. Pre Execution Post x y z C++ statement x y z 1 2 3 x = y++ - z; 1 2 3 y = --z - x++; 1 2 3 y = z-- - ++x; 1 2 3 x = y = z; 1 2 3 z = y = x; 1 2 3 z *= y - ++x; 1 2 3 z += y - x++;