1
Register Number:
Date:
ST. JOSEPH’S COLLEGE (AUTONOMOUS), BANGALORE-27
B.Sc –III SEMESTER
SEMESTER EXAMINATION: OCTOBER 2022
(Examination conducted in December 2022)
CS322- Object Oriented Programming Concepts with Java
Time- 2 1/2 hrs Max Marks-60
This paper contains three printed pages and three parts
PART A
Answer All the Questions. 10 * 1=10
1. Which of these literals can be contained in float data type variable?
a) -1.7e+308
b) -3.4e+038
c) +1.7e+308
d) -3.4e+050
2. Which of these is an incorrect Statement?
a) It is necessary to use new operator to initialize an array
b) Array can be initialized using comma separated expressions surrounded by
curly braces
c) Array can be initialized when they are declared
d) None of the mentioned
3. Which of these are selection statements in Java?
a) if()
b) for()
c) continue
d) break
4. When Overloading does not occur?
a) More than one method with same name but different method signature and
different number or type of parameters
CS-322-A-22
2
b) More than one method with same name, same signature but different number
of signature
c) More than one method with same name, same signature, same number of
parameters but different type
d) More than one method with same name, same number of parameters and type
but different signature
5. Which of the following is a valid declaration of an object of class Box?
a) Box obj = new Box();
b) Box obj = new Box;
c) obj = new Box();
d) new Box obj;
6. What is true about constructor?
a) It can contain return type
b) It can take any number of parameters
c) It can have any non access modifiers
d) Constructor cannot throw an exception
7. Which of the following statements are incorrect?
a) String is a class
b) Strings in java are mutable
c) Every string is an object of class String
d) Java defines a peer class of String, called StringBuffer, which allows string to
be altered
8. Which of these is correct way of inheriting class A by class B?
a) class B + class A {}
b) class B inherits class A {}
c) class B extends A {}
d) class B extends class A {}
9. If a class inheriting an abstract class does not define all of its function then it will
be known as?
a) Abstract
b) A simple class
c) Static class
d) None of the mentioned
10. Which of these class can generate an array which can increase and decrease in
size automatically?
a) ArrayList()
b) DynamicList()
c) LinkedList()
d) MallocList()
PART B
Answer any FIVE. 5*6=30
11. Write programs to demonstrate the difference between method overloading and
method overriding in Java. (3 +3 marks)
12. Explain different string handling functions and their syntax in java language.
13. Write a program in java to do the following: a) To swap the two numbers without
using the third variable b) Factorial of a number. (3 +3 marks)
14. Explain about interfaces. How they are different from the abstract classes?
CS-322-A-22
3
(3 +3 marks)
15. Develop a GUI application which displays a welcome message when the button
named ok is clicked.
16. Write a short note on : a) Finalize b) Multiple catch with single try statement.
(3 +3 marks)
17. Explain I/O Streams with suitable examples.
PART C
Answer any TWO. 2*10=20
18. a) What is class? How to create object for the class? (4 marks)
b) Define super. Explain the use of super with suitable example. (6 marks)
19.a) How to create and import package in Java? Explain with an example. (6 marks)
b) List out the four main differences between Procedure Oriented and Object
Oriented Programming. (4 marks)
20.a) Explain the following jump statements with suitable example
(i)continue (ii)break (5 marks)
b) Create a class called Vehicle and a class called Car which extends Vehicle.
Illustrate overloading and overriding using the relationship between the classes. (5 marks)
CS-322-A-22
4
CS-322-A-22