0% found this document useful (0 votes)
20 views3 pages

2nd Monthly Exam JAVA

This document contains a 2nd monthly examination for a Java Programming class for 12th grade ICT students. The exam has two tests: 1. Test I requires students to match 10 Java code snippets with their corresponding functionalities by writing the letter only in the provided space. 2. Test II requires students to identify and mark errors with a color pen in two Java programs - Program A calculates the average of subjects, containing 10 errors, and Program B takes scanner input of an ICT strand's information, containing 10 errors. Students are not allowed to erase and must be cautious as a single error can cause programs to malfunction.
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)
20 views3 pages

2nd Monthly Exam JAVA

This document contains a 2nd monthly examination for a Java Programming class for 12th grade ICT students. The exam has two tests: 1. Test I requires students to match 10 Java code snippets with their corresponding functionalities by writing the letter only in the provided space. 2. Test II requires students to identify and mark errors with a color pen in two Java programs - Program A calculates the average of subjects, containing 10 errors, and Program B takes scanner input of an ICT strand's information, containing 10 errors. Students are not allowed to erase and must be cautious as a single error can cause programs to malfunction.
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/ 3

\

2ND MONTHLY EXAMINATION


Java Programming for 12 ICT

Name: ______________________________________________ Date: ______________

Test I. Match the Java code snippets in Column A with their corresponding functionalities in Column B
Write the LETTER ONLY on the space provided. (2pts each)

JAVA Code
Functionalities
1. System.out.println
2. Scanner scanner = new Scanner(System.in); A. Print output to the console. _____
3. scanner.close(); B. Initialize a Scanner object to read input from
4. break; the console. ________
5. exit = true; C. Close the Scanner object. _____
6. ArrayList<String> names = new ArrayList<>(); D. Terminate a loop or switch statement.______
7. public static void main(String[] args) { E. Set a boolean variable exit to true.______
8. import java.util.Scanner; F. Declare an ArrayList of strings. ________
9. default: G. Define the main method in a Java program.
10. int choice = scanner.nextInt(); ______
H. Import the Scanner class. _____
I. Specify a default case in a switch statement.
_____.
J. Read an integer input from the
console.______.

Test II. Find the Errors.

Identify and mark each error with a color pen.


Strictly, no erasures are allowed.
Be cautious, as a single error can cause the program to malfunction.
Good luck!

1. Program A – Average of the Subjects ( 10 errors ) 2pts each


2. Program B – Scanner Input Type ( 10 errors) 2pts each
PROGRAM A

mport java.util.Scanner;

public class Main {


public sttic void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print(Enter Math Grade: ")

int mathMarks = scanner.nextInt();


System.oot.print("Enter Science Grade: ");
int scienceMarks = scanner.nextInt();
System.out.print("Enter English Grade: ");
int englishMarks = scanner.nextInt();
System.o0t.print("Enter Computer Grade: ");
int computerMarks = scanner.nextInt );
System.out.print("Enter PE Grade: ")
int peMarks = scanner.nextInt();
double averageMarks = (matheMarks + scienceMarks + englishMarks + computerMarks +
peMarks) / 5.0;
char grade;
if (averageMarks >= 90) {
grade = 'A';
} else if (averageMarks >= 80) {
grade = 'B';
} else if (averegeMarks >= 70) {
grade = 'C';
} else if (averageMarks >= 60) {
grade = 'D';
} else {
grade = 'F';
}
System.out.printlln("Final Grade: " + grade);
scanner.close();
}
}

PROGRAM B
import java.utiIl.Scanner;

public class ICTStrandsInfo {


puvlic static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

system.out.println("Enter Information About ICT Strands at AITE Senior High School:");

System.out.print("Enter the name of the ICT strand: ")


String strandName = scanner.nextLine();

System.out.print("Enter the number of subjects in the ICT strand: ");


int numberOfSubjects = scanner.nxtInt();

scanner.nextLine();

System.out.print(Enter the description of the ICT strand: ");


Striing strandDescription = scanner.nextLine();

System.out.println("Information About ICT Strand at AITE Senior High School:");


System.out.println("Strand Name: " + strandName);
System.oot.println("Number of Subjects: " + numberOfSubjects);
System.out.println("Strand Description: " + strandDescription);

scanner.cloze();
}
}
}

Prepared By: Noted By:

Mr. Antonio Dela Cryuz Cunanan Mrs. Laarni L. Tolentino


ICT Teacher School Principal

You might also like