CSE2137 — Object Oriented Programming¶
Estimated Exam Suggestion¶
Important: This is an evidence-based suggestion prepared from the supplied question papers for Terms 151, 161, 171, 181, 201, 211. It is not a guaranteed question paper.
How This Suggestion Was Prepared¶
- Every topic was counted by the number of distinct terms in which it appeared.
- A topic was counted only once in one term, even when several sub-questions from that term covered it.
- The core set prioritizes repeated topics while maintaining coverage across the handbook chapters.
- Every selected block is an intact question number from a supplied past paper.
- Original wording, spelling, grammar, numbering, marks, equations, code, tables and supplied figures are retained.
- Original figures are embedded directly in this Markdown file, so no separate image folder is required.
Quick Frequency Graph¶
Priority Summary¶
| Priority | Topics |
|---|---|
| Very high | Classes, objects, constructors and methods; Inheritance, encapsulation and polymorphism; Abstract classes, interfaces and multiple inheritance; Exception and error handling; GUI, Swing/AWT, layout managers and events; Java platform, compilation, JVM, JRE and JDK |
| High | Method overloading and overriding; Networking, sockets, JSP/Servlet and cookies; File I/O, streams and file programs |
| Strong | Access modifiers and packages; Static/final members, nested classes and constants; Strings, arrays, typecasting and wrapper behavior; Multithreading and process-based multitasking; Aggregation, garbage collection, upcasting and downcasting |
| Medium | Applet lifecycle, graphics and applet/servlet comparison |
Core Estimated Question Set¶
Revise these seven original past-paper blocks first.
Core Question 1 — OOP Fundamentals, Classes, Constructors and Class Diagram¶
Original source: Term 201, Question 1
-
Q1(a) [2]: What is the difference between Object-Oriented Programming and Structural Programming?
-
Q1(b) [4]: Define accessors (getters), mutators (setters) and constructors in your own word.
-
Q1(c) [2+2+2]: Answer the following questions using the Class diagram for an animal class shown below.
- How many member variables are there in the animal class? Mention their names and types.
- Identify the mutators and accessors.
-
Write Java codes to implement the constructor.
-
Q1(d) [2]: Explain why the constructor is considered as a special type of method in OOP.
Core Question 2 — Constructors, Classes, Objects and Overloading/Overriding¶
Original source: Term 171, Question 2
-
Q2(a) [4]: Constructors are special methods used for object creation. What are the characteristics that make them different than other regular methods?
-
Q2(b) [6]: Classes and objects are fundamental building blocks of OOP. What do you know about these? Use examples to elaborate.
-
Q2(c) [4]: Explain function overriding and overloading in Java with example.
Core Question 3 — Strings, Employee Class and Inheritance Diagram¶
Original source: Term 201, Question 3
-
Q3(a) [1+1]: What is inheritance in OOP? Does Java support multiple inheritances?
-
Q3(b) [2+2]: What are the main features of OOPs? Write a Java program for the following hierarchical inheritance block diagram.
-
Q3(c) [4]: To compare two strings, will you use
==orequals()methods? Briefly explain the reason. Explain with example about the following String methods used in Java: (i)indexOf(), (ii)charAt(), (iii)endsWith(), (iv)contains(). -
Q3(d) [4]: Create a class named Employee that includes three instance variables - a first name (type String), a last name (type String) and a monthly salary (double). Provide a constructor that initializes the three instance variables. Provide a set and get method for each instance variable. If the monthly salary is not positive, do not set its value. Write a test app named EmployeeTest that demonstrates class Employee's capabilities. Create two Employee objects and display each object's yearly salary. Then give each Employee a 10% raise and display each Employee's yearly salary again.
Core Question 4 — Abstract Methods and Exception Handling¶
Original source: Term 161, Question 3
-
Q3(a) [4]: Explain exception handling in JAVA. Write a program that generates custom exception if any integer value given from its command line arguments is negative.
-
Q3(b) [3]: Write a Java program to check the divide-by-zero error of the modulo of two integers using exception handling mechanism.
-
Q3(c) [3]: What are abstract methods? Describe the circumstances in which an abstract method would be appropriate.
-
Q3(d) [4]: Which key words are used to handle exceptions? Write a program to explain the use of these keywords.
Core Question 5 — Streams, Random-Access Files and File Processing¶
Original source: Term 161, Question 5
-
Q5(a) [3]: What is Stream? Distinguish between InputStream class and Reader Class.
-
Q5(b) [3]: What is random access file? How is it different from a sequential file?
-
Q5(c) [5]: Write a program to read the integer values of file and save them another file after sorting.
-
Q5(d) [3]: Why do you require files to store data?
Core Question 6 — Swing Layout, Delegation Events and Java Networking¶
Original source: Term 201, Question 7
-
Q7(a) [1+2]: What are layout managers? Mention the name of three layout managers available in Java swing package.
-
Q7(b) [4]: What are the three components in the delegation event model? Explain.
-
Q7(c) [2+2]: What is the relationship between an event-listener interface and an event-adapter class? How can a GUI component handle its own events?
-
Q7(d) [4]: Write short notes on the following terminologies associated with the Java networking: (i) Protocol; (ii) Socket; (iii) Inet Address; (iv) Datagram packet.
Core Question 7 — Multithreading, Calculator GUI and JFrame¶
Original source: Term 151, Question 6
-
Q6(a) [4]: What are the advantages of multithreading over process based multitasking?
-
Q6(b) [5]: Write a program to have a GUI based simple calculator in a frame supporting addition and subtraction. There are buttons for 0 to 9 digits and for arithmetic operations. Select layout of your choice.
-
Q6(c) [5]: Write code segment of a simple JFrame with one JLabel and JButton.
High-Value Backup Question Set¶
Revise these after completing the seven core blocks.
Backup Question 1 — Classes, Static Members, Overloading and Encapsulation¶
Original source: Term 151, Question 2
-
Q2(a) [4]: Define class and object with example.
-
Q2(b) [4]: Distinguish between static and non-static nested classes. What are the properties of static method, static block and final variable?
-
Q2(c) [4]: Explain function overriding and overloading in Java with examples.
-
Q2(d) [2]: What is encapsulation?
Backup Question 2 — Java Execution, Upcasting/Downcasting and Exception Handling¶
Original source: Term 201, Question 4
-
Q4(a) [4]: "Java programming is to be compiled first and then to be interpreted for execution." Is this statement true or false? Justify your answer with proper description.
-
Q4(b) [4]: Why do you use Upcasting and Downcasting in Java? Explain with examples.
-
Q4(c) [1+5]: What does exception mean in Java? Write a java program to enter two numbers and calculate the quotient. Use exception handling mechanism to take care of the divide by zero situation.
Backup Question 3 — TCP/UDP, RMI, Applet/Servlet, Session and Cookie¶
Original source: Term 151, Question 7
-
Q7(a) [5]: Distinguish between TCP and UDP. Explain the two types of TCP sockets.
-
Q7(b) [5]: What is Remote Method Invocation (RMI)? What is difference between an Applet and a Servlet? Explain the life cycle of an Applet.
-
Q7(c) [4]: What is the difference between session and cookie? How are the JSP requests handle?
Backup Question 4 — Constructor Chaining, Exceptions and GUI Components¶
Original source: Term 211, Question 5
-
Q5(a) [4]: How can Constructor chaining be done by using the Super keyword?
-
Q5(b) [5]: Containers and components are two types of Java GUI elements. Using a suitable diagram explain those elements.
-
Q5(c) [1+4]: What are layout managers? Mention the name of three layout managers available in Java with proper diagram.
-
Q5(d) [5]: How many types of Exceptions can occur in a Java program? Describe with examples.
Backup Question 5 — Layout Managers, JSP/Cookies and Multithreading¶
Original source: Term 181, Question 7
-
Q7(a) [1+2]: What are layout managers? Mention the name of three layout manager available in java swing package.
-
Q7(b) [3+2]: What is the difference between session and cookies in JSP? How is a JSP request handled?
-
Q7(c) [2+4]: What is multithreading in Java? Discuss the advantages of multithreading over process based multitasking.
Final Revision Checklist¶
- Complete all seven core question blocks.
- Complete all five backup blocks if time permits.
- Practise every embedded graph, tree, class diagram, equation, algorithm and code fragment exactly as shown.
- Use the separate topic-frequency file to cover any remaining syllabus area.