SYCS Sem IV Advance Java
SYCS Sem IV Advance Java
(CS) (Semester-IV)
Semester Examination
Sample Questions
Year 2021-2022
Subject: Advance JAVA
a. java.applet
b. java.io
c. javax.swing
d. java.awt
5. Which of these method can be used to know which key is pressed?
a. getActionEvent()
b. getActionKey()
c. getModifier()
d. getKey()
6. JFrame myFrame = new JFrame (); Any command ( such as the one listed above ) which
creates a new object of a specific class (in this case a new JFrame object called
myFrame) is generally called a…
a. Constructor
b. Layout manager
c. Parameter
d. GUI
7. What is the name of the Swing class that is used for frames?
a. Window
b. Frame
c. JFrame
d. SwingFrame
13. Which of the following method is used to perform DML statements in JDBC?
a. executeResult()
b. executeQuery()
c. executeUpdate()
d. execute()
14. Which of the following is not a valid statement in JDBC?
a. Statement
b. Prepared Statement
c. Query Statement
d. Callable Statement
15. Which JDBC driver can be used in servlet and applet both?
a. Type 3
b. Type 4
a. 2
b. 3
c. 4
d. 5
b. Type-2 Driver
c. Type-4 Driver
d. Type-1 Driver
21. 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)
22. Which of the following is true about servlets?
a. Servlets execute within the address space of web server
c. Servlets can use the full functionality of the Java class libraries
d. Servlets execute within the address space of web server, platform independent and
uses the functionality of java class libraries
23. To send text output in a response, the following method of HttpServletResponse may
be used to get the appropriate Writer/Stream object.
a. getStream
b. getOutputStream
c. getBinaryStream
d. getWriter
a. servlet context
b. servlet container
d. Intilization
a. goGet
b. doOption
c. doTrace
d. doPost
26. The following specifies the advantage of ?
It is light weight.
It supports pluggable look and feel.
a. Swing
b. AWT
c. Appplet
d. JDBC
28. The swing components classes that are used in Encapsulates a mutually exclusive set
of buttons?
a. Abstract Button
b. Button Group
c. J Button
d. Imageicon
29. In swing, Buttons are subclasses of which class?
a. Abstract Button
b. J Button
c. Button
d. JRadio Button
a. java.awt
b. java.applet
c. java.swing
d. javax.swing
a. JTextArea
b. JTable
c. JPanel
d. JtabbedPane
a. TreeNode
b. DefaultMutableNode
c. DefaultMutableTreeNode
d. Node
a. java.awt
b. java.swing
c. java.awt.swing
d. javax.swing
a. Session
b. Third party
c. Permanent
d. Second-party
a. $
b. &
c. \.
d. /
38. A maximum of Cookies are allowed of each domain
a. 21
b. 22
c. 20
d. 23
a. Plug-ins
b. Scripts
c. Cookies
d. ASPs
a. Applet
b. URL
c. Servlet
d. TCP
a. Interface
b. Modules
c. Library
d. Virtual Memory
46. Which of the following is true about javax.servlet.error.request_uri?
a. This attribute gives exact error message which can be stored and analysed
after storing in a java.lang.String data type.
b. This attribute gives information about exception type which can be stored
and analysed after storing in a java.lang.Class data type.
c. This attribute gives status code which can be stored and analysed after storing
in a java.lang.Integer data type.
d. This attribute gives information about URL calling the servlet and it can be
stored and analysed after storing in a java.lang.String data type.
50. Which page directive should be used in JSP to generate a PDF page?
a. contentType
b. generatePdf
c. typePDF
d. contentPDF
51. Which tag should be used to pass information from JSP to included JSP?
a. Using <%jsp:page> tag
b. Using <%jsp:param> tag
c. Using <%jsp:import> tag
d. Using <%jsp:useBean> tag
54. Which one is the correct order of phases in JSP life cycle?
a. Initialization, Cleanup, Compilation, Execution
b. Initialization, Compilation, Cleanup, Execution
c. Compilation, Initialization, Execution, Cleanup
d. Cleanup, Compilation, Initialization, Execution
55. “request” is instance of which one of the following classes?
a. Request
b. HttpRequest
c. HttpServletRequest
d. ServletRequest
a. jspInit()
b. _jspService()
c. jspDestroy()
d. _jspRequest()
60. Which one of the following is correct for directive in JSP?
a. <%@directive%>
b. <%!directive%>
c. <%directive%>
d. <%=directive%>
61. Which of the following action variable is used to include a file in JSP?
a. jsp:setProperty
b. jsp:getProperty
c. jsp:include
d. jsp:plugin
64. Which object stores references to the request and response objects?
a. sessionContext
b. pageContext
c. HttpSession
d. sessionAttribute
72. Which of the following is correct error when loading JAR file with duplicate name?
a. java.io.NullPointerException
b. java.lang.ClassNotFound
c. java.lang.ClassFormatError
d. java.lang.DuplicateClassError
74. What is the attribute of java bean to specify scope of bean to have single instance per
Spring IOC?
a. prototype
b. singleton
c. request
d. session
a. xml format
b. text format
c. JavaScript
d. php format
a. Ajax
b. Php
c. HTML
d. JavaScript
81. Who is the creator of JSON?
a. Alvin Alexander
b. Rasmus Lerdorf
c. Douglas Crockford
d. Jesse James Garrett
a. Semicolons
b. Colons
c. Commas
d. Hyper
a. Square brackets
b. Curley braces
c. Paratheses
d. Brackets
a. //
b. /*…*/
c. <!-- … -->
d. JSON doesn't support the comments
a. class/object
b. name/value
c. datatype/variable
d. value/=
86. What is the file type for JSON files?
a. .jsn
b. .js
c. .json
d. Jso
a. number
b. string
c. array
d. date
88. Which is the correct example of a JSON object with name, age, and city?
89. Which is the correct statement to convert the below given array to string?
a. JSON
b. json
c. JSONP
d. JSONP_Encode()
a. Platform independent
b. High performance
c. It is multi threaded
d. It is single threaded.
a. <jsp:include>
b. <jsp:forward>
c. <jsp:redirect>
d. <jsp:useBean>
a. Entity Bean
b. Stateless Session Bean
c. Stateful Session Bean
d. Message-Driven Bean
a. Page
b. Session
c. Request
d. Application
I. It is persistent.
II. Platform independent.
III. Browser executes the code.
a. Database service
b. Naming and Directory Service
c. Network Service
d. Web Service
98. 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
a. Better performance
b. Slow performance
c. Using more memory
d. Using less memory
100. The method on the result set that tests whether or not there remains at least one
unfetched tuple in the result set, is said to be
a. Fetch method
b. Next method
c. Current method
d. Access method