OSU CSE 2221 Final Exam Software Components
Comprehensive COMPLETE EXAM LATEST VERSION
2026-2027 QUESTIONS AND ANSWERS
What is the value of x after this statement?
double x = ;
a. 0.0
b. 0.5
c. 1.0
d. 2.0 - answer>>a
Consider the following method and the client code. What is true after the client code executes?
private static int m(int x, int y) {
y = x; x = 0; return y;
}
int num1 = 4, num 2 = 9;
num2 = m (num1, num2);
a. num1 = 0, num2 = 4
b. num1 = 0, num2 = 9
c. num1 = 4, num2 = 4
d. num1 = 4, num2 = 9 - answer>>c
,Consider the following array declaration and initialization. What is the value of the expression
(a[1] + a[3])?
String [ ] a = {"A", "B", "C", "D" };
a. "AC"
b. "BD"
c. "ABC"
d. "CD" - answer>>b
Suppose you are trying to get a good estimate of √x using Newton Iteration, as described in
project 2. The instructions are to continue iterating until "estimate of square root of x is within
relative error 0.01%". Which while loop condition would be appropriate?
a. while(Math.abs(r - x) >= 0.001) { ... }
b. while(Math.abs(r - x) / x >= 0.001) { ... }
c. while(Math.abs(r r - x) / x != 0.001) { ... }
d. while(Math.abs(r r - x) / x > 0.001) { ... } - answer>>d
In design-by-contract, when the precondition (requires clause) of a method is not satisfied the
implementer of a method is obligated to:
a. stop the program and report an error
b. generate a default result that will let the client know of their error
c. make sure the postcondition (ensures clause) is satisfied
d. none of the above - answer>>d
What is the value of k after this code completes?
, int i = 0, j = 0, k = 0;
while (i < 3) { i++;
j = 0; while (j < 3) {
j++; k = k + i + j;
}}
a. 36
b. 54
c. 9
d. 6 - answer>>a
For this line of XML, what is the attribute name?
<parts dist = "even" > 5 </parts>
a. parts
b. dist
c. even
d. 5 - answer>>b
Which is true of an XML tree?
a. only tag nodes have a label property
b. every node has an attribute property
c. only tag nodes may have children
d. only non-tag nodes can be leaf nodes
e. none of the above - answer>>c
Which is NOT a property of an RSS 2.0 feed?
Comprehensive COMPLETE EXAM LATEST VERSION
2026-2027 QUESTIONS AND ANSWERS
What is the value of x after this statement?
double x = ;
a. 0.0
b. 0.5
c. 1.0
d. 2.0 - answer>>a
Consider the following method and the client code. What is true after the client code executes?
private static int m(int x, int y) {
y = x; x = 0; return y;
}
int num1 = 4, num 2 = 9;
num2 = m (num1, num2);
a. num1 = 0, num2 = 4
b. num1 = 0, num2 = 9
c. num1 = 4, num2 = 4
d. num1 = 4, num2 = 9 - answer>>c
,Consider the following array declaration and initialization. What is the value of the expression
(a[1] + a[3])?
String [ ] a = {"A", "B", "C", "D" };
a. "AC"
b. "BD"
c. "ABC"
d. "CD" - answer>>b
Suppose you are trying to get a good estimate of √x using Newton Iteration, as described in
project 2. The instructions are to continue iterating until "estimate of square root of x is within
relative error 0.01%". Which while loop condition would be appropriate?
a. while(Math.abs(r - x) >= 0.001) { ... }
b. while(Math.abs(r - x) / x >= 0.001) { ... }
c. while(Math.abs(r r - x) / x != 0.001) { ... }
d. while(Math.abs(r r - x) / x > 0.001) { ... } - answer>>d
In design-by-contract, when the precondition (requires clause) of a method is not satisfied the
implementer of a method is obligated to:
a. stop the program and report an error
b. generate a default result that will let the client know of their error
c. make sure the postcondition (ensures clause) is satisfied
d. none of the above - answer>>d
What is the value of k after this code completes?
, int i = 0, j = 0, k = 0;
while (i < 3) { i++;
j = 0; while (j < 3) {
j++; k = k + i + j;
}}
a. 36
b. 54
c. 9
d. 6 - answer>>a
For this line of XML, what is the attribute name?
<parts dist = "even" > 5 </parts>
a. parts
b. dist
c. even
d. 5 - answer>>b
Which is true of an XML tree?
a. only tag nodes have a label property
b. every node has an attribute property
c. only tag nodes may have children
d. only non-tag nodes can be leaf nodes
e. none of the above - answer>>c
Which is NOT a property of an RSS 2.0 feed?