107
82.3k

180+ Enterprise Computing With JAVA Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Computer Applications (MCA) .

Chapters

Chapter: Unit 1
1.

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» A. Client
2.

_________ are used to identify a user who returns to a Website.

A. Cookies
B. Plug-ins
C. Scripts
D. ASPs
Answer» A. Cookies
3.

Which one of the following objects is passed to a Java Bean when one of its properties is set via a JSP action?

A. Servlet Request
B. Http Servlet Request
C. Servlet Response
D. Http Servlet Response
Answer» C. Servlet Response
4.

Struts framework is based on

A. Servlet.JSP and Java
B. Servlet,.HTML and Java
C. Servlet JSP, XML and Java
D. Applet, XML and Java
Answer» A. Servlet.JSP and Java
5.

Action Servlet, Request Processor and Action classes are the components of

A. View
B. Model
C. Deployment
D. Controller
Answer» B. Model
6.

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» B. Action class
7.

How many instances can be created per application module by the Request Processor class?

A. Four
B. Three
C. One
D. Uncountable instances
Answer» C. One
8.

An instance of Action is invoked by

A. ActionServlet
B. ActionListener
C. RequestProcessor
D. All of above
Answer» A. ActionServlet
9.

What declarations are required for every Java application?

A. A class and the main( ) method declarations.
B. A class with void method
C. A class with main method
D. A class with init method
Answer» A. A class and the main( ) method declarations.
10.

What is a compilation unit?

A. Java Byte code
B. Java source code file
C. Source code
D. Java Exe
Answer» B. Java source code file
11.

In order for a source code file, containing the public class Test, to successfully compile, which of the following must be true?

A. It must have a package statement
B. It must be named Test.java
C. It must import java.lang
D. It must declare a public class named Test
Answer» B. It must be named Test.java
12.

What are identifiers and what is naming convention?

A. Identifiers are used for class names
B. Identifiers are used for class names, method names
C. Identifiers are used for class names, method names and variable names.
D. None of above
Answer» C. Identifiers are used for class names, method names and variable names.
13.

What is the return type of program’s main( ) method?

A. Void main()
B. Init
C. Void
D. Run
Answer» C. Void
14.

What is the value of a[3] as the result of the following array declaration?

A. 1
B. 2
C. 3
D. 4
Answer» D. 4
15.

Which of the following are primitive types?

A. byte
B. String
C. integer
D. Float
Answer» A. byte
16.

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» D. 0 to 215-1
17.

What are primitive data types?

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

What are default values of different primitive types?

A. int - 0
B. short - 0
C. byte - 0
D. long - 0 l
Answer» A. int - 0
19.

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» B. The array subscript expression can be used to change the values of the elements of the array.
20.

Which of the following features are common to both Java & C++?

A. The class declaration
B. The access modifiers
C. The encapsulation of data & methods with in objects
D. All of above
Answer» D. All of above
21.

Which of the following statements accurately describe the use of access modifiers within a class definition?

A. They can be applied to both data & methods
B. They must precede a class's data variables or methods
C. They can appear in any order
D. All of above
Answer» D. All of above
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» C. All of above
23.

Which of the following statements correctly describes the relation between an object and the instance variable it stores?

A. Each new object has its own distinctive set of instance variables
B. Each object has a copy of the instance variables of its class
C. The instance variable of each object are separate from the variables of other objects
D. All of above
Answer» D. All of above
24.

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» D. All of above
25.

When may a constructor be called without specifying arguments?

A. When the default constructor is not called
B. When the name of the constructor differs from that of the class
C. When there are no constructors for the class
D. None of above
Answer» C. When there are no constructors for the class
26.

When might your program wish to run the garbage collecter?

A. Before it enters a compute-intense section of code
B. Before it enters a memory-intense section of code
C. When it knows there will be some idle time
D. All of above
Answer» D. All of above
27.

Which method is used to specify before any lines that uses the PrintWriter?

A. setPageType()
B. setContextType()
C. setContentType()
D. setResponseType()
Answer» C. setContentType()
28.

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» A. an association between a URL pattern and a servlet
29.

The getSession() method with ‘true’ as its parameter [ getSession(true)] it will return the appropriate session object when

A. the session is completed
B. the session object is passed to another method
C. the session does not exists
D. the session is existing
Answer» D. the session is existing
30.

Dynamic interception of requests and responses to transform the information is done by

A. servlet container
B. servlet config
C. servlet context
D. servlet filter
Answer» D. servlet filter
31.

The method forward (request,response) will

A. return back to the same method from where the forward was invoked
B. not return back to the same method from where the forward was invoked and the web pages navigation continues
C. Both A and B are correct
D. None of the above
Answer» A. return back to the same method from where the forward was invoked
32.

What's the difference between servlets and applets? 1. Servlets executes on Servers, where as Applets executes on Browser 2. Servlets have no GUI, where as an Applet has GUI 3. Servlets creates static web pages, where as Applets creates dynamic web pages 4. Servlets can handle only a single request, where as Applet can handle multiple requests

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

Which of the following are the session tracking techniques?

A. URL rewriting, using session object, using response object, using hidden fields
B. URL rewriting, using session object, using cookies, using hidden fields
C. URL rewriting, using servlet object, using response object, using cookies
D. URL rewriting, using request object, using response object, using session object
Answer» B. URL rewriting, using session object, using cookies, using hidden fields
34.

The getSession() method with ‘true’ as its parameter [ getSession(true) ] it will return the appropriate session object when

A. the session is completed
B. the session object is passed to another method
C. the session does not exists
D. the session is existing
Answer» D. the session is existing
35.

RequestDispatcher object is used

A. to include other resources
B. to include an image
C. to include xml object
D. to include e-mailing response
Answer» A. to include other resources
36.

The include() method of RequestDispatcher

A. sends a request to another resource like servlet, jsp or html
B. includes resource of file like servlet, jsp or html
C. appends the request and response objects to the current servlet
D. None of the above
Answer» B. includes resource of file like servlet, jsp or html
37.

To get the servlet environment information

A. ServletConfig object is used
B. ServletException object is used
C. ServletContext object is used
D. ServletContainer object is used
Answer» C. ServletContext object is used
38.

The values of <servlet-name> and <servlet-class> in web.xml file

A. must be same
B. must not be same
C. may be same
D. None of the above
Answer» C. may be same
39.

What is the limit of data to be passed from HTML when doGet() method is used?

A. 4K
B. 8K
C. 2K
D. 1K
Answer» C. 2K
40.

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» C. Robust
41.

In the following statements identify the disadvantages of CGI?

A. If number of clients increases, it takes more time for sending response
B. For each request, it starts a process and Web server is limited to start processes
C. It uses platform dependent language e.g. C, C++, perl
D. All mentioned above
Answer» D. All mentioned above
42.

Servlet technology is used to create web application?

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

In HTTP Request Which Asks for the loopback of the request message, for testing or troubleshooting?

A. PUT
B. OPTIONS
C. DELETE
D. TRACE
Answer» D. TRACE
44.

In HTTP Request method Get request is secured because data is exposed in URL bar?

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

In the HTTP Request method which is non-idempotent?

A. GET
B. POST
C. BOTH A & B
D. None of the above
Answer» B. POST
46.

Give the examples of Application Server from the following?

A. Apache
B. JBoss
C. Weblogic
D. Both B & C
Answer» D. Both B & C
47.

Abbreviate the term MIME?

A. Multilevel internet Mail Extension
B. Multipurpose internet Mail Extension
C. Multiuse information Mail Extension
D. None of the above
Answer» B. Multipurpose internet Mail Extension
48.

Which packages represent interfaces and classes for servlet API?

A. javax.servlet
B. javax.servlet.http
C. Both A & B
D. None of the above
Answer» C. Both A & B
49.

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» D. All mentioned above
Chapter: Unit 2
50.

What are the contents of web module?

A. JSP files
B. Java classes
C. Gif and Html files and
D. Web component deployment descriptors
Answer» A. JSP files

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.