Cie 1 Java 2021
Cie 1 Java 2021
1. (a) What is inheritance? List different types of inheritances supported by java with suitable
examples. [BL: Understand| CO: 4| Marks: 2]
(b) Describe the primitive data types supported in java and write a java program to print first 100
Fibonacci numbers. [BL: Apply| CO: 1| Marks: 3]
2. (a) List out different types of control flow statements. Discuss about various conditional statements
in java with suitable examples. [BL: Understand| CO: 3| Marks: 2]
(b) Write a program that generates a random number and asks the user to guess what the number
is. If the user’s guess is higher than the random number, the program should display ”Too high,
try again.” If the user’s guess is lower than the random number, the program should display ”Too
low, try again.” The program should use a loop that repeats until the user correctly guesses the
random number. [BL: Apply| CO: 1| Marks: 3]
3. (a) Explain package with syntax. Demonstrate how many ways packages can be imported.
[BL: Understand| CO: 5| Marks: 2]
(b) Write a java program for the following scenario, Animal and Dog both classes have a common
property color. If we print color property, it will print the color of current class by default. To
access the parent property, we need to use super keyword. [BL: Apply| CO: 4| Marks: 3]
4. (a) Write about abstract class with its syntax. Illustrate what happens if the parent and the child
class have a field with same identifier. [BL: Understand| CO: 4| Marks: 2]
(b) Write a java program to create an abstract class named Shape that contains two integers and
an empty method named printArea().provide three classes named Rectangle, Triangle and Circle
such that each one of the classes extends the class Shape. Each one of the classes contains only
the method printArea () that prints the area of the given shape.
[BL: Apply| CO: 5| Marks: 3]
5. (a) Describe try, catch, and finally keywords used in exception handling with an example program.
[BL: Understand| CO: 6| Marks: 2]
(b) Write a java program to handle the abnormal termination caused by an arithmetic expression
having division by zero. [BL: Apply| CO: 6| Marks: 3]
−◦◦⃝◦◦−
Page 1 of 1