Topic: Applet, AWT and Event Handling
1. What are Applets? How it is different from Normal java class?
2. What is the difference between Panel, Applet, Window and Frame? Can we add a Frame within a Panel?
3. Explain the Applet Life cycle. What is the importance of paint() and repaint().
4. List various methods of Graphics class. Write code snippet to draw the following shapes in Applet:
String, Rectangle, Oval, Circle, Rounded Corner Rectangle, Polygon and Polylines.
5. What do you mean by Event Handling? Explain Event Delegation Model. How will you register an event source with Listener? Write code snippet.
6. WAP to create a GUI having 4 text fields in four different sides of a frame and a button at the center. Contents of Text fields must be swapped (North<--> South and East<--> West) when the button is pressed
7. WAP to create an applet displaying a ball filled with blue color. Use event handling to move the ball with the mouse-pointer.
8. What is the difference between RadioButton and CheckBox? Write code snippet to create 2 radio buttons using AWT.
9. WAP to create a GUI containing 10 buttons in a grid with 3 rows and 4 columns.
10. List various methods of CardLayout class. WAP to demonstrate the use of CardLayout.
11. WAP using Applet to draw 3 co-centric circles filled with different colors. Write the code required to execute this applet in Web browser.
12. WAP to create a login page accepting user_id and password, migrate to a welcome page when the submit button is pressed by the user. Welcome page must display the user_id of the user.
13. List all the methods of MouseListener, MouseMotionListener, WindowListener, and KeyListener Interfaces.
=========================================================================
Topic: I/O Streams
1. What do you mean by Streams? How will you differentiate between Character Stream and Byte Stream?
2. "ObjectInputStream can be used as a substitute of DataInputStream." Do you agree with the statement? Comment.
3. What is the importance of FIle class? List any 5 methods of File class.
How will you check whether a file object represents a file or directory?
How BufferedOutputStream is more efficient than DataOutputStream?
4. What is the need of RandomAccessFIle. List any 5 methods of RandomAccessFile. Write code snippet to read the 10th integer from a file using RandomAccessFIle.
5. WAP to copy the contents of one file to another file.
6. What is the difference between InputStream and OutputStream? WAP to read alternate numbers from a file containing 100 integers using RandomAccessFile.
7. What do you mean by Serialization and De-serialization? What is transient variable?
8. What is the importance of BufferedInput/OutputStream? Write code snippets to instantiate BufferedInputStream, ObjectOutputStream and DataInputStream.
9. What are the advantages of DataInputStream over FIleInputStream? Write any 5 methods of DataOutputStream class.
10. Write a program to create a file named "copy.txt" if it does not exist. Append new data to it. Write 20 double numbers into the file using binary I/O.
=========================================================================
Topic: Multi-threading
1. Explain Thread life-cycle with diagram. How a Thread is different from a Process? "Thread is a light-weight process" what do you mean by this statement?
2. Write any 5 Methods of Thread class with their uses.
(a) public static void start()
(b) public static void yield()
(c) public void join()
(d) public static Thread currentThread()
(e) public boolean isAlive()
3. How join method is different from yield method? WAP to demonstrate the use of join method.
4. What do you mean by Thread synchronization? What are the two ways of synchronizing a thread? What is the advantage of Synchronized block over Synchronized method in Multi-threading?
5. How will you change the name and priority of a thread? What are the possible values of Thread- Priority?
6. WAP to prompt the user to enter 2 integers A and B. Create a thread named "Demo-1" with priority 7 to display the 10 consecutive numbers starting from A with sleep time 2 seconds, and another thread named "Demo-2" to display all the positive even numbers from B to 0 in reverse order.
7. What is the need of synchronized block? How it is different from synchronized method?
8. How will you check whether a thread is terminated or not? Name the exception thrown by sleep() method.
9. WAP to create two threads named "Thread 1" and "Thread 2". Set the priorities of threads 2 and 9 respectively. Thread 1 should display the table of number i and Thread 2 should display A,B,...Z. Integer i should be entered by the user. Use sleep method for both the threads.
10. WAP to demonstrate the serialization.
===========================================================================
1. What are Applets? How it is different from Normal java class?
2. What is the difference between Panel, Applet, Window and Frame? Can we add a Frame within a Panel?
3. Explain the Applet Life cycle. What is the importance of paint() and repaint().
4. List various methods of Graphics class. Write code snippet to draw the following shapes in Applet:
String, Rectangle, Oval, Circle, Rounded Corner Rectangle, Polygon and Polylines.
5. What do you mean by Event Handling? Explain Event Delegation Model. How will you register an event source with Listener? Write code snippet.
6. WAP to create a GUI having 4 text fields in four different sides of a frame and a button at the center. Contents of Text fields must be swapped (North<--> South and East<--> West) when the button is pressed
7. WAP to create an applet displaying a ball filled with blue color. Use event handling to move the ball with the mouse-pointer.
8. What is the difference between RadioButton and CheckBox? Write code snippet to create 2 radio buttons using AWT.
9. WAP to create a GUI containing 10 buttons in a grid with 3 rows and 4 columns.
10. List various methods of CardLayout class. WAP to demonstrate the use of CardLayout.
11. WAP using Applet to draw 3 co-centric circles filled with different colors. Write the code required to execute this applet in Web browser.
12. WAP to create a login page accepting user_id and password, migrate to a welcome page when the submit button is pressed by the user. Welcome page must display the user_id of the user.
13. List all the methods of MouseListener, MouseMotionListener, WindowListener, and KeyListener Interfaces.
=========================================================================
Topic: I/O Streams
1. What do you mean by Streams? How will you differentiate between Character Stream and Byte Stream?
2. "ObjectInputStream can be used as a substitute of DataInputStream." Do you agree with the statement? Comment.
3. What is the importance of FIle class? List any 5 methods of File class.
How will you check whether a file object represents a file or directory?
How BufferedOutputStream is more efficient than DataOutputStream?
4. What is the need of RandomAccessFIle. List any 5 methods of RandomAccessFile. Write code snippet to read the 10th integer from a file using RandomAccessFIle.
5. WAP to copy the contents of one file to another file.
6. What is the difference between InputStream and OutputStream? WAP to read alternate numbers from a file containing 100 integers using RandomAccessFile.
7. What do you mean by Serialization and De-serialization? What is transient variable?
8. What is the importance of BufferedInput/OutputStream? Write code snippets to instantiate BufferedInputStream, ObjectOutputStream and DataInputStream.
9. What are the advantages of DataInputStream over FIleInputStream? Write any 5 methods of DataOutputStream class.
10. Write a program to create a file named "copy.txt" if it does not exist. Append new data to it. Write 20 double numbers into the file using binary I/O.
=========================================================================
Topic: Multi-threading
1. Explain Thread life-cycle with diagram. How a Thread is different from a Process? "Thread is a light-weight process" what do you mean by this statement?
2. Write any 5 Methods of Thread class with their uses.
(a) public static void start()
(b) public static void yield()
(c) public void join()
(d) public static Thread currentThread()
(e) public boolean isAlive()
3. How join method is different from yield method? WAP to demonstrate the use of join method.
4. What do you mean by Thread synchronization? What are the two ways of synchronizing a thread? What is the advantage of Synchronized block over Synchronized method in Multi-threading?
5. How will you change the name and priority of a thread? What are the possible values of Thread- Priority?
6. WAP to prompt the user to enter 2 integers A and B. Create a thread named "Demo-1" with priority 7 to display the 10 consecutive numbers starting from A with sleep time 2 seconds, and another thread named "Demo-2" to display all the positive even numbers from B to 0 in reverse order.
7. What is the need of synchronized block? How it is different from synchronized method?
8. How will you check whether a thread is terminated or not? Name the exception thrown by sleep() method.
9. WAP to create two threads named "Thread 1" and "Thread 2". Set the priorities of threads 2 and 9 respectively. Thread 1 should display the table of number i and Thread 2 should display A,B,...Z. Integer i should be entered by the user. Use sleep method for both the threads.
10. WAP to demonstrate the serialization.
===========================================================================
Comments
Post a Comment