0% found this document useful (0 votes)
59 views7 pages

Java Programming Exam Questions

Previous four year question paper of java

Uploaded by

nashwariza07
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)
59 views7 pages

Java Programming Exam Questions

Previous four year question paper of java

Uploaded by

nashwariza07
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

ililtifliltitiliifiilrillilllliililtllltililiili K22u 2293

Reg. No. :

Name : .............
V Semester [Link]. Degree (CBCSS OBE - RegularlSupplementary/
-
lmprovement) Examination, Novemb er 2422
(201 9 Admission Onwards)
CORE COURSE IN COMPUTER SCIENCE
5B09CSC : Java Frogramming
Time : 3 Hours Max. Marks :40

PART - A
(Short Answer)

Answer all questions. (6x1=6)

1. Name any two features of Java.

2. What is byte code ?


3. Expand AWT.

4. What is a class path ?


5. What is JVM ?

6. What is Applet ?

PART -B
(Short Essay)

Answer any 6 questions (6x2=121

7. Compare Java with C and C++.


8. Write a short note on static methods.
9. What is synchronization in Java ?

10. Explain logical operators,

P.T.O.
K22U 2293 illllliil ilililll tff ilfil irill llil lllll lililllr

11. Explain any two ways to create threads.


12. Explain chained exception in Java.

13. Write about <applet>tag.

14. Explain arrays in java.

PART _ C
(Short Essay)

Answer any 4 questions (47a3=121

15. Explain DMD with example.


16. How to create user defined packages in Java ?

17. Explain data types in Java.


18. Explain 'final' keyword.
19. Exptain the use of constructors in java.
20. Explain Multi-Threading.

PART _ D
(Long Essay)

Answer any 2 questions (2x5=10)

21. Explain various operators used in Java.


22. Explain packages and interfaces.
23. Explain exception handling in Java.
24. What are the various looping statements in Java ? Explain with example.
4 I 0
0CO

8 5 O UV t 5E It 55 1 4 I NCt 5 RRN O pVCt


ORt O pV COKpCVK p 0 OD t
OKUUK pU
14 1 45 0 1/2 6 4 5 0
5 ,C C 2t ItCOOKpI
6 WT C CTM

2 46
5J tV pU t

P T CNN SW P
9JC W CP D P PI E P T P
CP W RT CP C R H E CT PI CP P C PI CP CTTC J C
speci c set of values at the same time.
3. De ne Byte code.
9JC J RWTR H J .C W J P 96
9JC J RWTR H J P J P C ,C C CRR
6. What is JDBC ?

PART – B
5J tV UUC

P T Cp SW P
P ,C C JC CT J CC R W T RT P T C PW D T CP JC CT
J HH T PE D P J P T H RT E P CP TCPI
HH T P C D P RT PET P CP R PET P R TC T P ,C C
RCP J ICTDCI E E PJ R P CPCI PI T P ,C C RT ITC
R C P J E PE R HC C E J P ,C C CP J HH T HT CP
P CPE J
RCP J CP C R J ET C J EMD 96 E P T
9J J T P THCE ECP D P P P
261
9JC J HCW D JC WT J P CP WPJCP E R P EEWT P ,C C
ET D J HH T PE D PC CP C P ,C C CRR EC P CP C ,C C
CRR

2 46
UUC

P T Cp SW P
ET D J RWTR CP HWPE PC H J TPCT R TC T P ,C C 2T
CP C R HJ J TPCT R TC T W E P PC C IP C C W
C CT CD RCP J PC H J TPCT R TC T CP J HH T HT
C T IW CT H C P
EW J T C P JR D P EC CP DL E J IJ IJ PI J C
class serves as a blueprint for creating objects with prede ned attributes and
D JC WT
ET D J T H E P TWE T P P C PI DL E EW J HH T P
types of constructors available in Java and explain their signi cance in object-
T P RT ITC PI
9JC RCEMCI 5J J CP C R J R P RCEMCI E PE R
P ,C C
EW J H E E H C 6JT C
EW J T H. P T P THCE P ,C C P JCP PI

2 46
. pI UUC

P T Cp SW P
EW J E P PE PT TWE WT P ,C C PE W PI H H CP EJ
C P R C P J T P C CP W CI J C R
2T CP C R E PCT J T C WR TE C CP WDE C T C P JR
ECP D CRR CP RCP J J WDE C P T C C PC
H C WT J PJ T EJCTCE T E HT J WR TE C
R C P J E PE R H C W CPCI T P 96 CP J J J R P TICP PI
E R P P JPCE PCP T EW C C JT HH T P C W CPCI T
5J J CP C R J J 4WPPCD P THCE W R P
6JT C RT ITC PI
AAAAAAAAAAAAAAAAAAA
*K24U2723* K24U 2723
Reg. No. : .................................

Name : .....................................

V Semester [Link]. Degree (C.B.C.S.S.– O.B.E. – Regular/Supplementary/


Improvement) Examination, November 2024
(2019 to 2022 Admissions)
CORE COURSE IN COMPUTER SCIENCE
5B09CSC : JAVA Programming
Time : 3 Hours Max. Marks : 40

PART – A (Short Answer)

Answer all questions : (6×1=6)

1. What is a class ?

2. Why is Java considered to be a simple language ?

3. What does the new operator do ?

4. What is a main thread ?

5. What is an Applet ?

6. What is a panel in AWT ?

PART – B (Short Essay)

Answer any 6 questions : (6×2=12)

7. Which are the OOP Principles ?

8. Which are the Arithmetic Assignment Operators in Java ?

9. What is meant by a protected variable ?

10. What is an lnterface ?

11. What is the task of main method in Java ?

12. What is the difference between a class and an Interface ?


P.T.O.
K24U 2723 *K24U2723*
13. Which methods are used to stop a thread ?

14. What is a constructor ? What are its special properties ?

PART – C (Essay)

Answer any 4 questions : (4×3=12)

15. Explain the scope and lifetime of variables in Java.

16. How to create a 1D array in Java ?

17. Explain the purpose of the finally block.

18. How to create Thread in Java ?

19. Write a note on different AWT controls available.

20. Discuss the different levels of access protection available in Java.

PART – D (Long Essay)

Answer any 2 questions : (2×5=10)

21. What is meant by Garbage Collection ? Explain the finalize() method with
an example.

22. Explain the concept of method overriding with an example.

23. What is Exception handling ? Explain in detail about the usage of Multiple
catch clauses.

24. What is an Applet ? Explain the methods implemented by an Applet.

_______________________
This document was created with the Win2PDF “Print to PDF” printer available at
[Link]
This version of Win2PDF 10 is for evaluation and non-commercial use only.
Visit [Link] for a 30 day trial license.
This page will not be added after purchasing Win2PDF.
[Link]

Common questions

Powered by AI

Method overriding in Java is a technique where a subclass provides a specific implementation of a method already defined in its superclass. This demonstrates polymorphism as the call to an overridden method is resolved at runtime, allowing different behaviors based on the object's actual run-time type. For example, if class `Animal` has a method `makeSound()` and its subclass `Dog` overrides it, then calling `makeSound()` on an `Animal` reference pointing to a `Dog` object will execute the `Dog`'s `makeSound()` method. This flexibility allows objects to be interacted with using general interfaces while preserving specific behaviors .

Access specifiers in Java, including private, default, protected, and public, help define the visibility of classes, objects, methods, and variables. They contribute to encapsulation by controlling access to the components of an object, ensuring data hiding and restricting unauthorized access. For instance, declaring variables as private prevents outside access but allows data manipulation through public methods, effectively protecting the integrity of the data and abiding by the principle of encapsulation within object-oriented programming .

Synchronization in Java is crucial to managing access to resources by multiple threads to prevent inconsistent data states. Challenges include potential deadlocks where two or more threads block each other by holding and waiting for locks, leading to a system halt. Java’s built-in synchronization ensures that critical sections of code are executed by only one thread at a time using synchronized methods or blocks. Solutions include careful lock acquisition order and employing wait-notify mechanisms that allow threads to communicate the release of resources, reducing the potential for deadlocks .

Java's multi-threading model is built into the language and run-time environment, providing high-level support that makes it easier to manage compared to C++. Java threads are managed by the Java Virtual Machine (JVM), whereas, in C++, threads are managed at the application level using libraries such as POSIX threads (Pthreads). Java offers advantages by providing built-in synchronization primitives and thread lifecycle management, which abstracts much of the complexity involved in low-level thread operations and makes concurrency easier to implement and maintain .

The `finally` block in Java is used in conjunction with try-catch blocks to execute important code such as cleanup operations, regardless of whether an exception is thrown. It provides a mechanism to ensure that the cleanup code is executed even if an exception occurs or if the try block is exited via return or break statements. This consistency is crucial in managing resources such as file handles or database connections, which need to be released after use .

Java's garbage collection automatically manages memory by reclaiming memory used by objects no longer referenced by the application. This helps developers by reducing memory leaks and ensuring efficient memory usage without explicit deallocation. However, garbage collection can impact performance due to its overhead, which can introduce pauses and delay time-sensitive operations. Strategies such as the choice of garbage collector implementation (e.g., G1, CMS) and tuning JVM options can mitigate these impacts, allowing for customized performance optimizations in memory-constrained or high-performance applications .

The `final` keyword in Java provides a way to declare constants, prevent method overriding, and prevent inheritance of classes. Benefits of the `final` keyword include enhanced security and program integrity, as it ensures immutability for variables and fixed behavior for methods. A limitation is that it restricts flexibility because a final method cannot be overridden and a final class cannot be subclassed, which can lead to less reusable code. For example, marking a class as final means that no other classes can extend it, preventing developers from customizing it for specific needs .

Java packages are used to group related classes and interfaces together, supporting modularity by promoting organized code structure. Interfaces define a contract of methods that a class must implement, allowing for flexible code where classes can implement multiple interfaces and switch implementations easily. This promotes loose coupling and a flexible system architecture where implementations can vary without changing the code that uses them. Packages help avoid name conflicts and can define access levels, contributing to encapsulation and module integrity .

Java's platform independence is primarily due to its intermediate bytecode compiled by the Java Compiler and executed by the Java Virtual Machine (JVM). This enables Java programs to run on any system with a JVM. Compared to languages like C++, which require recompilation on different platforms, Java offers significant advantages in terms of development and deployment efficiency. Developers write, compile once, and deploy anywhere, saving time and resources in multi-platform development and simplifying maintenance and updates .

Exception handling in Java is a mechanism to handle runtime errors so that the regular flow of the program can be maintained. It is essential for robust software development because it helps in managing errors and exceptions in an organized way, improving the reliability and stability of the software. Exception handling allows developers to handle exceptions gracefully, which means giving different responses to different exceptions or applying common resolutions across applications .

You might also like