GOVERNMENT POLYTECHNIC, NAGPUR.
(An Autonomous Institute of Govt. of Maharashtra)
 MODEL QUESTION PAPER
 Program : Diploma in Computer Engineering
 Course Code : CM302G Course Name : Advance Java
 Time : 3 Hours Max. Marks : 60
Instructions: ENROLLMENT NO :
 1. All questions are compulsory
 2. Illustrate your answers with neat sketches wherever necessary
 3. Figures to the right indicate full marks
 4. Use of non-programmable calculator is permissible
 5. Assume suitable data if necessary
 6. Preferably, write the answers in sequential order.
 Q1 Attempt any SIX (12)
 1R2 a) List any two constructors of DatagramPacket CO1
 2R2 b) List any two interfaces in java.sql package CO2
 3R2 c) State any two components in AWT CO3
 4R2 d) State the top level containers in Swing CO4
 5R2 e) Define cookie CO5
 6R2 f) State the use of following java code: CO6
 <%String username = request.getParameter("username"); %>
 1R2 g) Define Socket in java networking CO1
 5R2 h) State the use of Cookies in servlet. Also state the method to add the cookie to CO5
 client.
 6R2 i) List any two JSP implicit objects CO6
 Q2 Attempt any THREE (09)
 1U3 a) Describe following terms in network programming: CO1
 i) Socket
 ii) Port Number
 iii) URL
 1A3 b) Write java program to demonstrate the use of InetAddress factory methods with CO1
 a simple java program.
 1A3 c) Write java statements for following: CO1
 i Create DatagramSocket object for server.
 ii Create the outgoing datagram.
 iii. Create DatagramSocket object for client.
 (Assume suitable data)
 1A3 d) Write java program to demonstrate the connection oriented client server CO1
 communication
 3U3 e) Describe Applet Life Cycle CO3
 Q3 Attempt any THREE (09)
 2U3 a) Describe the steps involved in the process of connecting to a database and CO2
 executing a query.
 2A3 b) Write a java program to connect java application with mysql at localhost on port CO2
 number 3306 and display all the records of STUDENT table in
 database.(Database Name is GPNAGPUR)
 2A3 c) Write java program to connect java application with mysql at localhost on port CO2
 number 3306 and change branch of all students to CM in Student table in
 GPNAGPUR database.
 3A3 d) Write a java program to create GUI using AWT with one button and a label. The CO3
 label should get modified with the count of total number of clicks on the button.
 4U3 e) Describe any three advantages of Swing over AWT CO4
Q4 Attempt any THREE (09)
3U3 a) Describe event handling in AWT CO3
3A3 b) Write a java program to demonstrate the use of grid layout for adding 9 buttons CO3
 in 3*3 grid.
4U3 c) Describe any three components of Swing along with the syntax of creating them CO4
4A3 d) Write a java program to create a Frame using Swing with one TextField for CO4
 getting input from the user and a create Button. The new frame with the title
 provided by user in TextField should be created after user clicks on create
 button.
5U3 e) Describe Servlet Life Cycle CO5
Q5 Attempt any THREE (09)
5U3 a) Describe any three classes/interfaces in servlet API CO5
6U3 b) Describe JSP architecture CO6
4A3 c) Write Java code to create a JFrame containing a JLabel, a JTextField, and a CO4
 JButton. When the button is clicked, display the text entered in the JTextField in
 the JLabel.
5A3 d) Write a ping-pong servlet application. When a user enters “ping” message CO5
 in textbox of HTML form, the application will respond with a “pong”
 message as a responding page. Other messages sent by the user can be
 safely dropped by the application.
6U3 e) Describe any three JSP scripting elements with example CO6
Q6 Attempt any TWO (12)
5A6 a) Write a servlet to determine whether the Session is New or Old. CO5
 If session is New: "You have created a new session" should be displayed on the
 page as shown below
 If session is Old: "Session already exists" should be displayed on the page as
 shown below
6A6 b) Write a JSP program to calculate factorial value for an integer number given as CO6
 input from HTML form and give the output on another page as shown below
 After clicking the “Submit” button the response should be:
 2A6 c) Write a java code where you insert 50 records taken as input from the CO2
 user in java application into a database table using a PreparedStatement
 in a batch. (Assume suitable data)
Course Outcomes :
 CO1 Develop java program for client server communication
 CO2 Develop program to establish the connection with database
 CO3 Design event driven GUI for java applications using AWT
 CO4 Develop GUI applications using swing framework
 CO5 Design web application using servlets
 CO6 Design web application using JSP