You are on page 1of 13

QB On Advanced Java

Unit 1

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
Answer: c
2. Which of these methods are used to register a keyboard
event listener?
a. KeyListener()
b. addKistener()
c. addKeyListener()
d. eventKeyboardListener()
Answer: c
3. Which of these class is super class of all the events?
a. EventObject

b. EventClass

c. ActionEvent

d. ItemEvent

Answer: a
4. Which of these events will be notified if scroll bar is
manipulated?
a. ActionEvent

b. ComponentEvent
c. AdjustmentEvent
d. WindowEvent

Answer:c
5. In Graphics class which method is used to draws a
rectangle with the specified width and height?

a. public void drawRect(int x, int y, int width, int


height)
b. public abstract void fillRect(int x, int y, int width,
int height)
c. public abstract void drawLine(int x1, int y1, int
x2, int y2)
d. public abstract void drawOval(int x, int y, int
width, int height
Answer: a
Unit II

6. Swing is a part of _________________.


A. Java Foundation Classes
B. Java Function Classes
C. Java defined Classes
D. Java object Classes
Answer: A
7. _____________ is a simple component for displaying text,
images or both.
a. JLabel
b. JButton
c. JComboBox
d. JTextArea
Answer: A
8. _______________is a JTextField subclass that does not
show the characters that the user types.
A. JPasswordField
B. JLabelField
C. JButtonField
D. JRadioButton
Answer: A
9. The _______________ class is used to provide standard
dialog boxes such as message dialog box, confirm dialog box
and input dialog box.
A.JOptionPane
B.JButton
C.JFrame
D.JMenu
Answer:A
10.The ___________________ class is used to display
menubar on the window or frame.
A.JOptionPane
B.JButton
C.JFrame
D.JMenu
Answer: D
11. The ____________class is used to switch between a
group of components by clicking on a tab with a given title or
icon.
A.JTabbedPane
B.A.JOptionPane
C.JButton
D.JFrame
Answer:A
Unit III

12. Which of the following are interface?


1. ServletContext 2. Servlet 3. GenericServlet 4.
HttpServlet
A. 1,2,3,4
B. 1,2
C. 1,3,4
D. 1,4
Answer: D

13. Through which tag you can define servlet context in weB.
xml?
A. config-param
B. context-param
C. init-param
D. config-init-param
E. Answer:B

14. Which of these classes define the getWriter() method


that returns an object of type PrintWriter ?
A. HttpServletRequest
B. HttpServletResponse
C. ServletConfig
D. ServletContext
E. Answer: B

15. When the Web Container initializes a servlet, it creates a


_________ object for the servlet ?
A. ServletConfig
B. ServletInit
C. ServletContext
D. ServletDestroy
Answer: A
16. What are the two main types of servlet ?
A) General Servlet and HTTP Servlet
B) Generic Servlet and HTML Servlet
C) Generic Servlet and HTTP Servlet
D) Gender Servlet and SMTP Servlet
Answer: B
17. All information send from web client is available in
__________ object .
A) ServletRequest
B) ServletResponse
C) ServletOutputStream
D) ServletContext
Answer: A
Unit IV

18. The connection interface has the following parameters:


A. Port number
B. URL, username, password
C. Localhost
D. Forname
Answer: B
19. The steps to connect a database are
A. Select Driver, execute command, Connect
B. Connect, select driver, execute command , create DB
C. Execute only
D. Select Driver , Create DB, Connect,execute command
Answer: D
20. Full form od JDBC_____________
A. Java database connectivity
B. Java down connectivity
C. Java database combine
D. Join database connectivity
Answer: A

21. When a container loads a JSP it invokes which method


before servicing any requests?
A. init() method.
B. initialization() method.
C. jspInit() method.
D. initial() method.
Answer: C
22. Which of the following do not supports JSP directly?
A. Weblogic Server
B. WebSphere Server
C. Tomcat Server
D. Apache HTTP Server
Answer: D

23. Which two types of text is included in JSP page?


A. Static data and Dynamic data.
B. Static data and JSP Elements.
C. Dynamic data and JSP Elements.
D. Dynamic Data and Scriptlets.
Answer: B
24. Which of the following is not a jsp directive?
A. include
B. page
C. scriptlet
D. useBean
Answer: D
25. Which of the following are the valid scopes in JSP?
A. request, page, session, application
B. request, page, session, global
C. response, page, session, application
D. request, page, context, application
Answer: C
26. What is the need of a tag library?
A. JSP tag libraries are used by Web application
designers who can focus on presentation and the
database access.
B. JSP tag libraries are used by Web application
designers who can focus on presentation and other
enterprise services.
C. JSP tag libraries are used by Web application
designers who can focus on presentation
D. JSP tag libraries are used by Web application
designers who can focus on access data from database.
Answer: C

27. Which tag is used to execute java source code in JSP?


A. Scripting Elements
B. Directive Elements
C. Standard Action Elements
D. Declaration Elements

Answer: A

Unit V

28. Enterprise Bean Architecture consists of-


a. Enterprise Bean Server, Enterprise Bean, Enterprise
Bean Clients, and Other services like JNDI and JTS
b. Enterprise Bean Server, Enterprise Bean Containers,
Enterprise Bean, Enterprise Bean Clients
c. Enterprise Bean Server, Enterprise Bean Containers,
Enterprise Bean, Enterprise Bean Clients, and Other
services like JNDI and JTS
d. Enterprise Bean Server, Enterprise Bean, Enterprise
Bean Clients, and Other services like JNDI and JTS
Answer: C
29. EJB Architecture defines __ types of Enterprise
Beans.
a. 4
b. 2
c. 3
d. 5
Answer: B
30. Which annotation is used to obtain reference to No-
interface view or an enterprise bean through dependency
injection?
a. @Local
b. @EJB
c. @Remote
d. @Jsp

Answer: B
31. WAR modules that contain enterprise module require an
_____________deployment descriptor.
a. ejb-jar.xml
b. web-jar.xml
c. ejb.xml
d. sql-jar.xml
Answer:A
32. The container invokes the _____ _ methods on newly
constructed bean instances after completion of all
dependency injection and before first business method is
invoked on the enterprise bean.
a. @PostConstruct
b. @PreDestroy
c. @PreActivate
d. @PostPassivate
Answer: A

33. Which statement is correct?


A. public interface EnterpriseBean extends
Serializable { }
B. public interface EnterpriseBean extends Remote{ }
C. public interface EnterpriseBean extends EJB{ }
D. public interface EnetrpriseBean extens Servlet{}
Answer: B

34. __________ Message is root interface of all JMS


messages.
A. MessageListener
B. MessageDrivenContext
C. Message
d. MessageDrivenBean

Answer: D

Unit VI
35. What is ORM.
A. Object Relation Map
B. Object Rate Mapping
C. Object Relational Mapping
D. Object Relational Mapper
Answer: C

36.Which tool provides a set of persistent annotations to


define mapping metadata.
A. JPA
B. EJB
C. XML
D. JRE
Answer: A

37. Which of the following simplifies Object Relational


Mapping tool.
A. Data Creation ,Data Isolation, Data Access
B. Data Manipulation, Data Creation, Data Extraction
C. Data Creation, Data Manipulation, Data Access
D. Data Isolation, Data Extraction, Data Manipulation

Answer: C
38. What is the JPA equivalent of hibernate.cfg.xml file.
A. configuration.xml
B. persistence.xml
C. jpA. configuration.xml
D. jpA. persistence.xml
Answer: B
39. Which tool automatically creates the required SQL
queries
A. XML
B. JPQL
C. ORM
D. JPA
Answer: C
40. Which one is the simple java class that represents a row
in a database table.
A. Attribute
B. Primary key
C. foreign key
D. Entity
Answer: D
41. Which annotation is used to link two tables through a
relation table?
A. @RelationTable
B. @JoinTable
C. @LinkTable
D.@GroupTable
Answer: B
42. Which method is used to remove a persistent instance
from the datastore.
A. Session.remove()
B. Session.delete()
C. Session.del()
E. Session.rm()

43 JPA uses ________to create connection and setup the


required environment.
A. Persistence.java
B. Persistence.txt
C. Persistence.xml
D. Persistence.db

44. _________ is a factory of JDBC connections.


a) SessionFactory
b) ConnectionProvider
c) Transaction
d) Session

45. A __________ is used to get a physical connection with a


database.
a) SessionFactory
b) Session
c) Transaction
d) ConnectionProvider

You might also like