Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

Computer Science and Engineering 2221 Final Exam Review with Correct Answers (2024) Practice Questions with Solutions

Beoordeling
-
Verkocht
-
Pagina's
38
Cijfer
A+
Geüpload op
17-05-2025
Geschreven in
2024/2025

This document provides a complete final exam review for OSU’s CSE 2221 course, containing 38 pages of multiple-choice practice questions along with the correct answers. It covers essential Java programming topics including recursion, loops, methods, XML, object-oriented concepts, and design-by-contract principles. A highly useful resource for exam preparation, aligned with the content and style of the official course assessments.

Meer zien Lees minder
Instelling
OSU CSE 2221
Vak
OSU CSE 2221

Voorbeeld van de inhoud

Page 1 of 38




OSU CSE 2221 FINAL EXAM REVIEW WITH CORRECT
ANSWERS

How many times will the body of the loop execute?


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


The correct syntax for the "main" method signature is:


*a.* private static void main(String[] args)
*b.* public static String main(String[] args)
*c.* public static void main(String[] args)
*d.* public void main(String[] args)
*e.* none of the above - answer-c


The Java compiler does the following:

, Page 2 of 38




*a.* checks a bytecode program in a ".class" file for run-time
errors and if there are none, it generates source code for that
program in a ".java" file
*b.* checks a source code program in a ".java" file for run-time
errors and if there are none, it generates bytecode for that
program in a ".class" file
*c.* checks a source code program in a ".java" file for compile-
time errors and, if there are none, it generates bytecode for that
program in a ".class" file
*d.* checks a bytecode program in a ".class" file for compile-time
errors and if there are none, it generates source code for that
program in a ".java" file
*e.* none of the above - answer-c


Which statement correctly defines a java constant?


*a.* const SPECIAL = 1234;
*b.* int SPECIAL = 1234;
*c.* int final SPECIAL = 1234;
*d.* final int SPECIAL = 1234;
*e.* const int SPECIAL = 1234; - answer-d


What is the value of s after the following statement:

, Page 3 of 38




String s = (!true) + " : " + (10 + 4) + " is 104";


*a.* "!true : 104 is 104"
*b.* "false : 104 is 104"
*c.* "!true : 14 is 104"
*d.* "false : 14 is 104"
*e.* This is a compile-time error - answer-d


The Checkstyle plugin for Eclipse is useful because:


*a.* it warns you of potential compile-time errors
*b.* it helps you make your code understandable for yourself and
other programmers
*c.* it prevents your code from making errors caught by assert
statements
*d.* it tells you when code you have written does not obey its
contract
*e.* none of the above - answer-b


If x is an int variable, when does the boolean expression evaluate
to true?


((x % 5 != 0) && (x % 2 != 0))

, Page 4 of 38




*a.* when x is divisible by 5 or by 2 but not by both
*b.* when x is divisible by 10
*c.* when x is not divisible by 10
*d.* when x is neither divisible by 5 nor by 2
*e.* when x is either divisible by 5 or by 2 - answer-d


The nextDouble( ) method of r, a variable of type Random,
returns a double in a range of [0,1). Which of these expressions
would you use to create a random number in the range of [-3,3)?


*a.* r.nextDouble( ) * 3.0 - 3.0
*b.* (r.nextDouble( ) - 0.5) * 6.0
*c.* r.nextDouble( ) * 6.0 + 3.0
*d.* r.nextDouble( ) * 6.0 + 0.5
*e.* (r.nextDouble( ) - 3.0) * 6.0 - answer-b


Consider the following code fragment:


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

Geschreven voor

Instelling
OSU CSE 2221
Vak
OSU CSE 2221

Documentinformatie

Geüpload op
17 mei 2025
Aantal pagina's
38
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$23.99
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF

Maak kennis met de verkoper
Seller avatar
gicharumichael281
5.0
(2)

Maak kennis met de verkoper

Seller avatar
gicharumichael281 Columbia University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
3
Lid sinds
2 jaar
Aantal volgers
1
Documenten
198
Laatst verkocht
3 maanden geleden

5.0

2 beoordelingen

5
2
4
0
3
0
2
0
1
0

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen