You are on page 1of 8

Question Bank

UNIT I GUI with JFC/Swing and Database Connectivity: JDBC

Swings

1. What are adapter classes? Write the advantages of using adapter classes over listeners. Explain
the WindowAdapter class with the help of one method of it.
2. Write a short note on features of JFC.
3. What is the purpose of using the getContentPane() in SWING programs?
4. What are the different panes in Swing? Explain.
5. What are different Menu components available in Swing/JFC? Explain.
6. What is JToolBar and describe why BorderLayout is preferred for adding ToolBar to the
container?
7. What are various JFC containers? Explain them according to their functionality.
8. Write a short note on: JFrame, JPanel.
9. Differentiate between JCheckBox and JRadioButton.
10. Differentiate between JDialogBox and JFrame.
11. What is the difference between AWT and Swing?
12. What is the difference between Heavy Weight Components and Light Weight Components?
13. Write a short note on: JButton, JTabbedPane, JTable, JTree, JScrollPane, JSlider.
14. What is the use of JPasswordField? Explain with example.
15. Differentiate between JList and JComboBox.
16. What is the use of JTree? Explain different classes and interfaces to create it.
17. How to create table in Swing?
18. Explain different types of Text-Entry components?
19. Explain the advantages of JTabbedPane and JScrollPane in designing GUI.
20. Explain JFileChooser class with one method of it.
21. What is the use of JTabbedPane? How to create it?
22. What is the use of JCheckBox and JTable? How to create objects of these classes?
23. State and explain various classes and interfaces and methods to create tree.
24. Explain the role of Action interface.
25. Write a short note on Model View Controller.
26. Write and explain any three classes to create Menus and Trees each.
27. Write short notes on Pluggable look and feel and MouseEvent.
28. Write the use of the following methods with their parameters.
a) setDefaultCloseOperation()
b) showMessageDialog()
c) setSelectionMode()

JDBC

29. What are the advantages of using JDBC over ODBC?


30. Write a short note on drivers of JDBC.
31. What is JDBC?
32. Explain the following methods:
a) executeUpdate()
b) getColumnCount()
c) getString()

also state classes/interfaces to which they belong.

33. What are the components of JDBC? Write the steps to access a database using JDBC.
34. Explain importance of the following methods:
a) forName()
b) getConnection()
c) createStatement()
35. What are the different types of statement objects that can be created in JDBC?
36. Explain PreparedStatement with code snippet.
37. Explain ResultSet.
38. Write a short note on Type -1 driver.
39. Explain any two JDBC drivers.

Programs:

Swings

1. Write a Java program to create JFrame containing JDesktopPane which has a single
JInternalFrame.
2. Write a Java program to create Biodata by using various components.
3. Write a Java program which will display login id form with password field.
4. Write a Java program containing a combo box and an un-editable text field. The combo box
should contain list of some country names playing cricket. When any country is selected, the
captain name should be displayed in the text field.
5. Write a Java program which displays the text in the label with green color when window
appears.
6. Write a Java program containing a text field, a combo box and a button. BY clicking on the
button the content of the text field is added to the combo box.
7. What is tabbed pane? Write a Java program for the following:
The JTabbedPane contains two tabs: “city” and “Bank”. First tab is titled with panel name
CityPanel, which includes two buttons with label “Mumbai” and “Delhi”. Second tab titled as
“Bank” with BankPanel, which is not to be defined in a class.
8. Write a swing program containing two text-fields to accept values of a and b of Pythagorean
triplet. Also include a button which when clicked, shows the value of c in a label [c 2=a2+b2].
JDBC

9. Write a JDBC program that accepts a table name and displays total number of records present in
it.
10. Write a JDBC program that accepts a suitable name as a command line argument and displays
highest score in that subject. [Make suitable assumption for table details. ]
11. Write a JDBC program that counts the total number of managers from emp table. (empcode-
>number, empname->varchar, empdesg -> varchar)

UNIT II: Multithreading, Networking and RMI

Multithreading

1. What method does a Java call to get a thread started?


2. What is the difference between suspending and stopping a thread?
3. What is multithreading?
4. Explain synchronized keyword.
5. How to synchronize thread? Explain with example.
6. Explain the use of wait(), run(), sleep(), notify() and notifyAll() methods.
7. How do you communicate between two threads? Explain with example.
8. Explain life cycle of Thread.
9. Explain various Thread methods.
10. Explain various ways of creating a Thread with code snippet.
11. Write a short note on Thread priorities.
12. Explain the use of isAlive() and join() methods.
13. Write a short note on Inter Thread communication.

Networking

14. Explain the following:


a) URLConnection
b) ServerSocket
15. Explain DatagramSocket and DatagramPacket classes.
16. Explain the following terms:
a) Protocol
b) Client
c) Server
d) URL
e) Datagram
17. What is socket? Using Socket class, write a program to show how a client sends and receives
date from the server through the socket?
18. Explain the following methods from the URL class:
a) getHost()
b) getPort()
c) getProtocol()
d) getFile()
e) getRef()
19. Explain any two static methods of InetAddress class.
20. Explain Socket and ServerSocket class.
21. Write short notes on:
a) Network interface
b) Cookies
c) SDP
22. How to use DatagramSocket and DatagramPacket to send information across two machines on a
network?
23. Explain the following classes with code snippet.
a) InetAddress
b) URLConnection

RMI

24. What is RMI?


25. Explain RMI architecture. Or Explain the mechanism by which server and client can
communicate with each other and pass information back and forth using RMI.
26. What is the difference between RMI and CORBA?
27. How can you bins an object into RMI registry?
28. When can be the following exceptions be generated while developing an RMI application?
a) ConnectionException
b) NotBoundException
c) RemoteException
d) AlreadyBoundException
e) NoSuchObjectException
29. Explain the term marshalling and unmarshalling.
30. What are the advantages of RMI?
31. Explain the steps for implementing RMI/ creating RMI application. (Including steps to compile
and run RMI application).
32. What is the use of RMIregistry and RMISecurityManager.

Programming

Networking

1. Write a Java program that sends “Hello” message to machine named “YAHOO” on port 4000
using Datagram.
2. Write a Java program that accepts URL from user and downloads and displays its content on
screen.
3. Write a Java program to download and display the content of
http://www.myworld.com/index.html file.
4. Write a Java program that displays the information about a file URL like its type, encoding and
length.
5. Write a Java program for a client that sends datagram to a server.
6. Write a Java program that accepts computer name as a command line argument and to display
its InetAddress.
7. Assuming that connection between client and server is established and client has sent request
to the server. Write a server program which will accept request from client.

RMI

8. Write a remote interface containing a function toDollers. Write a class that implements this
interface to convert to Dollars.

UNIT III: Servlets and JSP and Beans

Servlets

1. Which class is used by a servlet to receive a request on the client?


2. Differentiate between Generic Servlet and Http Servlet.
3. What is servlet? What are various types of servlets? State and explain three life cycle methods
of servlet.
4. Which function must be used to add a cookie to the response that is send by the server to the
client?
5. Write a short note on Servlet Life Cycle.
6. What is a cookie? Explain.
7. Servlet enhances the functionality of web server. Justify.
8. What is session tracking? How cookies are helpful for Session tracking?
9. How http request and response are handled by the Servlets?
10. Write a short note on Cookies for Servlets.
11. Explain the Java Servlet Architecture.
12. Write a note on “Handling Cookies in Servlet” covering following topics:
a) Definition of Cookie.
b) Benefits of Cookies.
c) Methods of Cookies.
13. Write a note on HttpSession. Why do we create sessions in servlets? How to create sessions in
servlets? Explain.
14. Explain storing and retrieving objects in session.
15. Explain:
a) GenericServlet
b) ServletConfig
c) HttpServletRequest
16. What is the role of ServletContext and HttpServletRequest? State some important methods of
these classes.
17. Differentiate between:
a) Get and post request
b) Cookies and Http Session
18. Write and explain any five classes / interfaces inherited by HttpServlet.

JSP

1. What is JSP? What are the advantages of using JSP over servlets?
2. Explain JSP architecture.
3. What are various JSP tags available?
4. Write a short note on JSP Access Model.
5. What is meant by declaration in JSP? How is it different from a scriptlet?
6. Explain the exception handling mechanism of JSP.
7. Explain Include directive with all its attributes.
8. Explain JSP object scope.
9. What are major differences in comparison between JSP and ASP?
10. Explain where and how to declare methods and fields in JSP. What is “page” directive in JSP?
Also explain its attributes.
11. How JSP files are executed by web server?
12. Differentiate between Cookies and Sessions.
13. Write a short note on different types of scope for JSP objects.
14. How Java Beans are accessed in JSP? Explain tags and/or attributes.
15. What is a filter? Explain various parameters of doFilter() function.
16. How to perform the following in JSP?
a) Declare an integer variable I that can be used in entire JSP page.
b) Display a message on the screen “The value if I = “followed by the value of I.
c) Make use of classes from util package.
d) To include the contents of menus.html file.

Java Beans
1. Define Java-Bean. Write features and characteristics of a Java Bean.
2. Explain simple property of a Java Bean with programming example.

Programs:

Servlets:
1. Write a servlet which searches a cookie having name “User”. If found, displays message “User
found” otherwise display the message “User not found”. Create a cookie “User”.
2. Write a Servlet which allows user to add new records to table unmpwd. Values for username
and password are passed through HTML.
3. Write two servlets in which one servlet will display a form in which data entry can be done for
the field’s dept-no, dept-name and location. In the same form place a button called as submit
and on click of that button this record should be posted to the table called as DEPT in the
database. This inserting of record should be done in another servlet. The second servlet should
also display all the previous record entered in the database.
4. Write a Servlet which accepts ROLLNO, NAME and YEAR sent from a HTML document
(student.html) and display them on screen. Also give the code for student.html document.
5. Write a Servlet to accept student gender and name from HTML file. It should redirect the user
either to m_fees.html or f_fees.html depending on gender.
6. Write a Servlet which accepts user-id, productName and qty from html file, calculates total
amount using qty and pre defined rate for the product and displays it back to user along with
user-id.
7. Write a servlet that accepts text “friend_name” sent from an HTML document and displays that
text on the screen as “Hello! Friend_name”
8. Write a servlet program that accepts student information and insert it into student table.
9. Write a Servlet which accepts an integer n from html form, calculates and displays the factorial.
10. Write a Servlet which counts the no. of requests made to it after it has been loaded.
11. Write a Servlet which accepts user name and password sent from an html file. If the password is
“admin”, the servlet redirects the output of welcome.html but if the password is wrong (not
admin) then it redirects the output of error.html file.
12. Write a Servlet which reads a value from Cookie which is already set and displays the value on
the screen.

JSP
13. Write a JSP program to display Current Date.
14. Describe various implicit object of JSP? What is the scope of those objects?
15. Write two JSP programs: one for displaying the current date and the other for displaying ten
random numbers. Include a suitable JSP directive into in to the first JSP file to insert the second
file in to the first file.
16. Write two JSP pages in which one will accept rollno, name and age from HTML file and posts it
to the table called STUDENT on click of button Submit. The second JSP page should display all
the previous record entered in the STUDENT table.
17. Write a program using JSP tags to compute 10 Fibonacci numbers.
18. Write a program using JSP tags to compute square of numbers from 1 to 20.
19. Write a JSP program which calls another JSP page when some exceptions occur.
20. Write a JSP program that displays the content of a database table.

Unit IV: EJB and Web Services


1. What is EJB? Explain various types of it.
2. Explain the life cycle of stateless session bean.
3. Explain the life cycle of stateful session bean.
4. Explain the life cycle of entity session bean.
5. Explain the life cycle of message driven bean.
6. What is message listener? Also explain onMessage() function.
7. Write and explain any two annotations used for developing EJB.
8. What are various ways of passing parameters in EJB?
9. Differentiate between stateless and stateful session beans.
10. Write a short note on benefits of EJB.
11. What are the methods of Entity Bean?
12. What are the callback methods in Entity Beans?
13. What are the transaction isolation levels in EJB? Explain.
14. What is clustering?
15. What is the difference between different types of entity beans?
16. How an enterprise bean works?
17. Write a short note on JAX-Write a Servlet which.

Program

1. Write EJB which displays mathematical calculation.

You might also like