Object Oriented Concepts
Object Oriented Concepts
YEAR OF
OBJECT ORIENTED CATEGORY L T P CREDIT
CST455 INTRODUCTION
CONCEPTS
OEC 2 1 0 3 2019
Preamble: The purpose of this course is to enable learners to solve problems by breaking it down
to object level while designing software and to implement it using Java. This course covers Object
Oriented Principles, Object Oriented Programming in Java, Exception handling, Event handling,
multithreaded programming and working with window-based graphics. This course provides
learners the basics to develop Mobile applications, Enterprise Applications, Scientific
Applications and Web based Applications.
Prerequisite: A sound background in any of the programming languages like C, C++, Python etc
is mandatory. Students who completed the minor stream course CST 281 Object Oriented
Programming are not allowed to choose this Open Elective Course.
Course Outcomes: After the completion of the course the student will be able to
Utilise data types, operators, control statements, built in packages & interfaces,
CO2 Input/Output Streams and Files in Java to develop programs (Cognitive Knowledge
Level: Apply)
Illustrate how robust programs can be written in Java using exception handling
CO3
mechanism (Cognitive Knowledge Level: Apply)
PO PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO1 PO11 PO1
1 0 2
CO1
CO2
CO3
CO4
CO5
Conduct investigations of
PO4 complex problems PO10 Communication
Assessment Pattern
Remember 20 20 20
Understand 40 40 40
Apply 40 40 40
Analyze
Evaluate
Create
Mark Distribution
150 50 100 3
from the partly completed module), each with 7 marks. Out of the 7 questions, a student should
answer any5.
Primitive Data types - Integers, Floating Point Types, Characters, Boolean. Literals, Type
Conversion and Casting, Variables, Arrays, Strings, Vector class.
Exception Handling - Checked Exceptions, Unchecked Exceptions, try Block and catch Clause,
Multiple catch Clauses, Nested try Statements, throw, throws and finally.
Java Library - String Handling – String Constructors, String Length, Special String Operations -
Character Extraction, String Comparison, Searching Strings, Modifying Strings, Using
valueOf(), Comparison of String Buffer and String.
Event Handling - Event Handling Mechanisms, Delegation Event Model, Event Classes, Sources
of Events, Event Listener Interfaces, Using the Delegation Model.
Swing Fundamentals - Swing Key Features, Model View Controller (MVC), Swing Controls,
Components and Containers, Exploring Swing - JFrame, JLabel, JButton, JTextField.
Text Books
1. Herbert Schildt, Java: The Complete Reference, 8/e, Tata McGraw Hill, 2011.
2. Balagurusamy E., Programming JAVA a Primer, 5/e, McGraw Hill, 2014.
Reference Books
1. Paul Deitel, Harvey Deitel, Java How to Program, Early Objects 11/e, Pearson, 2018.
2. Y. Daniel Liang, Introduction to Java Programming, 7/e, Pearson, 2013.
3. Nageswararao R., Core Java: An Integrated Approach, Dreamtech Press, 2008.
4. Flanagan D., Java in A Nutshell, 5/e, O'Reilly, 2005.
5. Sierra K., Head First Java, 2/e, O'Reilly, 2005.
PART A
4. What does the following Java function compute? Justify your answer.
intgreater(int a, int b)
{
while(a!=b)
{
if(a>b)
a=a-b;
else
b=b-a;
}
return a;
}
8. Write a simple program to read an integer value from console and print it.
Part B
(Answer any one question from each module. Each question carries 14 Marks)
11. (a) Describe in detail polymorphism, abstraction and inheritance with suitable (9)
examples.
OR
12. (a) Explain the salient features of Java language. How does Java Enterprise (9)
Edition (J2EE) differ from Java Standard Edition (Java SE)?
(b) Explain the declaration and use of multi-dimensional array variables in Java, (5)
with example.
13. (a) Explain iteration control statements in Java. Give examples. (8)
OR
14. (a) Using a suitable Java program, explain the concept of methods and (6)
constructors.
(b) Write a Java program that prompts the user for an integer and then prints out (8)
all the prime numbers up to that number.
15. (a) In a table format, show the effect of access specifiers within and outside (6)
packages in Java.
(b) Describe exception handling using try block and catch clause in Java with the (8)
help of a suitable Java program.
OR
16. (a) What is an interface in Java? Explain with a suitable example. (6)
(b) Write a program that perform integer divisions. The user enters two input data (8)
(any data type) through console into variables Num1 and Num2. If Num1 or
Num2 were not an integer, the program would throw a Number Format
Exception. If Num2 were Zero, the program would throw an Arithmetic
Exception. Display the appropriate exception or result.
17. (a) Write a Java program that displays the number of characters, lines and words (8)
in a text file.
(b) Explain any three String constructors with the help of sample code for each. (6)
OR
18. (a) Write a program to demonstrate the usage of the PrintWriter class. (7)
(b) Write a Java program for sorting a given list of names in ascending order. (7)
19. (a) Explain Delegation Event model for event handling in Java. (7)
(b) Write a program to compute the sum of elements in an array using two (7)
threads in a parallel way. The first thread sums up the first half of the array
and the second thread sums up the second half of the array. Finally, the main
thread adds these partial sums and prints the result.Use Runnable interfacefor
the creation of a thread.
OR
20. (a) What are the differences between a process and a thread? (4)
(b) Write a Graphical User Interface (GUI) based Java program to implement a (10)
simple calculator supporting the operations addition, subtraction,
multiplication and division. Use Swing controls to implement GUI. There
may be three text boxes, the first two for accepting the operands and the last
for displaying the result. Add four buttons for the above operations. Write
neat comments in your program to show how you handle events.
Teaching Plan
No. of
Lecture
No Contents Hours
(36hrs)
1.6 Primitive Data types - Integers, Floating Point Types, Characters, Boolean 1 hour
1.7 Literals, Type Conversion and Casting, Variables, Arrays, Strings, Vector 1 hour
class.
3.2 Calling Order of Constructors, Method Overriding, the Object class 1 hour
3.3 Abstract Classes and Methods, Using final with Inheritance 1 hour
4.5 Java Library - String Handling – String Constructors, String Length 1 hour
5.6 Using the Delegation Model, Swing fundamentals, Swing Key Features 1 hour