It 251
It 251
php
Section-I
Answer all the questions. Section Duration: 40 mins
1) a 2) b 3) c 4) d
1) 0 2) 4 3) 3 4) 1
1 of 3 10-08-2023, 10:22
Firefox https://examcloud.in/epn/reports/exam-qpaper.php
19 Which event listener interface is used to handle mouse events inJava GUI?
(1)
1) MouseListener 2) ActionListener 3) KeyListener 4) WindowListener
20 What is multithreading?
Section-II
Answer 5 out of 8 questions.
1 Write a Java code snippet to demonstrate the use of exceptionhandling. Include a try-catch block to
handle a specific exceptionand provide a brief explanation of the code. (5)
2 Explain the difference between method overloading and methodoverriding in Java. Provide an example (5)
2 of 3 10-08-2023, 10:22
Firefox https://examcloud.in/epn/reports/exam-qpaper.php
for each.
3 What are the access modifiers available in Java? Briefly explaineach one with their respective visibility
scope. (5)
4 Evaluate the advantages and disadvantages of using the ArrayListclass over the Array data structure in
Java. Consider factors suchas dynamic resizing, flexibility, and memory management. Justifyyour answer
(5)
with appropriate reasoning.
5 Analyze the following Java code snippet and identify any syntaxerrors or logical issues. Provide the
necessary corrections withexplanation.
6 Write a Java program to calculate the factorial of a given numberusing a recursive function. Include
appropriate comments in yourcode and test it with different inputs. (5)
7 Write a Java program that takes a list of strings as input from theuser and sorts them in alphabetical order
using lambda expressions.Display the sorted list to the user. (5)
Section-III
Answer all the questions.
1 Explain the concept of object-oriented programming in Java. Write aJava program to demonstrate the
implementation of inheritance andpolymorphism. Include comments to explain your code. (4)
3 Write a Java program that reads data from a text file called"input.txt" and writes it to another text file
called "output.txt".Make sure to handle any potential I/O exceptions. (7)
[OR]
b
Develop a Java program to create a graphical user interface (GUI)that includes a button and a text field.
Implement an event handlerusing a lambda expression, so that when the button is clicked, thetext field (7)
displays a predefined message. Include appropriatecomments in your code.
-----End-----
3 of 3 10-08-2023, 10:22