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

CMSC FINAL UPDATED ACTUAL Questions and CORRECT Answers

Document preview thumbnail
Preview 3 out of 18 pages

CMSC FINAL UPDATED ACTUAL Questions and CORRECT Answers

Content preview

CMSC FINAL UPDATED ACTUAL Questions and CORRECT Answers

1. Which of the following lines of code correctly writes System.out.println("Hel-
"Hello" to the screen. lo");

2. Fill in the blanks of the code below : main( Public, static, void, String[]
args){

3. The class name does not have to be the same as the False
file name

4. The command to compile a Java program is: Java
Hello.java.

5. Explain the steps that need to happen to take code 1. Code is written
from it being written to it running and producing out- 2. Code is compiled
put. 3. The byte code is read

6. What does the virtual machine do? Choose all answers 1. runs the class file
that apply. 2. runs the byte code

7. Logic errors are the hardest errors to find. T/F True

8. While running a program, it unexpectedly stops. What 1. runtime
type of error is that? Choose all answers that apply. 2. logic

9. Write the algorithm for the following computer prob- Set ASSESS_PERCENT =
lem: 0.22
Bear Corporation needs a program to calculate their Enter month1Sales,
quarterly assessment fee. They will total the sales for month2Sales,
the past quarter (a three month period) and the pay Month3Sales
22% of the total sales as their quarterly assessment Calculate totalSales by
fee. adding month1Sales,
month2Sales,
Month3Sales

, Calculate assessmentFee
by totalSales * AS-
SESS_PERCENT
Output assessmentFee

10. What is a variable? Choose all parts below that are 1. can change
relevant. 2. memory location
3. named

11. Name two primitive Java data types that represent int, byte, short, long
whole numbers.

12. Name two primitive Java data types that represent float, double
floating point numbers.

13. For each error shown below match it to the correct out- 1. Compile-time error
put: a compile-time error, run-time error, or no error. 2. run-time error
3. compile-time error
1. System.out.Println("Greetings, Planet Earth!"); 4. compile-time error
2. System.out.println(); 5. compile-time error
3. float scale = 7854.345368564323; 6. no error
4. System.out.println("I love VCU!")
5. Double x = 43.454;
6. System.out.print(45 % 342);

14. What is displayed in the following code segment? 1. 5
int numerator = 34; 2. 4
int denominator = 6;

1. System.out.println(numerator / denominator);
2..out.println(numerator % denominator);

15. Comment



, A part of a program that contains information about
the program but has no effect when the program runs
is called a .

16. Given the following declaration statement, write a count++
statement that increments the value in the variable
count.
int count = 0;

17. Write a constant statement to hold the value of dis- final double discount
count, which is 15%.

18. Consider the following code segment.r = 5 x=2*π*r
h=9 y=x*r
Please select the most correct code fragment that will z = h * x
result in calculating the surface area of a cylinder, given surfaceArea = y + z
the equation:
Surface area = 2PIr^2 + 2PIrh

19. Consider the following code segment. 12
x=2
y=3
z=5
z=y
y=x*z
x=z
z=y
x=y+z
z=x/y
y=x
After the above code is executed, what is the value of
y?

Document information

Uploaded on
October 26, 2025
Number of pages
18
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$13.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.
STANFORDGRADESS
4.0
(241)
Sold
1674
Followers
109
Items
121810
Last sold
1 hour 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