0 ratings 0% found this document useful (0 votes) 22 views 13 pages Java3 1
This document outlines the examination structure for the Object-Oriented Programming with Java course, including various modules and questions that cover topics such as data types, operators, garbage collection, inheritance, exception handling, and multithreading. Students are required to answer five full questions, selecting at least one from each module, with a total duration of three hours and a maximum score of 100 marks. The document also emphasizes the importance of Java programming concepts through practical coding examples.
AI-enhanced title and description
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Carousel Previous Carousel Next
2 BCS306A,
2
uss : lg
Third Semester B.E./B.Tech_ pegree Examination, Dec.2023/Jan.2024
Object Orienteg programming with Java
‘Time: 3 hrs. Max. Marks: 100
Note: . Answer any FIVE full ayes ions, choosing ONE full question from each module
2M Marks L: Bloom's oye Course outcomes.
[M[L|_¢
‘7 Module —1
=] Diswiss the diffrent data pay sored by Java along withthe default] 8 | L2 col
values and literals.
Develop a Java program to convert Celsius temperature to Fahrenheit. 13 | Coz
«: | Justify the statement “Compile oneg and run anywhere” in Java © | 12 | Cor
= OR
QI [a | List the various operators supported by Java, lustrate the working of>>| 8 | 2] Col
and >>> operators with an example
ir] Develop a Java program to agg two matrices using command Tine [10] 13 | CO?
| argument
©. [Explain the syntax of declaration of 2D arrays in Java. 2 | 12) col
Module =?
3 [a | Examine Java Garbage collection mechanism by classifying the 37 6 | 12 | COL
| generations of Java heap.
| b. | Develop a Java program to find area of rectangle. area of circle and area of | 10] L3 | coz
| triangle using method overloading concept. Call these methods from main
| method with suitable inputs.
_ |
c. | Interpret the general form ofa class with example., 4] 2 | Coz
OR
4 | ye | Outline the following keywords with an example = 6 | L2 | coz
¥ y
(i) this
| (i) static
b. | Develop a Java program to create a class called ‘Employee’ which contains | 10 | L3 | COZ
| ‘name’, ‘designation’, ‘empic” and “basic salary” as instance variables and
read () and write () as methods. Using this class, read and write five
employee information from main ( ) method.
. | Interpret with an example, types of constructions, ~ 4/12] C02
Module-3 - ~
| Q5/] 4, | Iilustrate the usage of super keyword in Java with suitable example. Also | 10] L2 | CO3
| | explain the dynamic method dispatch.
b. | Build a Java program to ereate an interface Resizable with method resize | 10 | L3 | CO3 |
| (int radius) that allow an object to be resized. Create a class circle that
[ implements resizable interface and implements the resize method,
FT OR Z
Q6° | a. | Compare and contrast method overloading and method overriding with] 8 | L2 | CO2
| suitable example,
Tof2
@ scanned with OKEN ScannerBCS306A<
itera PTT
San Te TRE OPS OTR
iamed ice in Java, 4712 | cos
Define inheritance
aie a class Med sy
each Classy"
onncthods named draw
€pts by developing
Build a Java program (0 cree
namely circle, triangle and s ms
() and erase ( )- ‘Demonstrate pol Phisy,
suitable methods and main progran
Module=4
55 Prol’ctigng
=
of acces wa
‘ailable for packages and | 10
Examine the various levels ;
H es.
their implications with suitable eames
appli
Build a Java program for a banking 20 PIR ew ae we .
where a person tries to withdraw the cen a eption,
fa custom CXeepyjgny NOUEh he/she has lesser
than minimum balance (Creat
Ln sana eee
OR a
———— fon handling = —s=————
ception. Explain Exeep mechanism provided in Java
th syntax and example.
13 | Co4
along —
| Build a Java program to create @ packige “balance containi ay +
| Class with displayBalance () method 2d import this packa g Account | 10
P Cl is package in another |
program to access method of Account Css,
al ane |
S5uy |
Modul
ent Ways of creating a thread,
QB [a. | Define thread. Also discuss the dif
b. How synchronization can be achieved between threads in Java? Explain
| with an example.
| Develop a Java program Tor automatic Conversion of wrapper class type |
|
onstrates unboxing.
OF.
©
| | into corresponding primitive type that d
. | Summarize the type wrappers supported in Jave
| | Explain Autoboxing/Unboxing that occurs in expressions and operators.
c. | Develop a Java program to create a class myThread. Call the base class| 8 | L3 | COS
| constructor in this class’s constructor using super and start the thread. The |
| run method of the class starts after this, It can be observed that both main |
| thread and created child thread are executed concurrently. |
theae
| 6 | 12 | cos |
@ scanned with OKEN ScannerGes gonlsils
ripiidlelc Silos ¢ BCS306A
s {IRILEECS 0 RI) ;
pird Semester BE/B-Tecy~ gree Examination, June/July 2024
object Orientay , gramming with Java
us
T
rime: 3 hes Max. Marks: 100
Note: 1. Answer any FIVE fu
3M: Marks. L: Bloom VE full question from each module.
Westigns, choosing ON
Fevel , ¢; Course outcomes.
circuit op% _
Write @ Java program with arniethog to check whether a given number is | 7
prime oF not
+
OR ay
plain various scopes OF variables in Java
rithmelic Compound;
Search on an array
accepted from ke accepted from key board.
- Modute —2
37 Explain method overloading in Java
h examples.
rack cla
to hold maximum of N numbers with
i ain method to itiusirate
OR
nthe role of “this” keyword and “st
word in Java.
ID, Name and Salary. Write a | 1
nnd a static method to display
able. Main method for |
class called “Employee” with field
method to raise sal,
onstructor
The number of Employee objects
illustration.
Module ~ 3
the role of “Super” with example Java
=
ple, eXplain method overriding. — | 5
class and any method as
ed “Shape”. Create 3 sub classes
member function area () and
create class ca
ware. Each class has
with a suitable main pr
=) Develop a Java pr
: circle, triangle and squ
‘am
0)
a. | Explain the order of constructor execution in a multilevel class hierarchy
Define dynamic method dispatch and write a code snippet in Java to[ 5 [LI | CO
demonstrate.
1 of2
@ scanned with OKEN ScannerDevelop Tava program © cre
width (int width) and_resize
tin pResizable with metiiods resize
reat imple EH that allow abject to be
wezed Create a class Rectangle tH" ™Plements ‘This imtertage,
Explain four categories of visibility
‘88s members based on packages.
ception hana ane
| Give the general form of an ECPM Binding Block and write a Fava
program to illustrate multiple catch cl#SSes,
°
Write @ custom exception in Java called
fuatorye si°SS Marks” and raise This
exception when marks entered by ¥#lU*l0r in the range [30 — 34]
OR.
Q8 [a
= iH to Ga
a. | With code snippets. explain mechani" (0 create and importa package in
Java.
b.
d excent +
Write a Java program to oreate chained exceptions with topclevel exception
is Null Pointer Exception and i's cause Arithmet
Exception.
Develop a Java program 0 create Sustom exception’ for Negative odd | 7
| numbers.
~ Module —5
Qo aT Explain various methods of thread class in Java.
[6 | £2 [ cos}
= Write a Java program to crete 4 thvcads and cach thread when run, wilt} 8 | L3 [ COS |
sleep for 500-milliseconds and print its name before “Before Quitting”. \
pet Piplain the use of Type wrappers in Java with example. | 6 [2 { cos |
OR, |
Q.10 J a. | Explain is Alive () and join’() methods of Thread with example code | 6 | L2 \
i | snippet. \ |
$7] Write a Java program to create 4 Rread and-each Thread generates random | 8 | L3 |
number and prints it and sleeps for 800 msec and quits. | |
/ Explain the concept of autoboxing /unboxing in expressions and methods. \ 6 2 | COS |
Fae te
@ scanned with OKEN Scannerwv (ella
‘rime: 3.h1S-
Cag gensiile
AC|s |olo) .
phird Semester B-E./B.Tech, pegree supplementa
- De}
. . June/Suly 207
Object Orienteg p,ogram™
Note: I. Answer any FIVE full questions, enoosing ONE it
2M: Marks , L: Bloom's level. cz Course outcomes,
and explain OOP'S pri
jelloworld {
Public static void main (String [ j args) &
inta eae
for(a=0;a<3;a+4)
t
int b=-13
system.out.printin (* =b):
0s
system.out.printin (* * ab)
3
system.out.printin (“Heilo, world:”)
i
}
What is the output of the above code?
BCS306A
ry Examination,
4.
ing with Java
Max. Marks: 100
cestion from etich moditle.
8
6
Develop a program to find an aver
‘ using for each locp in JAVA.
How arrays are defined and used in
Briefly explain the various primitiv
Explain the following jump statements
J class called Employee. which mode!
salary. The method raiseSalary (percert
percentage. Develop the Employee Ciass and suitable
) increases the salary by the given
(i) Break Gi) Continue
~___ Mod! __ 4
Ga Ja | Explain the constructor method and 10 | £3 | CO2
with suitable examples. _
bo Discuss the significant features of the lle 4 | 12 | coz!
(this |
L (i) static _|
| What 6 | 12 | Coz
| using java program.
r - ey oR 2
FQ4 Ja. | Write a java programs to illustrate : 10
i (i) Passing object as parameters.
| Gii)__ Returning objects |
j employee with an ID, name and | 10 | L3 | CO2
main method for j
demonstration. a
- Tof2
@ scanned with OKEN ScannerTp.) What
With
ample. give 10 Us
nethod dispatch.
| dynam
sof
are the
super
cn’ Write
dynamic method disp a
Tin word
Briefly explain the final Key
*eps involve
any three java Bui
What is chained exception
of handling chained exceptions.
explain,
example that illustrates
a. [ With Syntax. explain values ()and vaiue ©
of ( ) methods.
thraads in JAVA, WITS
le listens
4 6 | 12] cos]
b./ | List and Discuss the Numeric type y ‘pers methods. 6 | 12 | co4 |
¢. | Write a program to demonstrate the following : 2 | C04 |
()—Atype wrapper -
LW Autoboxing/Unboxing \ | |
@ scanned with OKEN ScannerThird Semester B.E. Degree Examination
Object Oriented Programming with JAVA
‘TIME: 03 Hours Max. Marks: 100
Note: 01. Answer any FIVE full questions, choosing at least ONE question from each MODULE.
02, Use a JAVA code snippet to illustrate a specific code design or a purpose.
*Bloom’s
Module -1 Taxonomy | Marks
Level
QO1_[a | Explain different lexical issues in JAVA 12 7
Define Array. Write a Java program to implement the addition of two matrixes. 13 7
| Explain the following operations with examples. (i)<< (i)>> (ii)>>> 12 6
OR
02, [a | Explain object-oriented principles. 12 7
‘Write a Java program to sort the elements using a for loop, 13 7
| Explain different types of if statements in JAVA 12 6
Module-2
QOS [a] What are constructors? Explain wo pes of constructors wih an example |, , 7
program.
DDefine recursion. Write a recursive program to find nth Fibonacel number. 13 7
¢ | Explain the various access specifiers in Java. L2 6
‘OR
Q04 [a | Explain call by value and call by reference with an example program rr 7
| Write a program to perform Stack operations using proper class and Methods. 13 7
| Explain the use of this in JAVA with an example. 12 6
Module-3
QOS [a] Wrie a Java program to implement mulilevel inheritance with 3 levels of | 1 7
hierarchy.
b_|_Explain how an interface is used to achieve multiple Inheritances in Java, is 7
€ | Expluin the method overriding with a suitable example. 12 6
OR
06 | w | What is single-level iheritanee? Write a Java program to implement single-level] 5 7
inheritance,
©] What is the inportance of the Super Keyword in inheritance? Mustate with a]
suitable example.
© | What is abstract class and abstract method? Explain with an example. 2 6
Module-4
@.07 ] a | Define package. Explain the steps involved in creating a user-defined package io 7
with an example.
| Write a program that contains one method that will throw an
legalAccessException and use proper exception handles so that the exception | L3 7
should be printed.
@ | Define an exception, What are the Key terms used in exception handling?
Explain, La 6
OR
Q.08 | a] Explain the concept of importing packages in Java and provide an example | > 7
demonstrating the usage of the import statement.
| How do you create your own exception class? Explain with a program. is 7
¢ | Demonstrate the working of a nested try block with an example. 12 6
En Page 0 of 2
@ scanned with OKEN ScannerMe ae cane panenngee Cp EYE FRA HE CERAM OEE HAHA pARL ARES De 7
with an example.
b| Write a program that contains one method that will throw an
MlegalAccessException and use proper exception handles so that the exception 13 7
should be printed.
¢ | Define an exception. What are the key terms used in exception handling?
, L2 6
Explain.
OR
Q.08 [a | Explain the concept of importing packages in and provide an example 2 7
demonstrating the usage of the import statement. -
b | How do you create your own exception class? Explain with a program. 13 7
¢ | Demonstrate the working of a nested try block with an example. 12 6
Page 01 of 02
BCS306A
— Module-5
Q.09 | a | What do you mean by a thread Explain the different ways of creating threads 12 7
b | What is the need of synchronization? Explain with an example how
L3 7
synchronization is implemented in JAV/
¢ | Discuss values() and value Of0 methods in Enumerations with suitable examples. L2 6
OR
Q.10 | a | What is multithreading? Write a program to create multiple threads in JAVA. L2 7
b | Explain with an example how inter-thread communication is implemented in 3
L3 7
| JAVA.
cc _| Explain auto-boxing/unboxing in expressions. L2 6
@ scanned with OKEN Scannerwes Ve YUP Y@M CF 19008 SUUUYIAE Vue
rT
FM Ot
Subjected Name J Object Oslerted Programmi bith “Jaye.
sat fle
(sn 5 RTeersQODS With “JAVA:
Giate WN anfiae oo) smeoae =A
2
GE Cp for ipennte pr of If
®
®D
@
ea
3)
&
ae
Uniovlant euren
habrrents
wm Java Wy onerenple..
pomentivte voriling of book aah ee ”
JAVA . 4s
Lecieal un Savas Grplein oopit-
fain Aeon hoe
oO as te fat, the thers Wing
Witt, a faye
er lap, Ate et
s Lys Lh MaperplS-
ne frye b Ubabvte beak htament
\
at, labo ) “ . :
woptccn the jdtering | opens ci, Ceemple
W Ze wh 77 WO 772) k.
} oligo venprs 9
Demnmisate Phe Watleng of Crhered fa leup
Wines, Ohne: Nae a" |
eh ores Prrrretien ales, en JHA |
@ scanned with OKEN Scanneri) Wret ate! | Censtasctos 2 ep wo taps 4
Consinuctoss NU exemple.
® eoupleir resco ablecsctemm’ bx Use 4 qe“ tellectn
‘on Jima:
Bplay CAM oy value en ern
Wit, oatarmpe. Payren
& _ O40 Stetic Vayatle Sy sti, sretrods
in Jayne } ‘ ; .
BQ rite 2 Savy poate — demanctscbng
Method ‘“orertoadeng,
Cc) Comparizen Yor mrithed Ovectonétng dS rmethod
, Sreeriden . \
Ene eeutsiin mente A TRLUTION prepa
Ai’ find orth Pitemaced unten +
ED Wily a “pry te Pevfanm Sind sfevation
Urey Paper ASK method
@ scanned with OKEN ScannerTv +e eVTVFTFITVTVUVVVGOVOT “Ye
6
6
G &.
@
6 ©
pasting mow,
wWheb & Meant by nbfre & Shite iY nted
by We Synten & feativns bnberface.
ly erterd Uniedete
wot OG SAva Pye
Antari Qurtolle data ;
Eruplarn Unbesitence, by Pd\yrnaphion feturs Ff Iva.
Wyre 4 fengle Pry oom t Poneman erplchenite.
SA Phpretthin in Piva
What “UY obstmet clan & abitoact muted 2 toxplainn
WE, Chamgle,
Whidh ave BX Tesbtetinn patient for Sethe’ decleved
Omdhod és ? \
Crtacn herd Mitergee [ ukd “te Atle 4
crmubfipe. nberHemees in) JAVA. ove
Wirak ° sone * Level Enhetente: 9 Griptuy WU,
Grits Wiomnte ‘
Which ome “Ge Test chim Poses ber Giskte deeluey
Pao s 7,
&
. Monte sie Pasgtatr mentuty
hit i peetioge 2 thy cto we Crete it Ave
the "Uadinnle ‘to raste &y do ALteMs Pansy
@ scanned with OKEN Scannerwos te add mi chess to a pactage }
foepiain bith oremnpl.
6
Vee a mie on Actes prsteclam Jos.
* edmganding bf abstract Lage es Kan
trad ade the ways “to Aces Prutege pen
‘ drnckter paLtage 4 Caplan Cath temple:
Explain how tt hen, Yrnflemend am Sle gete
with = Garnge « ' i Bibieccd
an fey WTng, Tested toy black, With en
@ ®@ 6 66
wgkat WU Oza » tshet eke tre buy Bray eet)
by teagan ania Raped "#
(
iba ds gai Cathe Your onsen OmUEHGen Clets 2,
Cauylaiin With & Pp:
Suseidh
ah beh tnumerduvy » Give on Gemple
ies at . >
@B] Eryn how canter Caaprnaeing » Trbrmeng
A Gbrpping reads With en Osemple FIT
G
a me 2426720800800 89800AS
Gy WA Sela riglarn, of MH Alive) \& Yeatl)
enxhods «
@ scanned with OKEN ScannerKD Pnumerstins tn dave Ua cles fey! yuskyy
Hhiy Stsumenk with — apppooparrte- Oxaonaples.
Coes
@
®@ Wh Ue ursagper clesies Y Cnylec with YXemples
GQ we & emnulhitveading 2 Lusite a parr te
©
Usext arti threats AVA
dhe cod 4 Synehntiton © OYGin wou,
y whet a4
= Chernple hoy (ymnemnueten Vs eeplemerttec|
om
vy Save
be Vette of ©) andthots #7
GY ORuus vetue C)
Cnn CHO) Sulit Stam plese
to
hak UU aneent by Urseed poesity # es
ayn & ge he Uyseag prieslty
7 FOO OOO0F0569G5HOHHV98HOOT TEESE
@ scanned with OKEN Scanner