Workbook Ajp Al Unit

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 18

=

JSPM’s
JAYAWANTRAO SAWANT POLYTECHNIC
Sr. No. 58, Handewadi Road, Hadapsar, Pune- 28.
Department of Computer Engineering
Academic Year 2024-25

Workbook-I

Subject: -Advanced Java Programming Subject Code:-22517


Course Code:-CO5I Semester:- V
Unit: - _______________ Class:-TYCO
Name of the Student: - _________________________________ Roll No.______________
Marks Obtained:-____________________________ Max Marks:- 20

Unit No I: Abstract Windowing Toolkit(AWT)

CO1: Develop programs using GUI Framework (AWT and Swing)


Answer the following questions:

(Note: Only one answer is correct).

1. AWT Means?

a) Abstract Windows Toolkit


b) Advanced Web Toolkit

c) Abstract Web Toolkit

d) Advanced Web Technology


2. Which is the immediate super class of Applet?

a) Container
b) Component

c) Frame
d) Panel
3. The setSize( ) method is defined by this class…
a) Applet

b) Component
c) Frame

d) Panel
4. Which class encapsulates a blank window upon which we can draw?
a) Applet
b) Canvas
c) Window

d) Frame
5. What are the variables defined in ‘Dimension’ class?

a) length and width


b) height and length

c) height and width


d) len and wid

6. If we want to hide the window, we can use this method…


a) setVisible( )

b) show( )

c) setHidden( )
d) view( )
7. The setColor( ) is the method of which class?

a) Applet

b) Graphics
c) Color

d) Object

8.Which of the following style is not supported by Font class?


a) Font.UNDERLINE

b) Font.ITALIC
c) Font.PLAIN

d) Font.BOLD

9. All the AWT controls are subclasses of which class?

e) Component
f) Container

g) AWTControl
h) Window

10. How you can remove all the controls from the applet?

a) Using remove( ) method.


b) Using removeAll( ) method.
c) Using removeAllControls( ) method.
d) It is not possible to remove all controls using single method.

Name and Sign of Subject Teacher Name and Sign 0f H0D


(Mr.Nirmal B.L) (Mr M S Kalbande)

JSPM’s
JAYAWANTRAO SAWANT POLYTECHNIC
Sr. No. 58, Handewadi Road, Hadapsar, Pune- 28.
Department of Computer Engineering
Academic Year 2024-25

Workbook-II

Subject: -Advanced Java Programming Subject Code:-22517


Course Code:-CO5I Semester:- V
Unit: - _______________ Class:-TYCO
Name of the Student: - _________________________________ Roll No.______________
Marks Obtained:-____________________________ Max Marks:- 20

Unit No II: Swings

CO2: Handle events of AWT and Swings components.


Answer the following questions:

(Note: Only one answer is correct).

1 Package of drawstring() method is


A. java.applet
B. java.io
C. javax.swing
D. java.awt

2 What are types of applets?


A. Trusted Applets
B. Untrusted applets
C. Both A and B
D. None of these

3 Give the abbreviation of AWT?


A. Applet Windowing Toolkit
B. Abstract Windowing Toolkit
C. Absolute Windowing Toolkit
D. None of the above

4 Which of these methods can be used to know which key is pressed?


A. getActionEvent()
B. getActionKey()
C. getModifier()
D. getKey()

5 Object which can store group of other objects is called


A. Collection object
B. Java object
C. Package
D. Wrapper

6 JFrame myFrame = new JFrame (); Any command (such as the one listed above) which creates a new
object of a specific class (in this case a new JFrame object called myFrame) is generally called a ...
A. Constructor
B. Layout manager
C. Parameter
D. GUI

7 In Java, what do you call an area on the screen that has nice borders and various buttons along the top
border?
A. A window
B. A screen
C. A box
D. A frame

8 What is the Lifecycle of an applet?


A. init( ) method
B. start( ) method
C. paint( ) method
D. All of these

9 What is the name of the Swing class that is used for frames?
A. Window
B. Frame
C. JFrame
D. SwingFrame
10 The following specifies the advantages of
It is lightweight.
It supports pluggable look and feel.
It follows MVC (Model View Controller) architecture.
A) Swing
B) AWT
C) Both A & B
D) None of the above

Name and Sign of Subject Teacher Name and Sign 0f H0D


(Mr.Nirmal B.L) (Mr M S Kalbande)

JSPM’s
JAYAWANTRAO SAWANT POLYTECHNIC
Sr. No. 58, Handewadi Road, Hadapsar, Pune- 28.
Department of Computer Engineering
Academic Year 2024-25

Workbook-III

Subject: -Advanced Java Programming Subject Code:-22517


Course Code:-CO5I Semester:- V
Unit: - _______________ Class:-TYCO
Name of the Student: - _________________________________ Roll No.______________
Marks Obtained:-____________________________ Max Marks:- 20

Unit No III: Event Handling

CO3: Develop programs to handle events in Java Programming.


Answer the following questions:

(Note: Only one answer is correct).

1. Which of these packages contains all the classes and methods required for even handling in Java?
a) java.applet
b) java.awt
c) java.event
d) java.awt.event

2. What is an event in delegation event model used by Java programming language?


a) An event is an object that describes a state change in a source.
b) An event is an object that describes a state change in processing.
c) An event is an object that describes any change by the user and system.
d) An event is a class used for defining object, to create events.

3. Which of these methods are used to register a keyboard event listener?


a) KeyListener()
b) addKistener()
c) addKeyListener()
d) eventKeyboardListener()

4. Which of these methods are used to register a mouse motion listener?


a) addMouse()
b) addMouseListener()
c) addMouseMotionListner()
d) eventMouseMotionListener()

5. What is a listener in context to event handling?


a) A listener is a variable that is notified when an event occurs.
b) A listener is a object that is notified when an event occurs.
c) A listener is a method that is notified when an event occurs.
d) None of the mentioned

6. Event class is defined in which of these libraries?


a) java.io
b) java.lang
c) java.net
d) java.util

7. Which of these methods can be used to determine the type of event?


a) getID()
b) getSource()
c) getEvent()
d) getEventObject()

8. Which of these class is super class of all the events?


a) EventObject
b) EventClass
c) ActionEvent
d) ItemEvent

9. Which of these events will be notified if scroll bar is manipulated?


a) ActionEvent
b) ComponentEvent
c) AdjustmentEvent
d) WindowEvent

10. Which of these events will be generated if we close an applet’s window?


a) ActionEvent
b) ComponentEvent
c) AdjustmentEvent
d) WindowEvent

Name and Sign of Subject Teacher Name and Sign 0f H0D


(Mr.Nirmal B.L) (Mr M S Kalbande)

JSPM’s
JAYAWANTRAO SAWANT POLYTECHNIC
Sr. No. 58, Handewadi Road, Hadapsar, Pune- 28.
Department of Computer Engineering
Academic Year 2024-25

Workbook-IV

Subject: -Advanced Java Programming Subject Code:-22517


Course Code:-CO5I Semester:- V
Unit: - _______________ Class:-TYCO
Name of the Student: - _________________________________ Roll No.______________
Marks Obtained:-____________________________ Max Marks:- 20

Unit No IV: Networking Basics


CO4 :Develop a java programs using networking concepts.
Answer the following questions:
(Note: Only one answer is correct).

1 Which is the connectionless protocol?


1. TCP

2. UDP
3. IP

4. HTTP

2 What is the port number of HTTP?


1. 80

2. 23
3. 47

4. 92

3 Which protocol that web browsers and servers use to transfer hypertext pages and images?

1. TCP/IP

2. UDP
3. HTTP

4. SMTP

4 Originally, all Internet addresses consisted of ____ bit values.


1. 32

2. 16
3. 24

4. 8

5 What is the full form of DNS?

1. Domain Naming System


2. Domain Naming Service

3. Domain Naming Software


4. Domain Naming Security

6 What is URL?
1. Unicast Resource Location

2. Uniform Research Launcher

3. Universal Research Locator


4. Uniform Resource Locator

7. What is the full form of DNS?

e) Domain Naming System


f) Domain Naming Service
g) Domain Naming Software
h) Domain Naming Security

8. Which class is used to encapsulate both the numerical IP address and the domain name for that
address?

a) InetAddress
b) SocketAddress

c) IPAdress

d) DNSSockets

9. Which of the following constructor of InetAddress is generally used?


e) InetAddress()

f) InetAddress(int port)

g) InetAddress(URL url)

h) There is no any visible constructor for InetAddress

10. Factory method of InetAddress class throws which of the following exception?

e) MalFormedURLException

f) UnknownHostException

g) URLException
h) MalFormedURLIOException

11. What is the full form of DNS?

e) Domain Naming System


f) Domain Naming Service

g) Domain Naming Software


h) Domain Naming Security

12. Which class is used to encapsulate both the numerical IP address and the domain name for that
address?

e) InetAddress
f) SocketAddress

g) IPAdress

h) DNSSockets

13. Which of the following constructor of InetAddress is generally used?


e) InetAddress()

f) InetAddress(int port)

g) InetAddress(URL url)

h) There is no any visible constructor for InetAddress


14. Factory method of InetAddress class throws which of the following exception?

e) MalFormedURLException

f) UnknownHostException

g) URLException
h) MalFormedURLIOException

15. What type of the value that getAllByName( ) returns?


e) InetAddress[ ]

f) InetAddress
g) URL[ ]

h) URL

16. In which form the getAddress( ) returns object’s internet address?

e) int[ ]
f) byte[ ]

g) long[ ]
h) String

17. Which method returns a string that represents the host name associated with the InetAddress
object?

e) hostName( )

f) myHostName( )
g) giveHostName( )

h) getHostName( )

18. Which Java networking class is designed to be a listener, and for clients to connect before doing
anything?

e) Server
ServerSocket

a) Servers
b) Socket

19. What type of the exception might be thrown by a Socket class?

e) URLException
f) UnknownHostException

g) MalFormedURLException
h) None

20. What the number 80 specifies in following URL?


http://www.rediff.com:80/index.htm/
e) Port number

f) Site number
g) URL Uniform number

h) HTML Page number

Name and Sign of Subject Teacher Name and Sign 0f H0D


(Mr.Nirmal B.L) (Mr M S Kalbande)

JSPM’s
JAYAWANTRAO SAWANT POLYTECHNIC
Sr. No. 58, Handewadi Road, Hadapsar, Pune- 28.
Department of Computer Engineering
Academic Year 2024-25

Workbook-V

Subject: -Advanced Java Programming Subject Code:-22517


Course Code:-CO5I Semester:- V
Unit: - _______________ Class:-TYCO
Name of the Student: - _________________________________ Roll No.______________
Marks Obtained:-____________________________ Max Marks:- 20

Unit No V: Interacting with Database.

CO5 : Develop programs using database.


Answer the following questions:

(Note: Only one answer is correct).

. A Java program cannot directly communicate with an ODBC driver because .......
A) ODBC written in C language
B) ODBC written in C# language
C) ODBC written in C++ language
D) ODBC written in Basic language

2. The JDBC-ODBC Bridge driver translates the JDBC API to the ODBC API and used with .......
A) JDBC drivers

B) ODBC drivers

C) Both A and B

D) None of the above

3. The ............................. package contains classes that help in connecting to a database, sending
SQL statements to the database, and processing the query results.

A) connection.sql

B) db.sql

C) pkg.sql

D) java.sql

4. The ................................ method executes a simple query and returns a single Result Set object.

A) executeUpdate()

B) executeQuery()

C) execute()

D) noexecute()

5. The ......................... method executes an SQL statement that may return multiple results.

A) executeUpdate()

B) executeQuery()

C) execute()

D) noexecute()

6. The ........................ object allows you to execute parametrized queries.

A) ResultSet

B) Parametrized

C) PreparedStatement

D) Condition

7. The .................. object provides you with methods to access data from the table.
A) ResultSet

B) Parametrized

C) TableStatement

D) Condition

8. The parameters of the PreparedStatement object are ...................... when the user clicks on the
Query button.

A) initialized B) started C) paused D) stopped

9. The ...................... method sets the query parameters of the PreparedStatement Object.

A) putString() B) insertString() C) setString() D) setToString()

10. Connection object can be initialized using the ............................ method of the Driver Manager
class.

A) putConnection() B) setConnection() C) Connection() D) getConnetion()

11. Which of the following is correct about DriverManager class of JDBC?


A - JDBC DriverManager is a class that manages a list of database drivers.
B - It matches connection requests from the java application with the proper database driver using
communication subprotocol.
C - Both of the above. D - none of the above.

12.In which of the following type of ResultSet, the cursor can scroll forwards and backwards, and
the result set is not sensitive to changes made by others to the database that occur after the result
set was created.?
A - ResultSet.TYPE_FORWARD_ONLY
B - ResultSet.TYPE_SCROLL_INSENSITIVE
C - ResultSet.TYPE_SCROLL_SENSITIVE
D - None of the above.

13. Which of the following type of JDBC driver should be used where a type 3 or type 4 driver is
not available yet for your database?
A - Type 1 B - Type 2 C - Type 3 D - Type 4

14. Which of the following is correct about JDBC?


A - The JDBC API provides the abstraction and the JDBC drivers provide the implementation.
B - New drivers can be plugged-in to the JDBC API without changing the client code.
C - Both of the above.
D - None of the above.

15.Which of the following is correct about PreparedStatement?


A - Prepared statements offer better performance, as they are pre-compiled.
B - Prepared statements reuse the same execution plan for different arguments rather than creating a
new execution plan every time.
C - Prepared statements use bind arguments, which are sent to the database engine.
D - All of the above.
16.How does JDBC handle the data types of Java and database?
A - The JDBC driver converts the Java data type to the appropriate JDBC type before sending it to the
database.
B - It uses a default mapping for most data types.
C - Both of the above.
D - None of the above.

17.Out of byte[] or a java.sql.Blob, which has best performance when used to manipulate data
from database?
A - byte[] B - java.sql.Blob

18.Which of the following is correct about Statement?


A - Used for general-purpose access to your database.
B - Useful when you are using static SQL statements at runtime.
C - The Statement interface cannot accept parameters.
D - All of the above.

19.Which of the following step closes a connection with a database?


A - Open a connection using the DriverManager.getConnection () method.
B - Execute a query using an object of type Statement.
C - Extract data from result set using the appropriate ResultSet.getXXX () method.
D - Clean up the environment by closing all database resources relying on the JVM's garbage collection
.
20.Which of the following is true about Hibernate?
A - Hibernate is an Object-Relational Mapping tool.
B - It maps Objects to relational data.
C - Both of the above.
D - None of the above.

Name and Sign of Subject Teacher Name and Sign 0f H0D


(Mr.Nirmal B.L) (Mr M S Kalbande)
JSPM’s
JAYAWANTRAO SAWANT POLYTECHNIC
Sr. No. 58, Handewadi Road, Hadapsar, Pune- 28.
Department of Computer Engineering
Academic Year 2024-25

Workbook-VI

Subject: -Advanced Java Programming Subject Code:-22517


Course Code:-CO5I Semester:- V
Unit: - _______________ Class:-TYCO
Name of the Student: - _________________________________ Roll No.______________
Unit No VI: Servlets
CO6: Develop programs using Servlets
Answer the following questions:

(Note: Only one answer is correct).

Q 1 - Which of the following is true about service() method of servlet?

A - The servlet container (i.e. web server) calls the service() method to handle requests coming from the client.

B - Each time the server receives a request for a servlet, the server spawns a new thread and calls service.

C - The service() method checks the HTTP request type (GET, POST, PUT, DELETE, etc.) and calls doGet,
doPost, doPut, doDelete, etc. methods as appropriate.

D - All of the above.

ANS : ________

Q 2 - Which of the following method can be used to get the multiple values of a parameter like checkbox
data?

A - request.getParameter()

B - request.getParameterValues()

C - request.getParameterNames()

D - None of the above.

ANS : ________

Q 3 - Which of the following code is used to get session in servlet?

A - request.getSession()

B - response.getSession()

C - new Session()

D - None of the above.

ANS : ________

Q 4 - Which of the following code retrieves the value of a request parameter?


A - Header.getParameter(name)

B - response.getParameter(name)

C - request.getParameter(name)

D - None of the above.

ANS : ________

Q 5 - Which of the following code encodes the specified URL by including the session ID in it?

A - response.encodeURL(url)

B - request.encodeURL(url)

C - Header.encodeURL(url)

D - None of the above.

ANS : ________

Q 6 - Which of the following code can be used to add a header with the given name and integer value?

A - request.addHeader(name,value)

B - response.addIntHeader(name,value)

C - Header.addDateHeader(name,value)

D - None of the above.

ANS : ________

Q 7 - Which of the following code can be used to set the content type for the body of the response?

A - request.setContentType(type)

B - response.setContentType(type)

C - header.setContentType(type)

D - None of the above.

ANS : ________

Q 8 - Which of the following is true about javax.servlet.error.request_uri?

A - This attribute gives exact error message which can be stored and analysed after storing in a java.lang.String
data type.

B - This attribute gives information about exception type which can be stored and analysed after storing in a
java.lang.Class data type.

C - This attribute gives status code which can be stored and analysed after storing in a java.lang.Integer data
type.
D - This attribute gives information about URL calling the servlet and it can be stored and analysed after storing
in a java.lang.String data type.

ANS : ________

Q 9 - Which of the following code is used to get session id of a HTTP Session object in servlets?

A - session.getSessionId()

B - session.getId()

C - session.getActiveId()

D - None of the above.

ANS : ________

Q 10 - Which of the following code is used to set the session timeout in servlets?

A - session.setMaxInactiveInterval(interval)

B - response.setMaxInactiveInterval(interval)

C - request.setMaxInactiveInterval(interval)

D - None of the above.

ANS : ________

Name and Sign of Subject Teacher Name and Sign 0f H0D


(Mr.Nirmal B.L) (Mr M S Kalbande)

You might also like