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

Cmsc 140 Final Review Part 2 Updated Questions And Correct Answers

Document preview thumbnail
Preview 1 out of 4 pages

Cmsc 140 Final Review Part 2 Updated Questions And Correct Answers

Content preview

CMSC 140 FINAL REVIEW PART 2 UPDATED QUESTIONS
AND CORRECT ANSWERS
Question:
1. Global Variables
Answer:
Variables defined outside of any function, and can be ac-cessed and changed in any function

Question:
2. Local Variables
Answer:
Variables defined within a function, and can only be changed and accessed with-in that function
(unless passed as a parameter)

Question:
3. What is the difference between global and local vari-ables?
Answer:
Global variables can be ac-cessed across the whole pro-gram and local variables can only be accessed
within the function that created it

Question:
4. Write the function header for a function called over-timePay, that returns a double and has a
parameter list that takes a string called name, an int named hours, and a double named payrate. Then,
write the function prototype for this function in the space above the main function.
Answer:
double overtimePay(string name, int hours, double payrate)

Question:
5. What is a function signature?
Answer:
The name of the function and the data types of the func-tion's parameters in proper order.

Question:
6. What does it mean to overload a function?
Answer:
when another function is created with the same name as the first function but with a different
parameter list (thusly, a different function signature).

Question:
7. Given the function definition below (also found after the main function), call the function and pass
the variables 'firstVal' and 'secondVal' into the func-tion, respectively. What will be displayed on the
screen after the execu-tion of the code? What will the variables 'firstVal' and 'secondVal' contain?
void doSomething(int a, double &b) { for (int i = 0; i < a; i++) { cout << ".";
b += 0.01;
} cout << endl;
a += 5;
cout << "A variable a is: " << a << endl;

Document information

Uploaded on
October 7, 2026
Number of pages
4
Written in
2026/2027
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.
Briwisescore
2.5
(2)
Sold
41
Followers
5
Items
17070
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