117
85.3k
Chapter:

40+ Unit 2 Solved MCQs

in Enterprise Computing With JAVA

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 2
1.

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
2.

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

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

A JSP page uses the java.util.ArrayList class many times. Instead of referring the class by its complete package name each time, we want to just use ArrayList. Which attribute of page directive must be specified to achieve this? Select the one correct answer.

A. extends
B. import
C. include
D. package
Answer» B. import
4.

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» A. contentType
5.

JSP pages have access to implicit objects that are exposed automatically. Name the implicit object that is of type HttpSession.

A. session
B. application
C. httpSession
D. httpsession
Answer» A. session
6.

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» D. HttpServletRequest
7.

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

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

ActionServlet, RequestProcessor and Action classes are the components of

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

Which of the java bean tags is used to show the bean value on the web page?

A. < bean:define>
B. < bean:message>
C. < bean:show>
D. < bean:write>
Answer» D. < bean:write>
10.

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» C. 3,4
11.

What JSP is basically used today?

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

What is the purpose of <noscript> tag in Java Script?

A. Prevents scripts on the page from executing.
B. Enclose text to be displayed by non –JavaScript browsers.
C. Suppresses the result to be displayed on the web page.
D. None of the above.
Answer» B. Enclose text to be displayed by non –JavaScript browsers.
13.

Java Script entities start with ___________and end with _____________

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

Which of the following is a server-side Java Script object?

A. Function
B. File
C. FileUpload
D. Date
Answer» B. File
15.

Which of the following is a client-side Java Script object?

A. Function
B. File
C. FileUpload
D. Date
Answer» C. FileUpload
16.

Which of the following is the correct way for writing Java Script array?

A. var salaries = new Array(1:39438, 2:39839 3:83729)
B. var salaries = new (Array1=39438, Array 2=39839 Array 3=83729)
C. var salaries = new Array(39438, 39839,83729)
D. var salaries = new Array() values = 39438, 39839 83729
Answer» C. var salaries = new Array(39438, 39839,83729)
17.

Which of the following syntax is correct to refer an external script called “formValidation.js”?

A. <script href = “formValidation.js”>
B. <script source = “formValidation.js”>
C. <script name = “formValidation.js”>
D. <script src = “formValidation.js”>
Answer» D. <script src = “formValidation.js”>
18.

What is the alternate name for Java script?

A. LimeScript
B. Both a and d
C. ECMScript
D. ECMAScript
Answer» D. ECMAScript
19.

What type of image map could be used with Java Script?

A. Client-side image maps
B. Server-side image maps.
C. Both A and B
D. Localhost image maps
Answer» A. Client-side image maps
20.

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» C. Accepting parameters
21.

Which of the following is not a valid JavaScript variable name?

A. 2java
B. _java_and_java_names
C. Javaandjava
D. None of the above
Answer» A. 2java
22.

What java wrapper type is created when a JavaScript object is sent to Java?

A. ScriptObject
B. JavaObject
C. Jobject
D. JSObject
Answer» D. JSObject
23.

Which of the following is correct to write “Hello World ” on the web page?

A. System.out.println(“Hello World”)
B. print(“Hello World”)
C. document.write(“Hello World”)
D. response.write(“Hello World”)
Answer» C. document.write(“Hello World”)
24.

How does Java Script store dates in objects of Date type?

A. The number of days since 1st, 1900
B. The number of seconds since January 1st, 1970
C. The number of milliseconds since January 1st, 1970
D. The number of picoseconds since January 1st, 1970
Answer» C. The number of milliseconds since January 1st, 1970
25.

Which attribute needs to be changed to make elements invisible?

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

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» B. The machine which is running a web server.
27.

Which attribute is used to hold the Java Script Version?

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

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» B. Perform case-insensitive matching
29.

How many ServletContext objects are available for an entire web application?

A. One each per servlet
B. One each per request
C. One each per response
D. Only one
Answer» D. Only one
30.

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» A. ActionServlet
31.

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

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

An instance of Action is invoked by

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

Application module selection is done by

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

Which of the following methods is overridden by Action class?

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

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» D. Request Processor
36.

Which of the following acts as a bridge between user-invoked URI and a business method?

A. HttpRequest
B. Action class
C. ActionServlet
D. RequestProcessor
Answer» B. Action class
37.

Struts framework

A. should always decouple the application from a specific model implementation
B. provides model components
C. does not support JavaBeans and EJB
D. has built-in support for the model
Answer» A. should always decouple the application from a specific model implementation
38.

Which of the following tags in struts-config.xml file defines the availability of necessary Struts JSP custom tag libraries?

A. < jsp-lib>
B. < struts-taglib>
C. < taglib>
D. < jsp-taglib>
Answer» C. < taglib>
39.

Which can generate HTML dynamically on the client but can hardly interact with the web server to perform complex tasks like database access and image processing etc. in JSP?

A. vs.Static HTML
B. vs.Server-Side Includes
C. vs.Pure Servlets
D. Vs.JavaScript
Answer» D. Vs.JavaScript
40.

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
Answer» B. The IsErrorPage Attribute
41.

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» A. Role Based Authentication
42.

In JSP Action tags which tags are used for bean development?

A. jsp:useBean
B. jsp:setPoperty
C. jsp:getProperty
D. All mentioned above
Answer» D. All mentioned above
43.

Which two interfaces does the javax.servlet.jsp package have?

A. JspPage
B. HttpJspPage
C. PageContext
D. Both A & B
Answer» D. Both A & B
44.

Which of the following is an advantage of the statement – Separation of business logic from JSP?

A. Custom Tags in JSP
B. JSP Standard Tag Library
C. All the above
D. None of the above
Answer» A. Custom Tags in JSP
45.

JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can do with Java servlets.

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

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
Answer» B. 9
47.

JavaServer Pages often serve the same purpose as programs implemented using the Common Gateway Interface (CGI)

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

Which action tags are used in JSP for developing web application with Java Bean?

A. jsp:useBean
B. jsp:setProperty
C. jsp:getProperty
D. Both B & C
Answer» D. Both B & C

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.