Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 34 pages
Exam (elaborations)

OSU CSE 2221 Final Review Exam Questions AND Correct Answers

Document preview thumbnail
Preview 4 out of 34 pages

OSU CSE 2221 Final Review Exam Questions AND Correct Answers

Content preview

OSU CSE 2221 Final Review Exam Questions AND Correct
Answers
A type is an immutable type if:


*a.* it is illegal to copy a reference of that type, so there can be no
aliasing
*b.* for every instance method of that type, this and every other
parameter of that type is a restores-mode parameter
*c.* that type has a no-argument constructor
*d.* a function method may not return a result of that type - ✔✔b


After execution of the following code, what are the declared type
(static type) and the object type (dynamic type) of nCopy?


NaturalNumber n = new NaturalNumber2( );
NaturalNumber nCopy = new NaturalNumber1L(n);


*a.* declared type is NaturalNumber, object type is NaturalNumber1L
*b.* declared type is NaturalNumber, object type is NaturalNumber2
*c.* declared type is NaturalNumber2, object type is
NaturalNumber1L
*d.* declared type is NaturalNumber1L, object type is
NaturalNumber2 - ✔✔a

,After the two variables are declared and initialized, which java
instruction will set the value of b to true?


NaturalNumber n = new NaturalNumber2( );
NaturalNumber k = new NaturalNumber2(1);


*a.* boolean b = k.compareTo(n) == 1;
*b.* boolean b = n.compareTo(k) < 0;
*c.* boolean b = n <= k;
*d.* boolean b = n.!equals(k); - ✔✔b


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 - ✔✔c

,API stands for:


*a.* Advanced Programming Index
*b.* Advanced Power Interface
*c.* Access Port Input
*d.* Application Personal Interface
*e.* Application Programming Interface - ✔✔e


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 - ✔✔d


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" - ✔✔b


Consider the following code fragment:


int x = 8;
while ((x / 3) != 2) { x = x - 1; }


How many times will the body of the loop execute?


*a.* 0
*b.* 1
*c.* 2
*d.* 3
*e.* the loop will never terminate - ✔✔a


Consider the following code:


private static int examScore(int studentNumber) { ... }
int k = examScore(42);

Document information

Uploaded on
October 30, 2025
Number of pages
34
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$12.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
ExamsCentre
3.7
(3)
Sold
13
Followers
0
Items
1709
Last sold
2 months ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions