0% found this document useful (0 votes)
131 views17 pages

Java Programming Question Paper 2023

The document is a question paper for a Java programming exam consisting of 3 sections - Section A with 10 short answer questions carrying 2 marks each, Section B with 5 questions carrying 5 marks each, and Section C with 3 questions carrying 10 marks each. The exam is for a 3 hour duration and covers core Java programming concepts like OOPs, multithreading, exceptions, files and sockets.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
131 views17 pages

Java Programming Question Paper 2023

The document is a question paper for a Java programming exam consisting of 3 sections - Section A with 10 short answer questions carrying 2 marks each, Section B with 5 questions carrying 5 marks each, and Section C with 3 questions carrying 10 marks each. The exam is for a 3 hour duration and covers core Java programming concepts like OOPs, multithreading, exceptions, files and sockets.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Total No.

of Pages : 02
Roll No. III
Total No. of Questions : 09
[Link](IT) (2011 Onwards) (Sem.-5)
PROGRAMMING IN JAVA
Subject Code : BTIT-502
Paper ID: (A2123] Max. Marks : 60
Time: 3 Hrs.

INSTRUCTION TO CANDIDATES :
questions carrying TWO marks
1. SECTION-A Is COMPULSORY consisting of TEN
each.
carrying FIVE marks each and students
2. SECTION-B contains FIVE questions

3.
attempt THREE
have to
questions carrying TEN marks each
and students

Seemnt any TWO questions

SECTION-A

1) Write briely :

n List primitive Java types.

What is finalize() method? DSOfice


What is Abstract class?

d Explain the following line used under Java Program


public static void main (String args |)

What are Wrapper classes?

f Describe life cycle of thread

g. How finally keyword uscd under Exception Handling?


h Explain JVM.

i What is runtime polymorphism or dynamic method


dispatch

j What is a Socket and advantages of Java Sockets?

(S2)-994
1| M-70595
Roti Ne.
Ttal Meg
Total Ne of Queatlona
[Link].m (em
INTRODUCTION TO JAVA h
runple

4 fgan
Time : 3 Hrt WaL Ela
waterlestta h the h
TCTo To CAOIDATES
sHCIOKa YE SLCTONc
SECTION-c ctalns THREE Vtile

Writr briely 1
wht dea xapdata
StCTIONA

2SOffice: Eyan e lt ccke

lshaURL

What

d What
Wy enainpotee l c
e
Wheadng

e Define apples

6
CSE CIT)-
Roll No....
Total No. of Questions: 091
Total No. of Printed Pages: (01
[Link] (CSE(Semester-s)
JAVA PROGRAMMING
SUBJECT CODE: BCSEI-522
Paper ID: |111113|
Time: 03 Hours
Instruction for candidates: Maximum Marks: 60
Section A is Compulsory.
2. Attempt any FOUR questions from Section B.
3. Attempt any TWO questions from Section C.

QI. Section-A (2 marks each)


a) Explain the
b) Distinguish difference between Java and C++.
betweenn error
c) What are Java and exception.
Tokens?
d) Why Java is called Explain using any example.
e) Explain Event Platform Independent Language.
handling in Java.
) Explain the wait and sleep methods
g) Explain the functionality of JVM. used in Thread Exccution.
h) What is AWT?
i) How to throw and catch an exception?
i) What are different I/O Stream Classes?

Section -B
2. Explain the difference between an applet and an application? Explain the (5structure
marks each)
of an
applet.
Q3. Can multiple inheritance be implemented in Java? Discuss by writing.
04. What are Layout managers in Java? Explain using suitable example.
Q5. Explain Method Overloading in Java using any example.
Q6. Write a program in Java to perform different arithmetic operation using Switch-Case?
Section -C (10 marks each)
Q7, Explain the different methods which are used for Inter Thread communication?
Q8. What are the Main Components of JDBC? Write any Java Program to implement the concept.
09. Write short note on:
a) Use of this keyword
b) Garbage collection in Java
Pages : 02
Tetal Ne. ef

Tatai Neet Qusatios


BTecho TO JAVA
INT eet cetet
Paper

Tim :Hr
CAYIDATES
IMSTAUCcHPJLSORY
SECTIOC
SECTIOH canapUR SuEem
3ECTIOaR
SECTIONA WPS Offg T atOa
FAST t
secfe

Witr briefy
Ae VM pta mindejundet
Wyo Why na
Ca emde ate meted

whul saSnckrt
and finaty
Dfeence betwten fnal r Eplan wth ung
ean ur perse aUR
How can
ef wpe
Whal ar e arplkatiss
21C
Defne applct

14Cede SASS5

T) =3S
SECTON-B

cxception handling mechanism


Write any program to claborate the concept of
finalize in Java
3 Explain differences between final, finally and

4 What is multithreading? Explain java thread model.


5 Explain the nced of packages in java with the help ofa program
6 Explain garbage collector in Java.

SECTION-C

preferable language over the years.


7 Explain in detail that makes java the most popular,
java supports multiple inheritance
8 Explain different types of inheritance in detail and how
VPS
using any suitable program
Write short notes on :
9.

a Thrcad synchronization

b. Socket programming

c. JIT Compilation

(S2)-196B
2IM70595
Total No. of Pages : 02
Roll No.
Total No. of Ques tions :09 (Sem.-5)
[Link](|T) (2011 Onwards)
PROGRAMMING IN JAVA
Subject Code : BTIT-502
Paper ID : (A2123]
Max. Marks : 60
Time :3 Hrs.

INSTRUCTION TO CANDIDATES :
TEN questlons carrying TWO marks
1. SECTION-A Is COMPULSORY consisting of
each. marks each and students
2. SECTION-B contalns FIVE questions carrying FIVE
has to attempt FOUR guestions.
TEN marke sach and students
3. SECTION-C contains THREE questions carrying
ttempt any TWO questions.

SECTION-A

Write briefly :
a Why Java is platform independent language?
b. Why java does not support multiple inheritance?
c What is the difference between throw and throws
keyword?

d What is the need of super keyword in java?

e. Define Multithreading.

f Define Constructor.

g What is an applet?
h Why do we nccd socket programming?

i What is JDBC?

j What is an abstract class?

(52)-1966
1| M-70595
SECTION-B

2
Explain the visibility controls in Java.

3 Write program in Java to convert a string in lower case to uppercase.

4 Write a program in Java to demonstrate operator overriding.

S. Explain the steps in creatinga thread using runnable interface.

6 How do we pass parameters to applets in Java? Demonstrate with example.

SECTION-C

7. Write a program in Java to find first n prime numbers, where n is any integer and should
be taken as input the user.
8 What are different types of Inheritance supported by Java explain in detail?

9 Explain the following with the help of example


a. Thread scheduling

b. JDBC

2 M-70595 (52)-2342
Roll No.
Total No. of Questions : 09 Total No. of Pages : 02

[Link](IT) (2011 Onwards) (Sem.-5)


PROGRAMMING IN JAVA
Subject Code : BTIT-502
Paper ID: [A2123]
Time : 3 Hrs.
Max. Marks : 60
INSTRUCTION TO CANDIDATES :
1. SECTION-A is
each.
COMPULSORY consisting of TEN questions carrying TWO marks
2. SECTION-B
contalns FIVE
have to attempt any FOUR questions carrying FIVE marks each and students
3. SECTION-C contains THREE questions.
questions carrying TEN marks each and students
have to attempt any TWO questions.

SECTION-A
1.
Write briefly :
WPSOffice
a) Use of String buffer class.

b) Java tokens.

c) Type casting.
d) Pros of Java
programming language.
e) Static members.

) URL connection.

g) Applets.

h) Hiding classes.

i) List the data types available in Java.


j) Runnable interface.

1|M-70595
($2)-2342
What is inheritance?.Why java does not support nultiple inheritance1

SECTION C

7 Explain different types of operators used in java programming Writen simple program to
demonstrate operator precedence in java.

What is exception handling? How multiple exceptions are caught in asingle


program? WAP to demonstrate the use of custom exception.
9. 1Wite a short note on
a
b
Throw Vs Throws
WPSOffice
Thread Synchronization
C. Recursion
JDBC
of Questions: |09]
BTech. (IT) (Semester -gt Total No. of Printed Pages: (01|
Na.

PROGRAMMING
SUBJECT CODE: IBTIT502
N JAVA
Hour
Paper lD: (5112102
patruction
for ca candidates:
section A is Compulsory.
FOUR
Maximum Marks: 60
Anempt any
TWo questions from Section B
Aftemptany questions from Section

AnSwer the Following in brief: Section -A


(2 marks each)
class?
a) What is a
b) What is type promotion?
Define operator precedence.
d) Explain garbage collection.
What is recurssion?
e)
PSOIce
What is the use of 'final' keyword
o) What is a thread in Java?
h) What is exception?
) What is string buffer?
i) What is an aplet?
Section -B (5 marks each)
02 Discuss the database connectivity in java.
(0. Write a program to seracha string in the given text.
(4. What is method overloading? Explain by suitable example.
(06. What is the difference between package, interface and a class? suitable
h What are bitwise operotors? Explain the use of different bitwise operators using
examples.
Section -C (10 marks cach)
oriented programming? Explain the different feastures of OOP, and
W What is object Java laguage using suitable examples.
explain how they are implemented in casting rules in Java.
DIscuss different data types and type
handling. Explain keywords and their usage in
different
P Discuss the need of exception
exception handling.
BTech, (T) (Sem. S)
PROGRAMMING IN JAVA
Subject Code: BTIT-502
Paper ID: A2123
Time: 3 Hrs.
Max. Marks: 60

INSTRUCTIONS TO CANDIDATES:
Section A is COMPULSORY consisting of TEN Questions
carrying TWO marks each.
2. Section Bcuntains FIVE questions carrying FIVE marks each and students have to
attempt any FOUR questions.
3. Section C contains THREE questions carrying TEN marks each and students have to
attempt any TWO questions.

SECTION A
1. a List four important features of Java language.
b. What is JVM?
C. Difference between epplication and applet
d What is dynamic metlhod dispatch?
Define garbage collection
f

8
What is use of final keyword?
Define Exception
Office
h. Define Server Socket
i What is difference between interface and abstract class
What is the use of "this" keyword?

SECTION B

2. Explain what makes Java as platfornn independent language?

3. Explain Multithreading. How Java implements its Thread model?

4. Write a program to implement the Fibonacci series using for loop control structure.

What is string handling? Wito aprogram to comparo the two stringa in java

Page 1 of2
| M70595
nll NO.**estions: |01 Total No. of Printed Pages: (01)
Total No. of
B. Tech. (CSE)
(Semester-5th)
JAVA PROGRAMMING
Subject Code: BCSEDI-S14/BCSEM1007
Time: 03 Hours Paper ID: [18111127]
Instruction for candidates: Maximum Mark: 60
1 Section A is compulsory. It consists of 10 parts of two marks each.
) Section B consist of 5 questions of 5 marks cach. The student
has to attempt any 4
questions out of it.
1 Section C consist of 3 questions of 10 marks each. The student has to attempt
any 2
questions.

Section-A (2 mark eacb)


QI the following:
Qhat is meant by onerator precedence? Discuss with an
cxample.
b. What is meant by method overriding?
C. What are checked exceptions?
d. What are Wrapper classes?
e. What is JVM?
f. What are unchecked exceptions?
8. Give the complete mcaning of the statement "public static void main(String arg|)".
h.i. Write
What isthethe difference between a thread and a process?
difference between throw and throws.

j What are applets?


02. What is
PN
function overloading?
Section -B (5 marks each)
Is operator overloading possible in Java? Write a program
to show the concept of Function overloading using inheritance.
types of exceptions and then incorporate
Q3. Create a try block that is likely to generate two ty
than necessary catch blocks to handle them [Link] Java application programs?
the Q4. What is an Applet? How applets are different from
Discuss
front-end applications with any database using
Q5. Briefly explain the procedure of connecting
JDBC.
wait( ) and notify( ) methods?
Q6. (a) What is the purposeofofthe Scanner class that
(b) Name the methods Integer data from the standard input stream
() is used to input stream
String data from the standard input
(i) is used to input a (10 marks each)
Section -C
to demonstrate
types of inheritance in detail. Also, write a program
Q7. Explain different
multiple inheritance-using interfaces. help of a
with the
multithreading in Java? Explain inter-thread communication
Q8. What is
suitable example.
What is the utility of packages? How packages are created,
9. (a) What are packages? with the help of an example.
imported, and used? Discuss demonstrate the concept of operator
overriding? Write a program to
(6) What is operator
overloading.
Roll So..*****
atal No. of Questions: J09)
Total No. of
Printed Page: 01|
[Link] (CSEXSenester -s)
JAVA PROGRAMMING
SUBJECT CODE: BCSE1-522
Time: 03 Hours Paper ID: |111113|
Jestruction
Scction
for candidates:
Ais
1.
Atempt Compulsory.
any FOUR
Attempt any TWo. questions from Section B.
Masimum Marks: 60
questions from Section C.
Q
A. Section -A
Structure of Java (2 marks each)
h. Name the various Program.
c. String Buffer Classprimitive data types in Java
d. What is difference
Define the purpose between static and abstract class?
of garbage
f. What is the use of Finally collection.
What is the purpose of class in Exception handling?
h. doPOST
What is the role of Driver method
i.
What is difference betweenManager in JDBC?
j. How JSP is different from pancl and frame?
Servlet?
Q2. What is array? How arrays are Section -B (5 marks each)
Q3. handled in Classes?
What is Method Overloading? Write a program in
Java to illustrate the concept of Method
Overloading?
Q4. Explain the various ways to handle
Q5. What do you understand by Eventexception
with an example of each.
Delegation Model in Java? Describe with suitable
Cxample?
Q6. What is JSP? Explain the concept of JSP with suitable
example?
Section -C
07. What areInterfaces? How it is different from Packages? Explain the uses(10ofmarks each)in
inheritance with an example. Interfaces
Q8. Broadly discuss the concept of Multithrcading in Java with suitable
09. What are applets? What are the advantages of using example.
Explain the details with lifecycle of applet. applets for wcb programming?
Total No. of Pages : 02
.Roll No.
Total No. of Questions : 09
[Link].(IT) (2011 Onwards) (Sem.-5)
PROGRAMMING IN JAVA
Subject Code : BTIT-502
Paper ID: [A2123]
Max. Marks : 60
Time :3 Hrs.

INSTRUCTIONS TO CANDIDATES :
carrying TWO marks
1. SECTION-A is COMPULSORY consisting of TEN questions
each
each and students
2 SECTION-B contains FIVE questions carrying FIVE marks
have to attempt any FOUR questions. students
3. SECTION-C contains THREE questions carrying TEN marks each and
have to attempt any TWO questions.

SECTION-A

Write briefly :
a) What is inheritance in object oriented programming? Discuss in brief.
b) What is meant by operalor precedence? Discuss with an example.
c) What is the use of defuult keyword in switch statement?
d) What is an abstract class?

e) What is meant by method overriding?


) What is the utility of interfaces in Java?

g) What are checked exceptions?

h) Howa thread is similar to a program? Discuss in bricf.


i) Bricfly discuss any two methods of StringBufler class.
i) What is JDBC?

S2) 146
NPCTKINN the
organaton Incluke
ef an
ihe emplyees
Faypkoyee to epresent
cla
adleess, departmen
the empkyee,
tulas of an empleyce,
, naedispt
emets empleycevalues, le
Methode m intal
ulary of an empkyee inlormaton yourscl
ume any sequircd
Apreoprately using ecson
Fhonakci series up lo n lerms incorparale
pint ofeceptnns and then
Wrte a methd lo yenerate fwn types
lakely te
Creele &try bkxk that isto handke Ihem appropru
nrary calch hkcks
Eplain the lfe cyck ofa
thresd
from standalone
JavE application
ate diflerent
an Appkt? How pplets
Whal
Discuss
pgrah

NECTION-C to demonstrate
detail Also write a proyram
rikance in
1 Explain difleret types of
muluple inherilance-usinjg-Me imported
How packages are created,
he utality of packages?
anample Alsu discuss
packaye ccess proee
What are packaeswh help
and uscd Discuss with the highlighting eticnt and servet sockets nd
Juva
res of demunsisie clent scrver conce etein a
Wde a nole on nelwkny
Also wrte er responde to that request
thee unae d
clent ends the roquest
3

estions: 091 Iotal No, of Pinied Paes:


0|
B. Tech (CSE)
SUBJECT (Semester5h
JAVA PROGRAMMING
CODE: BCSEL
Time: 03 Hour Paper D: |1111131 E1-522
Instruction for candidates:
Section A is Maximum Marks: 60
Attempt any Compulsory
FOUR questions from
3. Attempt any TWO questions from Section B.
Section C.
Q1. Explain briefly: Section-A (2 marks each)
What do you mcan
b. How is java more by Bytecode in Java
What do you meansecure than other
by user
programming
languages?
d. Java is object orientated defined exception?
c. How many type of socketprogramming language: if yes then justify your answer.
Namc the available in Java?
borders provided by
Define Swing.
Multithreading
What are the diffcrenceprogramming with the
between Java and C++?help of suitable example.
Define Java beans.
W'hat is the difference between overriding and
overlioading?
02.
Section -B (S nnarks each)
Write a program in Java to create first 100 Febonacci
number.
03. Discuss the various primitive data types supported by Java.
04. What do you mean by classes and objects? Explain with suitable exanples and how
classes and objects are crcated in Java.
Q5. List all the propcrties in Java beans. Explain any one of them with suitable program.
06. Write a program in Java for displeying frame window and place a level at middle of the
frame with the help of border layout manager.
Section -C (10 marks each)
Q7. What is the JDBC driver? Explain all the functions of a JDBC driver and their advantages
and disadvantages. Applets, on clicking on this button the
Q8. Write a program in java :o create a button using also.
current appiication should close.
Explain the output than
What is difference between AWT and Swing? In what vay Jbutton is better
09.
button class? explain with example.
SECTION-B

2) Wile a Program using the concept of Inheritance, to set, lo get and comnpare the fcatures
of dilferent Vehicles Create diflerent methods lor ach

3) What is function Over koading? Is operator overlosd1ng is possible in Java? Write a


program to show the concept of Function overkoading using inheritance

4) Explain the terms

a) Final

b) Super

5) Write the Syntax of following :


a) While loop

b) Switch case

6) Differentiate between Interface and Abstract Class, with example

7) Explain the following keywords with example :


a) Bytecode
b) Extends

c) This
for
8) How an Applet is crcated? Describe the Applet Life Cyck What are the requircments
crealing an Applet?

9) a) What is multithrcading? Give twD advantages and disadvantages of multi thcading


b) Write a program in java that reccive two numeric inputs from uscr and then perform
different arithmetic operations e
on them

2|M-70595

ET- 39

Common questions

Powered by AI

Garbage collection in Java is an automated process aimed at managing memory by reclaiming the memory occupied by objects that are no longer in use or reachable. The JVM performs this process, alleviating programmers from the burden of manual memory management and reducing the risk of memory leaks and pointer errors. Garbage collection improves system performance by efficiently utilizing memory, though it may temporarily pause application execution during its operation, impacting real-time applications where consistent processing speed is critical .

Java handles exceptions through a robust mechanism that includes the use of try, catch, finally, throw, and throws keywords. The try block contains code that might throw an exception, the catch block handles the exception, and finally executes code after try and catch regardless of whether an exception occurred. Throw is used to explicitly throw an exception, while throws declares an exception. Exception handling is crucial as it enables developers to manage errors gracefully, maintain normal application flow, and improve fault tolerance by logging errors and cleaning up resources, which prevents many runtime failures .

Java achieves platform independence through the use of the Java Virtual Machine (JVM). When Java source code is compiled, it is transformed into bytecode, which is a platform-independent intermediate form. This bytecode can be executed on any device equipped with a JVM, which interprets the bytecode into machine code native to the host machine's architecture. This abstraction layer allows Java programs to run consistently across different operating systems and hardware configurations without modification .

AWT is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit. Swing, on the other hand, is built on top of AWT and is part of Java Foundation Classes (JFC). Swing is platform-independent and provides a richer set of GUI components with a more flexible architecture. Developers may choose Swing over AWT due to its lightweight components, pluggable look-and-feel support, and greater consistency across platforms. However, for applications requiring access to native system components or minimal overhead, AWT might be preferred .

Layout managers in Java are responsible for defining the positioning and size of components within a container. They free developers from manually calculating component placements and sizes by providing consistent appearance across different platforms and screen sizes. Various layout managers, such as BorderLayout, GridLayout, FlowLayout, and GridBagLayout, cater to different needs. For instance, BorderLayout divides the container into five regions, GridLayout arranges components in a grid, FlowLayout aligns components sequentially. Choosing the right layout manager is crucial as it can simplify the complex GUI creation while maintaining aesthetics and usability .

Java does not support multiple inheritance through classes to avoid complexities like the diamond problem. Instead, Java allows a form of multiple inheritance through interfaces. An interface can contain method signatures that multiple classes can implement, thereby allowing a class to inherit behavior from more than one interface. This promotes a stronger abstraction and design flexibility. The benefits of interfaces include creating loosely coupled systems, easier testability, and the ability to define roles/APIs without dictating specific implementation needs. However, a challenge is the potential for implementation complexity when numerous interfaces are combined in a class, as it might require multiple uncoordinated changes on interface updates .

Java Database Connectivity (JDBC) drivers are client-side adapters (part of the core API in Java 2 Platform Standard Edition) that leverage the JDBC API to interact with a database. They act as a translator between the application and the database, converting Java calls to database-specific calls and vice versa. JDBC drivers facilitate database connectivity by allowing applications to execute SQL statements, retrieve results, and propagate changes. They come in four types: Type 1 (JDBC-ODBC bridge), Type 2 (Native-API), Type 3 (Network Protocol), and Type 4 (Thin driver). Each type offers different attributes in terms of portability, performance, and scalability .

Method overloading occurs when multiple methods in a class have the same name but different parameters (different type or number). Overloading allows methods to have different behaviors based on the input parameters. For example, two methods named 'print' can differentiate based on whether they take a String or an integer as a parameter. Method overriding happens when a subclass provides a specific implementation for a method already defined in its superclass. The overridden method in the subclass should have the same name, return type, and parameters as in the superclass, allowing runtime polymorphism .

Multithreading in Java allows concurrent execution of two or more parts of a program for maximum utilization of CPU. Java enables multithreading through the Thread class and Runnable interface. The Runnable interface is preferred as it avoids Java's inheritance limitations by allowing objects to implement Runnable while extending another class. To implement multithreading via Runnable, a class must: 1) implement Runnable, 2) override the run() method with the task code, 3) create a Thread object passing the Runnable object as a parameter, and 4) start the thread using the start() method of the Thread class. This approach provides flexibility and enhances application throughput .

Java enforces checked exceptions to ensure that a program anticipates and gracefully manages conditions that aren't typically recoverable. Checked exceptions represent known conditions that a well-constructed program should expect and handle, such as database access errors and file not found errors. By requiring these exceptions to be declared or handled, Java promotes the explicit communication of a program's failure states and recovery strategies. This guards against unforeseen crashes and bolsters program reliability, compelling developers to address potential sources of failure during the development phase .

You might also like