OOPJ EndSem 2023
OOPJ EndSem 2023
OOPJ EndSem 2023
SECTION-A
1. Answer the following questions: [1x 10]
(a) Explain the ternm abstraction and encapsulation with
respect to object oriented programming.
(b) Can an interface be extended? If yes - explain with an
example.
(c) Explain the use of super keyword in java with small
example.
(d) What will be the output of the following java code
class Break {
public static void nain(string argst]) 4
boolean t true;
£irst: {
second: {
thirdi {
System.out.println("Before the break. ");
if(t) break second; /1 break out of second block
System, out.println(" This won't execute"):
System.out. print ln ("This wont execute" ):
system.out.println("This is after second block. "):
SECTION-B
SECTION-C
4. (a) It is said that a package is both the naming and [41
visibility control mechanism. How visibility control
mechanism can be implemented through package in
java? Write a program for the same showing the
KIIT-DU/2023/SO TAutumn End Semester Examination-2023
working of protected and default access specifier using
inheritance.
(b) Implement an Interface volume with a method [4]
cale_Vol() and a data member PI whose value
initialized as 3.14. Two classes Cvlinder and Cone
implement the above interface. Write an application
class Demo where the volume of above two objects are
calculated. Hint: The volume of Cylinder and Cone is
rh and 3(r?h)
6. (a) Write a program in java which will display the content (4]
of a file in reverse order. The name of the file will be
accepted from keyboard. The program will first check
whether the file is exist or not otherwise throw
necessary exception message
(b) Create a swing application to calculate the Factorial and [4]
square of a given number. Create atext field to takethe
number as user input for these operations. Create two
buttons namely FACTORIAL and SQUARE. When the
user will click on any button, the result will be
displayed on another text field.
(b) Write a program which will accept a string from the (4]
keyword and check whether it is a valid password or
not as per the below rules:
(i)Must have at least 5 characters
(ii)Consist of only lowercase letters and digits
(iii) Must contain at least three digits