Where: Faculty Room
Time: 5:00
Date: 07-07-14
Direction: answer the following exercises and justify or explain.
1. Mark the following statements as true or false.
a. False
b. False
c. False
d. True
e. True
f. False
g. True
h. True
i. False
j. True
k. False a,b,c,d,e,g,j 2. Which of the following are valid C++ identifiers?
a. myFirstProgram
b. MIX-UP
c. C++Program2
d. quiz7
e. ProgrammingLecture2
f. 1footEquals12Inches
g. Mike'sFirstAttempt
h. Update Grade
i. 4th
j. New_Student b 3. Which of the following is a reserved word in C++?
a. Const
b. include c. Char
d. void
e. int
f. Return
4. What is the difference between a keyword and a user-defined identifier?
Identifiers are names that are given to various program elements, such as variable, function and arrays. C take some reserved word called keyword, they have predefine meaning in C. Identifiers consist of letters and digits. Keyword consist only letter. Identifier’s first character must be a letter. Keyword’s all character is letter. Identifiers Upper and lowercase letter is use. Keywords are all lowercase. Upper and lowercase are not equivalent. Upper and lowercase are also not equivalent. Like: X, sum_5, _weather etc.
But 4th is not identifier cause identifier first character must a letter.
Like: auto, short, long etc.
5. Are the identifiers firstName and FirstName the same?
No
6. Evaluate the following expressions.
a. 25 / 3 8.3
b. 20 - 12 / 4 * 2
c. 32 % 7
d. 3 - 5 % 7
e. 18.0 / 4
f. 28 - 5 / 2.0
g. 17 + 5 % 2 - 3
h. 15.0 + 3.0 * 2.0 / 5.0
7. If x = 5, y = 6, z = 4, and w = 3.5, evaluate each of the following statements, if possible. If it is not possible, state the reason.
a. (x + z) % y
b. (x + y) % w
c. (y + w) % x
d. (x + y) *w
e. (x % y) % z
f. (y % z) % x
g. (x *z) % y
h. ((x *y) *w) *z
8. Given: int num1, num2, newNum; double x, y;
Which of the following assignments are valid? If an assignment