• 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 4 out of 41 pages
Exam (elaborations)

CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025

Document preview thumbnail
Preview 4 out of 41 pages

CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025CPS 150 Final Exam Study Questions With Complete Solutions 100% Verified 2025

Content preview

CPS 150 Final Exam Study Questions With
Complete Solutions 100% Verified 2025



1.

What is the output from the following fragment?z = 15 ;while (z <= 20) z = z + 2 ;cout << z <<
endl ;



A.

15




B.

17




C.

19




D.

20

,E.

21



Correct Answer

E. 21

Explanation

The code initializes the variable z to 15. The while loop condition checks if z is less than or equal
to 20. Inside the loop, z is incremented by 2. The loop continues until z becomes greater than
20. After the loop, the value of z, which is 21, is printed followed by a new line. Therefore, the
output from the given fragment is 21.

Rate this question:



2.

Which of the following program fragments is an infinite loop?/* fragment P */z = 10 ;while (z <=
20) z = z + 1 ;/* fragment Q */z = 30 ;while (z <= 20) z = z - 1 ;/* fragment R */z = 10 ;while (z <=
20) ;z = z + 1 ;



A.

Only P




B.

Only Q




C.

Only R

,D.

P and Q




E.

P and R



Correct Answer

C. Only R

Explanation

The correct answer is only R. Fragment R is an infinite loop because the condition in the while
loop is always true (z

Rate this question:



3.

Which of the following statements about value parameters is true?



A.

The argument is never modified by execution of the called function




B.

The parameter is never modified by execution of the called function

, C.

The argument must be a variable




D.

The argument can not have a Boolean value




E.

Both a and b



Correct Answer

A. The argument is never modified by execution of the called function

Explanation

The correct answer is that the argument is never modified by the execution of the called
function. This means that when a function is called with a value parameter, the value of the
argument remains unchanged throughout the execution of the function. The function can
perform operations on the parameter, but it cannot modify the original argument that was
passed to it.

Rate this question:



4.

Which of the following statements about const value parameters is true?



A.

The argument is never modified by execution of the called function

Document information

Uploaded on
March 31, 2025
Number of pages
41
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers
$18.49

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.
Sold
273
Followers
29
Items
8700
Last sold
1 day 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