Advanced Java
Advanced Java
Advanced Java
ENTERPRISE JAVA
UNIT – I
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
(d) a replacement of the Java Virtual Machine for running internet applications.
Page 2 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
14 The best way to access a database from a standard Java EE application is _____
(a) based on a dynamic lookup of a datasource via JPA (Java Persistence
Architecture).
(b) using a JDBC DriverManager to optimize the connection to the database.
(c) working with static SQL statements via SQLJ.
(d) developing a customised persistency framework, based on JDBC type 1 drivers.
15 Which quote illustrates best the support of web services in Java EE: -
(a) Java EE application servers contain a specific web services container to interact
with other web services.
(b) Java EE provides the required APIs and tools in order to quickly and effectively
design, develop, test and deploy web services.
(c) The web services support is part of the Java SE, and as such is available in Java
EE too.
(d) The Java EE server provides special deployment descriptors for web services.
Page 3 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
(a) 1,2,3,4
(b) 1,2
(c) 1,3,4
(d) 1,4
Page 4 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
24
Which life-cycle method make reddy the servlet for garbage collection?
(a) init
(b) service
(c) system.gc
(d) destroy
25
Through which tag you can define servlet context in web.xml?
(a) config-param
(b) context-param
(c) init-param
(d) All of these
26 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.
Page 5 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
27 When the Web Container initializes a servlet, it creates a ___________ object for the
servlet ?
(a) ServletConfig
(b) ServletInit
(c) ServletContext
(d) None of the above
28
Which of these classes define the getWriter() method that returns an object of type
PrintWriter ? Select the one correct answer. ?
(a) HttpServletRequest
(b) HttpServletResponse
(c) ServletConfig
(d) ServletContext
29 Which method defined in the HttpServletResponse may be used to set the content type
(a) setType()
(b) setContent()
(c) setContentType()
(d) setResponseContentType()
30 When the Web Container initializes a servlet, it creates a ___________ object for the
servlet ?
(a) ServletConfig
(b) ServletInit
(c) ServletContext
(d) None of the above
Page 6 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
Page 7 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
40 Which JDBC driver Type(s) can be used in either applet or servlet code?
(a) Both Type 1 and Type 2
(b) Both Type 1 and Type 3
(c) Both Type 3 and Type 4
(d) Type 4 only
41 The ………………………….. method executes a simple query and returns a single
Result Set object
(a) executeUpdate()
(b) executeQuery()
(c) execute()
(d) noexecute()
42 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.
43 Which of the following type of JDBC driver is the fastest one?
(a) Type 1
(b) Type 2
(c) Type 3
(d) Type 4
Page 8 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
Page 9 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
UNIT 2
50 Which method is used to send the same request and response objects to another servlet
in RequestDispacher ?
(a) forward()
(b) sendRedirect()
(c) Both a and b
(d) None of the above
51 Which object is used to forward the request processing from one servlet to another?
(a) ServeltContext
(b) ServeltConfig
(c) RequestDispatcher
(d) ResponceRedirect
Page 10 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
56 Which method is used to send client request to another sevlet but response to client
given by another Servlet
(a) include
(b) forward
(c) both a and b
(d) None of the above
57 _______ object contains request of client and transfer control to another web
components.
(a) Cookies
(b) b)include
(c) Request dispatcher
(d) d)forward
58 Which cookie it is valid for single session only and it is removed each time when the
user closes the browser?
(a) Persistent cookie
(b) Non-persistent cookie
(c) All the above
(d) None of the above
59 Cookies make it easy for web servers to personalize information to fit specific needs
and preferences when you visit a website.
(a) True
(b) False
60 Cookies may also called as HTTP cookies or web cookie or internet cooki
(a) True
(b) False
Page 11 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
Page 12 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
68 If you set the expiration time to ___ then cookie will be removed from browser.
(a) 1
(b) -1
(c) 0
(d) 2
71 __________does not wait for the data to be read or write before returning.
(a) bit
(b) Stream
(c) Buffer
(d) Byte
(a) Channels
(b) Selectors
(c) Threads
(d) Both a & b
Page 13 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
(a) ReadListener
(b) WriteListener
(c) Servlet
(d) JSP
(a) ReadListener
(b) WriteListener
(c) Servlet
(d) Listener
(a) Location
(b) maxFileSize
(c) maxRequestSize
(d) all of the above
(a) asynchronize
(b) synchronize
(c) buffer
(d) upload
Page 14 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
81 Which of the following code is used to get an attribute in a HTTP Session object in
servlets?
(a) session.getAttribute(String name)
(b) session.alterAttribute(String name)
(c) session.updateAttribute(String name)
(d) session.setAttribute(String name)
82 Which method is used to specify before any lines that uses the PrintWriter?
(a) setPageType()
(b) setContextType()
(c) setContentType()
(d) setResponseType()
83 Which object of HttpSession can be used to view and manipulate information about a
session?
(a) session identifier
(b) creation time
(c) last accessed time
(d) All of the above
84 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.
Page 15 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
UNIT – 3
85 Which page directive should be used in JSP to generate a PDF page?
(a) contentType
(b) generatePdf
(c) typePDF
(d) contentPDF
87 Which attribute specifies a JSP page that should process any exceptions thrown but not
caught in the current page?
(a) The ErrorPage Attribute
(b) The IsErrorPage Attribute
(c) Both A & B
(d) None of the above
88 How many jsp implicit objects are there and these objects are created by the web
container that are available to all the jsp pages?
(a) 8
(b) 9
(c) 10
(d) 7
Page 16 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
${101 % 10}
(a) 1
(b) 10
(c) 101
(d) 0
Page 17 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
98 What is difference between <%-- comment --%> and <!-- comment -->?
(a) <%-- comment --%> is JSP comment. <!-- comment --> is an HTML
comment.
(b) <%-- comment --%> is ignored by JSP container.
(c) <!-- comment --> is ignored by browser.
(d) All of the above.
102 Which attribute defines the MIME type of the HTTP response?
(a) ContentType
(b) language
(c) PageEncoding
(d) isELIgnored
Page 18 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
(a) JSP tag libraries are used by Web application designers who can focus on
presentation
(b) JSP tag libraries are used by Web application designers who can focus on
presentation and the database access.
(c) JSP tag libraries are used by Web application designers who can focus on
presentation and other enterprise services.
(d) All of above.
107 A JSP file uses a tag as <myTaglib:myTag> The myTag element here should be
defined in the tag library descriptor file in the tag element using which element.Select
the one correct answer.
(a) tagname
(b) name
(c) tag
(d) prefix
Page 19 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
108 Which of the type of Java conditional statement is the <c:choose> tag similar to?
(a) if
(b) switch
(c) when
(d) for
109 What is the default value of the type attribute for the <fmt:formatNumber> and
<fmt:parseNumber> actions?
(a) Currency
(b) Percentage
(c) number
(d) dollar
Page 20 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
113 Which Custom tag is used to dynamically add the contents from the provided URL to
the current page at request time?
(a) <c:import>
(b) <c:include>
(c) <c:content>
(d) None of the above
Page 21 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
UNIT - IV
114 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
116 Business Components developed using EJB Architecture are called as-
(a) Java Beans
(b) Enterprise Java Beans Components
(c) Enterprise Modules
(d) None of the Above
(e)
117 _________ is responsible for managing the active state for object, for each enterprise
bean.
(a) Container
(b) Server
(c) Client
(d) JNDI
118 _______ bean can implement web service, but other types of Enterprise Beans cannot.
(a) Stateful
(b) Singleton
(c) MessageDriven
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
120 ____________ session beans are instantiated once per application and exist for the
lifecycle of the application.
(a) Stateful
(b) Singleton
(c) MessageDriven
(d) Stateless
Page 23 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
126 Which EJB container must provide an implementation of Java Naming and Directory
Interface (JNDI) API to provide naming services for EJB clients and components?
128 Which type of instances retain no data or conversational state for a specific client?
(a) Message-Driven Bean
(b) Session Bean
(c) Entity Bean
(d) Persistant Bean
130 Which of the following is correct about @PreUpdate annotation for an entity bean?
Page 24 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
131 Which of the following annotation is used to specify or inject a dependency as ejb
instance into another ejb?
(a) @javax.ejb.Stateless
(b) @javax.ejb.Stateful
(c) @javax.ejb.MessageDrivenBean
(d) @javax.ejb.EJB
(a)EJB Deployer
(b)Application Assembler
(c)Network Engineer
(d)Server Provider
Page 25 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
136 _______ acts as an abstract layer between user and shared resources on a network.
(a) Software Application
(b) Directory Services
(c) Network addresses
(d) Directory Interfaces
137 Which among these are JNDI namespaces used for JAVA Lookups.
(a) java: context
(b) java: global
(c) both
(d) none
Page 26 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
UNIT – V
138 Which one of the following best illustrates the concept of Object Persistence.
(a) Determining how an object’s state[data stored in member variable of an
object ] is stored in database table columns.
(b) Provides an object – oriented view of persistent data.
(c) Design patterns and sophisticated object oriented concepts such as inheritance
and polymorphism can be used.
(d) Provide one to one mapping to database table.
141 Which method is used to remove a persistent instance from the datastore.
(a) Session.remove()
(b) Session.delete()
(c) Session.del()
(d) Session.rm()
142 Which tool provides a set of persistent annotations to define mapping metadata.
(a) JPA
(b) JSR
(c) XML
(d) JRE
Page 27 of 29
https://t.me/EnextEducation
Model College [TYBScIT – Semester V]
ENTERPRISE JAVA JYOTI SAMEL
144 The problem which arises because of the difference between model of programming
language and model of database is classified as.
(a) modelling mismatch
(b) referential mismatch
(c) dependence mismatch
(d) impedance mismatch
150 Mapping in hibernate can be given to an ORM tool either in the form of an ______or
in the form of the annotations
(a) XHTML
(b) JSON
(c) HTML
(d) XML
Page 28 of 29
https://t.me/EnextEducation