COMP 248 EE – Final Exam: Object-Oriented Programming I Concordia University
Identification:
Last Name:
First Name :
Student ID :
Signature:
Marking scheme (for the instructor’s use only):
QUESTION QUESTION QUESTION QUESTION QUESTION QUESTION TOTAL
1 2 3 4 5 6
12 18 8 13 15 34 100
, Question 1 (8×1.5pts=12pts) Assume the following declarations:
int i = 1; char a =
'd';
boolean isEasy = false; String s =
"Question1";int [] a1 = {1, 0, 2};
int [] a2 = {1, 0, 2};
For each of the following expressions, indicate its value and its type.
Expression Type of the expression Value of the
expression
1.1 'f' >= 'a' && a == 'a'
1.2 a1[i++]
1.3 (double)
1.4 a1.length > 2 ? a1[1]+1 : a1[1+1]
1.5 a1 == a2
1.6 (s.charAt(4) != 'e') || isEasy
1.7 (char)('f'+4)
1.8 a2[a1[2]]
COMP 248 – AA S2012 Final Exam Page 2 of 13
Identification:
Last Name:
First Name :
Student ID :
Signature:
Marking scheme (for the instructor’s use only):
QUESTION QUESTION QUESTION QUESTION QUESTION QUESTION TOTAL
1 2 3 4 5 6
12 18 8 13 15 34 100
, Question 1 (8×1.5pts=12pts) Assume the following declarations:
int i = 1; char a =
'd';
boolean isEasy = false; String s =
"Question1";int [] a1 = {1, 0, 2};
int [] a2 = {1, 0, 2};
For each of the following expressions, indicate its value and its type.
Expression Type of the expression Value of the
expression
1.1 'f' >= 'a' && a == 'a'
1.2 a1[i++]
1.3 (double)
1.4 a1.length > 2 ? a1[1]+1 : a1[1+1]
1.5 a1 == a2
1.6 (s.charAt(4) != 'e') || isEasy
1.7 (char)('f'+4)
1.8 a2[a1[2]]
COMP 248 – AA S2012 Final Exam Page 2 of 13