Object Oriented Programming
CSE · Quiz · Fall 25
Paper 1 of 3By MD. ABDUR ROUF ROKON (1)Switch
Paper 1 of 3
Read the questions as text
Read off the PDF by AI, so it may have mistakes. The PDF is the original.
Quiz-1
OOP
1. Is there any error in the following code. If 'yes', provide the correction. If 'no' what will be the output of this program? 5
1 public class University {
2 2 public static void main(String[] args) {
3 3 Daffodil diu = new Department();
4 4 diu.display();
5 5 }
6 6 }
7 7
8 8 class Daffodil {
9 9 void display() {
10 10 System.out.println("Daffodil International University");
11 11 }
12 12 }
13 13
14 14 class Department extends Daffodil {
15 15 void display() {
16 16 System.out.println("Computer Science & Engineering");
17 17 }
18 18 }
2. Write a Java program that takes a student's details Name, CGPA, and Email as input from the user, and then displays the entered information in a single system out method. 5
3. Consider the following UML notation of a Class. Write the implementation of the above UML using Java language. Inside the main method, create an object and show calling of all the methods with expected output of the call. 5
[Figure: UML class diagram for Student with attributes stuid: int, name: String, email: String, and methods Student(int, String), displayName(): void, displayId(): void, displayEmail(): void, main(String[]): void]