Olete.in
Articles
Mock Tests
đź§Ş J2EE MCQ Quiz Hub
J2EE Mcq Question Set 1
Choose a topic to test your knowledge and improve your J2EE skills
1. What exception is thrown when Servlet initialization fails?
ServletException
RemoteException
IOException
SocketException
2. The classes in the _________ directory must be available for the “Classloader” of the application?
/root/lib/classes/
/root/classes/
/WEB-INF/lib/classes/
/WEB-INF/classes/
3. Which of the following statements are correct about the status of the Http response?
HTTP status codes in the 500 to 599 range indicate that the error is related to the client
HTTP status codes in the 400 to 499 range indicate that the error is related to the server
HTTP status codes in the 300 to 399 range are informational messages.
HTTP status codes in the 200 to 299 range means that the client’s request was successful.
4. Why are beans used in the J2EE architecture instead of writing all the code in the JSPs?
Allows the separation of roles between web developers and application developers
Allows integration with Content Management tools
all of the above
None of the mentioned
5. What is correct about JSP Scriptlets ?
A loop can start in one Scriptlet and end in another
Instructions in a Scriptlet must follow Java syntax
Semicolon is required at the end of each statement in a Scriptlet
All the answers are true
6. Which method is called first each time a servlet is called?
Start()
Run()
init()
Servive()
7. What is the scope of response object?
session
page
request
response
8. In JSP, how can you tell which HTTP method (GET or POST) is being used by the client request?
Using request.getMethod()
Using request.setMethod()
Impossible to know
None of the mentioned
9. What is the difference between using “forward” and “sendRedirect()”?
forward runs on the client side while sendRedirect() runs on the server side
forward runs on the server side while sendRedirect() runs on the client side.
Both methods work in the same way.
None of the mentioned
10. How can a servlet call a JSP error page?
This feature is not supported
When the servlet throws the exception, it will be automatically caught by the calling JSP page
The servlet should forward the request to the URL of the specific error page. The exception is thrown as an attribute named “javax.servlet.jsp.jspException”
The servlet should redirect the response to the error page
11. Any client request to access resources in the WEB-INF/ directory must be returned with a ________?
BAD_REQUEST
SC_NOT_FOUND
SC_INTERNAL_SERVER_ERROR
ESC_BAD_REQUEST
12. Which of the following is not an implicit object in JSP?
system
page
response
request
13. Which of the following is a challenge in a J2EE?
Fault tolerance
Durability
Scalability
reliability
14. Which of the following is not a J2EE client?
Web applications
Applets
Java Web Start clients
JSP
15. Which of the following is not a web centric component?
Applets
Web Services
Servlets
Java Server Pages
16. Which of the following is not a reserved word?
while
goto
if
then
17. Which one of the following that controls communication between tiers in J2EE multi tiers architecture?
API
ACL
JDBC
RMI
18. Which of the following act as an interface between a component and the low level platform?
Session Bean
Entity Bean
Container
Applets
19. Which of the following is not a feature of Message Driven Bean?
It has no client visibility
The container cannot pool instances
It does not have a local or remote interface
It is invoked asynchronously by the container
20. A JMS message producer is created by
session
connection
destination
industry
21. Which technology provides the flexibility to swap between XML processors with no application code changes?
JAAS
SAX
XSLT
JAXP
22. Which is the serializable interface
object
method
classes
state
23. Abstract class can’t be final in java.
True
False
all of the above
None of the mentioned
24. It is ________ to have an abstract method.
Not mandatory for an static class
Not mandatory for a derived class
Not mandatory for an abstract class
Not mandatory for parent class
25. How many abstract classes can a single program contain?
At most 1
As many as required
At least 1
At most 127
26. Which is a wrapper class?
float
char
int
bool
27. Attribute in an applet tag is _________
codeclass
codename
codebase
none
28. Attribute in an applet tag is _________
length
width
class
breadth
29. JSP expression is represented by _____
<% %>
<%0 %>
<% ! %>
<% = %>
30. JSP directive is represented by _____
<% @ %>
<%0 %>
<% ! %>
<% = %>
31. What will specify IS A relationship?
IS A
Extends
Volatile
Instance of
32. Abstract class can be ______
final
subclass
instantiated
none
33. log() method is available in which interface?
Logger Interface
False
all of the above
None of the mentioned
34. If a table has 2 columns with NOT NULL and UNIQUE constraints on it ..what will be the candidate/ primary key?
both are called candidate key
one can be a primary key
one can be a candidate key
none of the above
35. Super key can be of ______
primary key + a non key
unique key + a non key
candidate key + a non key
none of the above
36. Implicit cursors will be used in _____
select query
update query
delete query
All the above
37. comparison operator in SQL
=
*
$
#
38. How to give the title to a table?
<title>
<head>
<caption>
<body>
39. How to give the italics style in html
<ii>....</ii>
<it>...</it>
<i>....</i>
<italics>....</italics>
40. What is the immediate superclass of Applet class?
window
Panel
container
object
41. ______ class is a wrapper class for the character data type.
char
character
CHAR
CHARACTER
42. Which operator is used as a termination operator in SQL?
;
@
#
!
43. Return type of getparameter(string) is _______
String
object
int
Character
44. Servlet is ______
j2ee application
CGI
Java API
Netscape
45. ER diagram is __________
high level model
low level model
representational model
hierarchical model
46. What will be the column heading for the given query? SELECT sal*10 supply FROM emp;
supply
Supply
SUPPLY
sal*10
47. The syntax for the frame _______
frame is declared within the body
frameset is declared within body
frame is declared within frameset
frameset is declared within frame
48. _______ is the superclass of all classes that are in input streams.
output stream
input stream
buffered o/p stream
object output stream
49. Classloader is a part of _______
JNI
JVM
JSM
None
50. The argument for the service method
service(HttpRequest,HttpResponse)
service(HttpResponse,HttpRequest)
service(HttpServletRequest, HttpServletResponse)
service(ServletResponse,ServletRequest)
51. The package of Generic Servlet is ________
Java.Servlet
Javax.Servlet
Javax.Servlet.generic
Javax.Servlet.http
52. Array in java is ________
string of characters
string of numbers
reference type
primitive datatype
Submit