100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

CMSC 140 MIDTERM EXAM REVIEW QUESTIONS AND ANSWERS, GRADED A+| latest update 2024/25|

Rating
-
Sold
-
Pages
9
Grade
A+
Uploaded on
09-05-2024
Written in
2023/2024

CMSC 140 MIDTERM EXAM REVIEW QUESTIONS AND ANSWERS, GRADED A+ What kind of error occurs when something wrong in the "grammar" of the program keeps it from compiling? - -Syntax Error What kind of error occurs when the program runs, but it gives you the wrong result? - -Logical Error What kind of error occurs when the program runs until a certain line of code and then crashes? - - Runtime Error Define a constant variable of double type named PI that has an initial value of 3.14159. - -const double PI = 3.14159; Code the following statements using combined assignment operators: 1. price1 is equal to price1 plus 5. 2. price2 is equal to price2 times 7.0 3. price3 is equal to price3 divided by 4.5 4. totalPrice is equal to totalPrice modulus 3 Hint: Things like an equal sign or multiply sign but initialize the variables. - -double price1 = 3.45, price2 = 5.79, price3 = 15.64; int totalPrice = 98; //1. price1 += 5; //2. price2 *= 7.0; //3. price3 /= 4.5; //4. totalPrice %= 3; What does the following code output to the user? int A = 10, B = 17, C = 2; double D = 17.01; bool boolValue = true; if (A > B) { cout << "Good afternoon, sir." << endl; if (A == C) { cout << "Fine weather today we're having." << endl; } } else if (D < B) { cout << "It looks like it will rain later on." << endl; } else { cout << "Good morning." << endl; if (boolValue == true) { cout << "The sun's bright at this time." << endl; } else { cout << "We've got a lot of cloud cover now." << endl; } } - -//The code outputs: //Good morning. //The sun's bright at this time. What does the following code ouput to the user? int num1 = 10, num2 = 13, num3 = 10, square, q

Show more Read less
Institution
CMSC
Course
CMSC









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CMSC
Course
CMSC

Document information

Uploaded on
May 9, 2024
Number of pages
9
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

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.
Terryl Cornell College
View profile
Follow You need to be logged in order to follow users or courses
Sold
125
Member since
1 year
Number of followers
39
Documents
8393
Last sold
2 days ago

3.3

16 reviews

5
2
4
7
3
3
2
1
1
3

Recently viewed by you

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

Frequently asked questions