19336
19336
9 5 1 7
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)
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