0% found this document useful (0 votes)
538 views2 pages

Prelim Exam Computer Programming I

This document is a prelim exam for a Computer Programming I course. It contains two sections testing variable declaration and debugging Java code. The first section has 7 multiple choice questions on declaring variables of different data types. The second section has 16 code snippets to identify as correct Java code or needing debugging, and correcting any incorrect code. The exam is scored out of 40 points and contains the student and instructor name at the top.

Uploaded by

Lesner
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
538 views2 pages

Prelim Exam Computer Programming I

This document is a prelim exam for a Computer Programming I course. It contains two sections testing variable declaration and debugging Java code. The first section has 7 multiple choice questions on declaring variables of different data types. The second section has 16 code snippets to identify as correct Java code or needing debugging, and correcting any incorrect code. The exam is scored out of 40 points and contains the student and instructor name at the top.

Uploaded by

Lesner
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Central Philippine Adventist College

COMPUTER DEPARTMENT
Score
Computer Programming I
Prelim Examination – September 19, 2022
40
First Name M.I. Last Name

Read the Instructions carefully


Test I. Variable Declaration and initialization (20pts.)

1. Declare the variable “YES” with a data type String.


2. Declare the variable downpayment with assigned value 3,500 in data type integer.
3. Assign the value 25 to variable centavos in data type byte
4. Declare the variable playerNumber with a datatype float.
5. Assign the string “OK” to variable answer.
6. Assign the value 3.1415 to variable Pi in data type Double.
7. Declare the variable ‘N’ with a data type char

Test II. Debugging. Write Java if the statement is correct and Program if incorrect. Then encircle or write the
correct java code to make the statement correct. (20 pts.)

1. import java.swing.JOptionPane :
2. public class grade
3. {
4. public static volume main(String { } args)
5. [
6. strings midtermGrade;
7. String 123finalGrade ;
8. double midterm, final2;
9. double yourfinalgrade;

10. midtermGrade = JOptionPane.showMessageDialog(null, "Enter your midterm grade:


");
11. midterm=Double.parseDouble(midtermGrade)

12. finalGrade = JOptionPane.showInputDialog(null, Enter your final grade: );


13. final2=Double.parseDouble(finalGrade);

14. Your_finalgrade = ((midterm*0.40) + (final2 * 0.60));


15. JOptionPane.showInputDialog(null, "\n\n\n Your Final Grade is:" +yourfinalgrade);

16. System.exit(5);
17. }
18. }
- End of Exam -
Elnelyn C. Oberio, MIT, BSCS
Instructor

You might also like