OSU CSE 2221 (Software I- Software Components)
final open-ended (OE) COMPLETE EXAM LATEST
VERSION 2026-2027 QUESTIONS AND 100% Verified
ANSWERS
Which is an appropriate method signature for a method p that will print a square of
dollar signs ($) with a given output stream, and a given size of the square?
*a.* private static SimpleWriter p(int size, "$") { ... }
*b.* private static void p(out, size) { ... }
*c.* private static int p(SimpleWriter out, int size) { ... }
*d.* private static void p(SimpleWriter out, int size) { ... }
*e.* none of the above - answer>>>d
An XMLTree created from an RSS 2.0 feed will have which of these properties?
*a.* the root is a node with the <channel> tag
*b.* child 0 of the <channel> tag node must be a <title> tag node
*c.* no particular order is required among the children of an <item> tag node
*d.* at least one child of the <item> tag node must be a <title> tag node
*e.* none of the above - answer>>>c
Which of the following statements about this diagram is true?
(interface I1)
^ extends
(interface I2)
,^ implements
[class C]
*a.* C is a description of what I2 does, not of how it does it
*b.* C implements the behavior/functionality provided in I1
*c.* I1 inherits all the methods declared in I2
*d.* I2 is the implementer view and I1 is the client view
*e.* none of the above - answer>>>b
Assume n is an int variable. Which Java expression is true exactly when n is an odd
number, i.e., not divisible by 2, and should be used to check for this situation? (hint: don't
forget negative numbers!)
*a.* n % 2 == 1
*b.* n % 2 != 1
*c.* n % 2 == 0
*d.* n % 2 != 0
*e.* none of the above - answer>>>d
Given the following code, which statement is true?
SimpleWriter out = new SimpleWriter1L( );
NaturalNumber n1 = new NaturalNumber1L(5);
NaturalNumber n2 = n1; n2.decrement( );
out.println("n1 = " + n1 + ", n2 = " + n2);
*a.* will output "n1 = 4, n2 = 4"
, *b.* will output "n1 = 5, n2 = 4"
*c.* will not compile
*d.* will result in a run-time error
*e.* none of the above - answer>>>a
What is value of num after the following loop?
NaturalNumber n = new NaturalNumber2(25);
NaturalNumber hund = new NaturalNumber2(100);
NaturalNumber num = n; while
(n.compareTo(hund) < 0) {
n.multiply(new NaturalNumber2(2));
if (n.compareTo(num) > 0) { num = n;
}
}
*a.* 25 *b.*
50
*c.* 100
*d.* 200
*e.* none of the above - answer>>>c
Consider the following method contract and client code:
/**
* Adds n to this.
final open-ended (OE) COMPLETE EXAM LATEST
VERSION 2026-2027 QUESTIONS AND 100% Verified
ANSWERS
Which is an appropriate method signature for a method p that will print a square of
dollar signs ($) with a given output stream, and a given size of the square?
*a.* private static SimpleWriter p(int size, "$") { ... }
*b.* private static void p(out, size) { ... }
*c.* private static int p(SimpleWriter out, int size) { ... }
*d.* private static void p(SimpleWriter out, int size) { ... }
*e.* none of the above - answer>>>d
An XMLTree created from an RSS 2.0 feed will have which of these properties?
*a.* the root is a node with the <channel> tag
*b.* child 0 of the <channel> tag node must be a <title> tag node
*c.* no particular order is required among the children of an <item> tag node
*d.* at least one child of the <item> tag node must be a <title> tag node
*e.* none of the above - answer>>>c
Which of the following statements about this diagram is true?
(interface I1)
^ extends
(interface I2)
,^ implements
[class C]
*a.* C is a description of what I2 does, not of how it does it
*b.* C implements the behavior/functionality provided in I1
*c.* I1 inherits all the methods declared in I2
*d.* I2 is the implementer view and I1 is the client view
*e.* none of the above - answer>>>b
Assume n is an int variable. Which Java expression is true exactly when n is an odd
number, i.e., not divisible by 2, and should be used to check for this situation? (hint: don't
forget negative numbers!)
*a.* n % 2 == 1
*b.* n % 2 != 1
*c.* n % 2 == 0
*d.* n % 2 != 0
*e.* none of the above - answer>>>d
Given the following code, which statement is true?
SimpleWriter out = new SimpleWriter1L( );
NaturalNumber n1 = new NaturalNumber1L(5);
NaturalNumber n2 = n1; n2.decrement( );
out.println("n1 = " + n1 + ", n2 = " + n2);
*a.* will output "n1 = 4, n2 = 4"
, *b.* will output "n1 = 5, n2 = 4"
*c.* will not compile
*d.* will result in a run-time error
*e.* none of the above - answer>>>a
What is value of num after the following loop?
NaturalNumber n = new NaturalNumber2(25);
NaturalNumber hund = new NaturalNumber2(100);
NaturalNumber num = n; while
(n.compareTo(hund) < 0) {
n.multiply(new NaturalNumber2(2));
if (n.compareTo(num) > 0) { num = n;
}
}
*a.* 25 *b.*
50
*c.* 100
*d.* 200
*e.* none of the above - answer>>>c
Consider the following method contract and client code:
/**
* Adds n to this.