• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 2 pages
Exam (elaborations)

Computer Programming Exam 2 Questions And Correct Answers

Document preview thumbnail
Preview 1 out of 2 pages

COMPUTER PROGRAMMING EXAM 2 QUESTIONS AND CORRECT ANSWERS

Content preview

COMPUTER PROGRAMMING EXAM 2
QUESTIONS AND CORRECT
ANSWERS
WhatA2willA2theA2followingA2codeA2print?:A2intA2count;A2forA2(countA2=A210;A2countA2>A26;A2c
ount--)A2System.out.print(countA2+A2"A2");A2-A2Ans--10A29A28A27

WhatA2isA2theA2valueA2ofA2theA2expressionA2(xA2>A23)A2||
A2(yA2<A23)A2ifA2xA2hasA2theA2valueA21A2andA2yA2hasA2theA2valueA25?A2-A2Ans--
TheA2valueA2ofA2thisA2expressionA2isA2False

TheA2bodyA2ofA2anyA2whileA2loopA2willA2beA2executedA2atA2leastA2once.A2-A2Ans--
FalseA2(bodyA2willA2beA2executedA2atA2leastA2once)

EveryA2statementA2withA2ifA2mustA2alsoA2includeA2elseA2-A2Ans--
False,A2everyA2ifA2statementA2willA2notA2alsoA2includeA2"else".

WhatA2isA2outputA2byA2theA2followingA2code?A2
intA2pA2=A24;A2intA2mA2=A230,A2j;A2forA2(jA2=A21;A2jA2<A2p;A2j++);
A2{A2mA2=A2mA2+A2jA2*A2j;A2}A2System.out.println(m);A2-A2Ans--34


AnA2!A2inA2anA2expressionA2means:A2-A2Ans--Not

AA2do-whileA2loopA2willA2loopA2atA2leastA2once.A2-A2Ans--(false)A2doA2while

WhatA2willA2theA2followingA2codeA2print?
A2intA2colorA2=A21;A2switchA2(color)A2{A2caseA21:A2caseA22:A2System.out.print("redA2");A2case
A23:A2System.out.print("blueA2");A2caseA24:A2System.out.print("purple"); A2break;A2default:A2
System.out.print("gray");A2}A2-A2Ans--RedA2BlueA2Purple

WriteA22A2lineA2codeA2snippetA2usingA2aA2for-
loopA2thatA2willA2printA2theA2numbersA218,A26,A22A2-A2Ans--
for(intA2iA2=A218;A2iA2>=2;A2iA2=A2i/3)
System.out.println(i);

AA2multibranchA2if-elseA2statementA2isA2oneA2kindA2ofA2nestedA2if-elseA2statement.A2-
A2Ans--True,A2IsA2aA2nestedA2statement


A(n)A2__________A2goesA2inA2theA2parenthesesA2followingA2theA2wordA2ifA2inA2anA2if-
elseA2statement.A2-A2Ans--ParameterA2List

WhatA2isA2outputA2byA2theA2followingA2code?
A2intA2b;A2forA2(intA2iMusA2=A20;A2iMusA2<A25;A2iMus+

Document information

Uploaded on
November 21, 2025
Number of pages
2
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$10.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.
LECTUREKIM
1.0
(2)
Sold
15
Followers
0
Items
4325
Last sold
1 month 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