0% found this document useful (0 votes)
205 views6 pages

19336

Uploaded by

ramkumarkbcs27
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)
205 views6 pages

19336

Uploaded by

ramkumarkbcs27
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
You are on page 1/ 6

Reg. No.

9 5 1 7

Question Paper Code : 19336

B.E. / B.TECH. DEGREE EXAMINATION, NOVEMBER / DECEMBER 2022


Third Semester
B.E. – Computer Science and Engineering
19CS391 – PROGRAMMING WITH JAVA
(Regulations: Mepco – R2019)
Duration: 3 Hours Max. : 100 Marks
Answer ALL Questions
PART A – (10  2 = 20 Marks)
BTL, CO

U, CO1 1. How is a constant defined in Java? Give example.


A, CO1 2. Find the value of a[1] after execution of the following program. Write steps to
derive the final result to justify your answer.
int[] a = {0,2,4,1,3};
for(int i = 0; i < a.length; i++){
a[i] = a[(a[i] + 3) % a.length]; }
A) 0 B) 1 C) 2 D) 3
U, CO2 3. Discuss the purpose of interfaces in Java.
A, CO2 4. What will be the output of the following Java program? Justify your answer.
class A {
int i;
int j;
A() {
i = 1;
j = 2; } }
class Output {
public static void main(String args[]) {
A obj1 = new A();
A obj2 = new A();
System.out.print(obj1.equals(obj2)); } }
A) false B) true C) 1 D) Compilation Error
U, CO4 5. What is the purpose of JNI in Java?

1
19336
A, CO3 6. What will be the output of the following Java program? Justify your answer.
import java.util.*;
class Output {
public static void main(String args[]) {
ArrayList obj = new ArrayList();
obj.add("A");
obj.ensureCapacity(3);
System.out.println(obj.size()); } }
A) 1 B) 2 C) 3 D) 4
U, CO5 7. State the advantages of adapter classes.
A, CO5 8. Which of the following applet tags is legal to embed an applet class named Test
into a Web page? Justify your answer.
A) < applet class = Test width = 200 height = 100>
B) < applet> code = Test.class width = 200 height = 100>
C) < applet code = Test.class width = 200 height = 100>
D) < applet param = Test.class width = 200 height = 100>
U, CO6 9. Why do we need thread synchronization? How will you achieve it in Java multi
threaded programs?
A, CO6 10. What is the output of the following Java program? Justify your answer.
class multithreaded_programing {
public static void main(String args[]) {
Thread t = Thread.currentThread();
System.out.println(t.getPriority()); } }
A) 0 B) 1 C) 4 D) 5

PART B – (5  16 = 80 Marks)
U, CO1 11. a) i. Differentiate between various accesses modifier for classes and
methods in Java. (8 Marks)
A, CO1 11. a) ii. Write a program in Java to reverse given String (by user) without
using built in methods. (8 Marks)
OR
U, CO1 11. b) i. Explain the use of for each loop for displaying array elements in
Java with an example. (8 Marks)

2
19336
A, CO1 11. b) ii. Design a class in Java to implement the given a class diagram:

(8 Marks)

A, CO2 12. a) Write the classes as shown in the following class diagram. Mark
all the overridden methods with annotation @Override.

(16 Marks)
OR

3
19336
A, CO2 12. b) Write two concrete classes in Java for MovablePoint and
MovableCircle that that implement the Movable interface.

(16 Marks)

U, CO3 13. a) i. Explain any four methods in collection interface with an example. (8 Marks)
A, CO3 13. a) ii. Construct a student record (atleast for 5 students) that stores rollno
along with names using map interface in Java and add Java code
snippet to do the following:
A) Find the values corresponding to keys
B) Remove the key and value
C) Convert the map to sets
D) Traverse the elements in any order (8 Marks)
OR
U, CO3 13. b) i. Explain object serialization in Java with an example program. (8 Marks)
A, CO3 13. b) ii. Construct a list of fruit names (minimum 5 fruit names) using
Java arraylist interface and do the following:
A) Traverse the list using iterators
B) Change the fruit name using index
C) Get the fruit at index 3
D) Display the fruit names in ascending order (8 Marks)

U, CO5 14. a) i. Differentiate between various layout managers in java.awt.* with


example programs. (8 Marks)

4
19336
A, CO5 14. a) ii. Write a Java awt program to display the following:
A) “mouse entered’ when mouse come into frame
B) “mouse exited’ when mouse goes out of frame
C) “mouse pressed’ when mouse is pressed
D) Display blue circles when mouse is clicked
similar to given sample output:

(8 Marks)
OR
U, CO5 14. b) i. Differentiate between radio button, check box and combo box in
JavaFX components using example programs. (8 Marks)
A, CO5 14. b) ii. Write a simple Java swing program to get two integers from the
user in text boxes and display the result of addition or subtraction
in another text box. Use buttons to add / subtract the integers

5
19336
similar to snapshot given below:

(8 Marks)

U, CO6 15. a) i. Explain any four thread property access methods in Java with
example programs. (8 Marks)
A, CO6 15. a) ii. Write a Java program that implements a multi-thread application
that has three threads. First thread generates a random integer for
every 1 second; second thread computes the square of the number
and prints; third thread will print the value of cube of the number. (8 Marks)
OR
U, CO6 15. b) i. Explain race condition in Java with an example program. (8 Marks)
A, CO6 15. b) ii. Create a thread pool in Java that prints numbers from 0 – 9 using
ExecutorService and Executors. (8 Marks)

6
19336

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy