Explore topic-wise MCQs in Technical Programming.

This section includes 1671 Mcqs, each offering curated multiple-choice questions to sharpen your Technical Programming knowledge and support exam preparation. Choose a topic below to get started.

1.

Which method of the request object is used to extract values of the input fields in a formwhen it is submitted?

A. getParameter
B. getParameterNames
C. getValues
D. putValues
Answer» B. getParameterNames
2.

What technique is used for the authentication mechanism in the servlet specification?

A. Role Based Authentication
B. Form Based Authentication
C. Both A & B
D. None of the above
Answer» B. Form Based Authentication
3.

EJB is a specification for J2EE server, not a product; Java beans may be a graphical component in IDE.

A. True
B. False
C. none
D. all
Answer» B. False
4.

Which server-side component is required to be deployed on the server?

A. EJB
B. RMI
C. Both A & B
D. None of the above
Answer» B. RMI
5.

A JSP page needs to generate an XML file. Which attribute of page directive may be used to specify that the JSP page is generating an XML file?

A. contentType
B. generateXML
C. type
D. outputXML
Answer» B. generateXML
6.

Which of the following is true for CORBA?

A. Protocol for distributed computing
B. Database specification
C. Specification for distributed objects
D. Both (c) and (d) above.
Answer» E.
7.

What are primitive data types?

A. byte, short, int, long
B. float, double
C. boolean
D. char
Answer» B. float, double
8.

Which part of multi-tier enterprise application contains EJB component?

A. Application Server
B. Web Server
C. Database Server
D. Fat Client
Answer» B. Web Server
9.

Which statements about a session bean class are true?

A. It is a final class
B. Overloaded constructors are supported
C. Their business methods can be 'private'
D. The ejbCreate() method must not be a final method
Answer» E.
10.

Application module selection is done by

A. Action class
B. ActionServlet
C. RequestProcessor
D. All of the above
Answer» C. RequestProcessor
11.

Which EJB container must provide an implementation of Java Naming and Directory Interface (JNDI) API to provide naming services for EJB clients and components?

A. Transaction support
B. Persistence support
C. Naming support
D. All mentioned above
Answer» D. All mentioned above
12.

In which advantage of servlet, Servlets are managed by JVM so no need to worry about memory leak, garbage collection etc.?

A. Better performance
B. Portability
C. Robust
D. Secure
Answer» D. Secure
13.

Which of the following exceptions is thrown by the ejbLoad() method of an entity bean when the database row to be loaded is not found ?

A. NoSuchEntityException
B. EJBException
C. RemoteException
D. ObjectNotFoundException
Answer» B. EJBException
14.

Which middleware services are provided by EJB?

A. Security
B. Transaction Management
C. Both A & B
D. None of the above
Answer» D. None of the above
15.

EJB is like COM, Abbreviate the term COM?

A. Component Object Model
B. Component Oriented Model
C. Common Object Model
D. Common Oriented Model
Answer» B. Component Oriented Model
16.

Which is the method available in SessionContext interface?

A. afterBegin()
B. getRollbackOnly()
C. setSessionCotext()
D. getUserTransaction()
Answer» D. getUserTransaction()
17.

Which method of the request object is used to extract values of the input fields in a form when it is submitted?

A. getParameter
B. getParameterNames
C. getValues
D. putValues
Answer» B. getParameterNames
18.

Servlet mapping defines

A. an association between a URL pattern and a servlet
B. an association between a URL pattern and a request page
C. an association between a URL pattern and a response page
D. All of the above
Answer» B. an association between a URL pattern and a request page
19.

Which statement about JTA and resource-local entity managers is correct?

A. The default transaction type for an entity manager is JTA in both Java EE and Java SE environments.
B. You cannot use a resource-local entity manager in a Java EE environment.
C. The EntityTransaction interface must be used when using a resource-local entity manager. (*)
D. Application-managed entity managers can be only a JTA transaction type.
Answer» D. Application-managed entity managers can be only a JTA transaction type.
20.

What JSP is basically used today?

A. To make controller
B. To make GUI
C. In writing business logic
D. Deprecated
Answer» C. In writing business logic
21.

Which attribute specifies a JSP page that should process any exceptions thrown but notcaught in the current page?

A. The ErrorPage Attribute
B. The IsErrorPage Attribute
C. Both A & B
D. None of the above
Answer» C. Both A & B
22.

Which of the following statements can be used to describe a public method?

A. It is accessible to all other classes in the hierarchy
B. It represents the public interface of its class
C. All of above
D. None of these
Answer» D. None of these
23.

Which statement about session beans is true?

A. In both stateless and statefull session classes, the bean provider must write the method public void remove()
B. The method << remove >> in the component interface can be accessed only by the remote clients
C. The bean’s handle must be provided by the client, in order to ask the EJBHome for removing a session bean
D. None of the above
Answer» D. None of the above
24.

Which of the following is used to redirect the response from a servlet to a JSP page?

A. response.sendRedirect()
B. request.sendRedirect()
C. request.forward()
D. response.forward()
Answer» B. request.sendRedirect()
25.

Which EJB usually represents persistent data?

A. Entity Bean
B. Stateless Session Bean
C. Stateful Session Bean
D. Message-Driven Bean
Answer» B. Stateless Session Bean
26.

How do we change the values of the elements of the array?

A. The array expression
B. The array subscript expression can be used to change the values of the elements of the array.
C. The definition of element
D. The definition & declaration of element array
Answer» C. The definition of element
27.

Which statement about entities is correct?

A. Entities must be annotated with the @Entity annotation.
B. Entities can be final classes.
C. Entities can have a single no-arg constructor with protected visibility.
D. Instance variables of an entity can have private, protected, public, or package visibility.
Answer» D. Instance variables of an entity can have private, protected, public, or package visibility.
28.

Which statement is correct about the EntityManager API?

A. The merge, persist, remove, and getReference methods must be invoked within a transaction context.
B. It is safe (no exception is thrown) to call merge or getTransaction on a JTA EntityManager instance.
C. The getReference method can throw an EntityNotFoundException.
D. Runtime exceptions thrown by the refresh and createQuery methods of the EntityManager interface do NOT cause the transaction to be rolled back.
Answer» D. Runtime exceptions thrown by the refresh and createQuery methods of the EntityManager interface do NOT cause the transaction to be rolled back.
29.

Which of the following are capable of Java Script functions?

A. Returning multiple values
B. Accepting parameters and returning values
C. Accepting parameters
D. All choices are correct
Answer» D. All choices are correct
30.

Which attribute needs to be changed to make elements invisible?

A. Visibility
B. Visible
C. Invisibility
D. Invisible
Answer» B. Visible
31.

What are the functions of the dot(.) operator?

A. It enables you to access instance variables of any objects within a class
B. It enables you to store values in instance variables of an object
C. It is used to call object methods
D. All of above
Answer» E.
32.

Which of the following are server side programming languages? 1.HTML 2.JavaScript 3.JSP 4.Sevlets

A. 1,2,3,4
B. 1,2
C. 3,4
D. None
Answer» D. None
33.

Which machine actually executed the Java Script?

A. The web server
B. The machine which is running a web server.
C. Java Script engine
D. Both A and C
Answer» C. Java Script engine
34.

Which of the following should always forwards or redirect to a resource (view) after completed?

A. HttpResponse object
B. ActionServlet
C. Action class
D. Request Processor
Answer» E.
35.

The __________tier processes HTTP protocol, scripting tasks, performs calculations, and provides access to data.

A. Client
B. Applications/Web server
C. Enterprise server
D. DBA
Answer» B. Applications/Web server
36.

What is the limitation of creating ActionServlet instances per web application?

A. Two
B. Three
C. Unlimited
D. One
Answer» B. Three
37.

The web container maintains the life cycle of a servlet instance,give the lifecycle of a servlet?

A. Servlet class is loaded
B. Servlet instance is created
C. init,Service,destroy method is invoked
D. All mentioned above
Answer» E.
38.

JSP pages have access to implicit objects that are exposed automatically. One such object that is available is request. The request object is an instance of which class?

A. HttpRequest
B. ServletRequest
C. Request
D. HttpServletRequest
Answer» E.
39.

How many jsp implicit objects are there and these objects are created by the webcontainer that are available to all the jsp pages?

A. 8
B. 9
C. 10
D. 7
Answer» C. 10
40.

Which of the methods should be implemented if any class implements the Runnableinterface?

A. start()
B. run()
C. wait()
D. notify() and notifyAll()
Answer» C. wait()
41.

JavaScript RegExp Object has modifier 'i' to __________

A. Perform case-sensitive matching
B. Perform case-insensitive matching
C. Perform both case-sensitive&case-insensitive matching
D. None of above
Answer» C. Perform both case-sensitive&case-insensitive matching
42.

Which of the following methods is overridden by Action class?

A. execute()
B. service()
C. run()
D. destroy()
Answer» B. service()
43.

Which of the following are examples of JSP directive? Select the two correct answers.

A. include
B. exclude
C. import
D. taglibrary
Answer» B. exclude
44.

Which of the following delegates the request handling to the RequestProcessor instance?

A. ActionServlet
B. Action class
C. Deployment descriptor
D. None of the above
Answer» B. Action class
45.

A message-driven bean can have an instance of a MessageDrivenContext injected. Which method can be successfully invoked on this interface from a message-driven bean?

A. getEJBHome
B. getCallerPrincipal (*)
C. isCallerInRole
D. getEJBLocalHome
Answer» C. isCallerInRole
46.

What is the range of the char type?

A. 0 to 216
B. 0 to 215
C. 0 to 216-1
D. 0 to 215-1
Answer» E.
47.

Which of the following EJB has no state?i. Message-Driven Bean. ii. BMP Entity Bean. iii. Stateless Session Bean. iv. Stateful Session Bean.

A. Both (I) and (II) above
B. Both (II) and (III) above
C. Both (III) and (IV) above
D. Both (I) and (III) above.
Answer» E.
48.

Java Script entities start with ___________and end with _____________

A. Semicolon, colon
B. Semicolon, Ampersand
C. Ampersand, colon
D. Ampersand, semicolon.
Answer» E.
49.

Which attribute is used to hold the Java Script Version?

A. SCRIPT
B. VERSION
C. LANGUAGE
D. VER
Answer» D. VER
50.

Which of the following delegates the request handling to the Request Processor instance?

A. Action Servlet
B. Action class
C. Deployment descriptor
D. None of the above
Answer» C. Deployment descriptor