Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

OOPJ EndSem 2023

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Semester: 3rd

Qn. Set Code-1 Programme: B.Tech


Branch: CSSE, IT

AUTUMN END SEMESTER EXAMINATION-2023


3rd Semester B.Tech
OBJECT ORIENTED PROGRAMMINGUSING JAVA
CS20004
(For 2023 (L.E) & 2022 Admitted Batches)
Time: 3 Hours Full Marks: 50
Answer any SIX questions.
Ouestion paper consists of four SECTIONS i.e. A, B, C andD.
Section Aiscompulsory.
Attempt minimum one question each from Sections B, C, D.
The figres in the margin indicate full marks.
All parts of a questionshould be answered at one place only.

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. "):

KIIT-DUI2023 SOT Aulumn End Semester Examination-2023


Describe the mechanism of dvnamic method dispatch.
() Differentiate checked and unchecked exception in java.
(g) Describe any two component of an evernt.
(h) Explain thefunctionality of ResultSetMetaData.
(i) Describe the term thread synchronization.
) Why string class is called as immutable? Explain with
one example.

SECTION-B

2. (a) Everything is treated as object in java but stillprimitive [4]


data types are used. Explain any two advantage
associated with primitive data types over object. Write
a java program to add two complex number.
(b) Describe the term nested class. Explain the property of [4]
inner class. Can inner class access the private variable
of outer class, if yes - explain with an example.

3. (a) Create a class Rectangle having data members as length [4]


and width and a method as find Area). Derive a class
Box from rectangle which will have a data member as
height and a method called find Volume(). All the field
must be initialize through constructor. Display the
result by calling the find Area() method through the
object of both the classes and the volume method
through the object of Box class.
(b) Explain the ternm dynamic method dispatch in java. [4]
Explain its functionality with a suitable example.

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)

$. (a) Where we use the keyword throw and throws in [4]


exception handling. Write a program in java to create a
user defined exception called Invalid Age. Throw the
exception when the user entered age is less than zero or
greater than 100,
(b) Write a program in java which will accept a string and [4]
acharacter from the keyboard and the progranm will do
the followingoperations:
(i) The accepted character is repeated how many times
in the string.
(ii) Check whether the string is palindrome or not.

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.

KIlT-DU2023/SOTAutumn End SemesterExamination-2021


SECTION-D
7. (a) Write a JDBC application program that display the [4|
content of a particular RollNo from the table named
Student which consists of three column called RollNo,
Name and marks. The RollNo will be accepted from the
keyboard.
(b) What is thread synchronization in java? Explain the [4]
same with a suitable example.

8. (a) Create a swing application having 3 label RollNo, [4]


Name and Marks and three text field. The application
will also have a Insert Button. When the user will enter
value in all three text field and click on the Insert
Button, the corresponding values will be submitted to
the database table.

(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

KIIT-DU2023/SOTAutumn End Semester Examination-2023

You might also like