Sample Questions For Midterm Exam - CSE215 (Sec 19) - Spring2024
Sample Questions For Midterm Exam - CSE215 (Sec 19) - Spring2024
Analyzing the given Java program, determine the output produced by the program when
executed. Your output format should match actual output that will be produced by the
program on computer screen.
class Calculation {
int performCalculation (int a, int b) {
System.out.println("Performing integer calculation");
return a + b;
}
2. Identify all the syntax errors (i.e., compilation-time errors) from the following Java
program and write the corrected code.
class Person{
private String name;
void displayInfo() {
System.println("Name: " + name);
}
}
}
}
3. Write a Java program to create a class called Student that represents a student's ]
information. The class should have the following attributes:
Include a method named displayInfo() in the Student class that displays the
student's information in the following format:
In the Main class, create two Student objects: one using the parameterless
constructor and another using the parameterized constructor. Display the information of
both students using the displayInfo() method.
Example Output: