0% found this document useful (0 votes)
44 views

SYCS Sem IV Advance Java

Uploaded by

mannyboi806
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

SYCS Sem IV Advance Java

Uploaded by

mannyboi806
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

S.Y. B. Sc.

(CS) (Semester-IV)
Semester Examination
Sample Questions
Year 2021-2022
Subject: Advance JAVA

Multiple Choice Question

1. Which of the following is not a kind of exception that is thrown by JDBC


method?
a. SQL Exception
b. Data Rounding
c. Data Truncation
d. SQL Warning

2. Which of the following could be written with little knowledge of java?


a. Java Server Pages
b. Java Servlets
c. Common Gateway Interface
d. Java Community Program

3. Which of the following modifiers can be applied to a constructor?


a. volatile
b. final
c. abstract
d. private

4. Package of drawstring() method is

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

8. Which one of the following contains date information?


a. java.sql.TimeStamp
b. java.sql.Time
c. java.io.Time
d. java.io.TimeStamp
9. Which of the following is method of JDBC batch process?
a. setBatch()
b. deleteBatch()
c. removeBatch()
d. addBatch()

10. Which of the following is not a JDBC connection isolation levels?


a. TRANSACTION_NONE
b. TRANSACTION_READ_COMMITTED
c. TRANSACTION_REPEATABLE_READ
d. TRANSACTION_NONREPEATABLE_READ

11. Which of the following is advantage of using JDBC connection pool?


a. Slow performance
b. Using more memory
c. Using less memory
d. Better performance

12. What are the major components of the JDBC?

a. DriverManager, Driver, Connection, Statement, and ResultSet

b. DriverManager, Driver, Connection, and Statement

c. DriverManager, Statement, and ResultSet

d. DriverManager, Connection, Statement, and ResultSet

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

c. Type 3 and Type 2

d. Type 3 and Type 4

16. How many ways to register a driver?

a. 2

b. 3

c. 4

d. 5

17. Select the packages in which JDBC classes are defined?

a. jdbc and javax.jdbc

b. rdb and javax.rdb

c. jdbc and java.jdbc.sql

d. sql and javax.sql


18. Thin driver is also known as?
a. Type 3 Driver

b. Type-2 Driver

c. Type-4 Driver

d. Type-1 Driver

19. How constructor can be used for a servlet?


a. Initialization
b. Constructor function
c. Initialization and Constructor function
d. Setup() method

20. When destroy() method of a filter is called?


a. The destroy() method is called only once at the end of the life cycle of a filter
b. The destroy() method is called after the filter has executed doFilter method
c. The destroy() method is called only once at the begining of the life cycle of a filter
d. The destroyer() method is called after the filter has executed

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

b. Servlets are platform-independent because they are written in java

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

24. The life cycle of a servlet is managed by

a. servlet context

b. servlet container

c. The supporting protocol (such as http or https)

d. Intilization

25. Which method shows the client what server is receiving?

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.

It follows MVC(Model View Controller) architecture

a. Swing

b. AWT

c. Appplet

d. JDBC

27. MVC architecture is

a. Modelling Visual Controller

b. Model View Controller

c. Model Viewable Controller

d. Many View Controller

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

30. JTree class belongs to which package?

a. java.awt
b. java.applet

c. java.swing
d. javax.swing

31. Which components is swing represents data in row and columns?

a. JTextArea

b. JTable

c. JPanel

d. JtabbedPane

32. Which class used to create node in tree.

a. TreeNode

b. DefaultMutableNode

c. DefaultMutableTreeNode

d. Node

33. JTabbedPane class is prent in which package?

a. java.awt

b. java.swing
c. java.awt.swing

d. javax.swing

34. What is purpose of JTree?

a. To show data in form of parent and child nodes.

b. To show data in list view.

c. To show data in tabular form.

d. To show data in menu bar.

35. JFC Stands for _

a. Java foundation class

b. java foundrie class

c. java format class

d. java for class

36. Cookies remain even after the web browser is closed.

a. Session

b. Third party

c. Permanent

d. Second-party

37. How can we set Cookies visibility scope to local storage?

a. $

b. &

c. \.

d. /
38. A maximum of Cookies are allowed of each domain

a. 21

b. 22

c. 20

d. 23

39. The technique is used to identify a user who revisits a website.

a. Plug-ins

b. Scripts

c. Cookies

d. ASPs

40. HTTP Stands for

a. Hypertext transfer processor


b. Hypertext Transfer Protocol
c. High transfer protocol
d. High transfer processor

41. The HTTP request message is sent in part of three-way handshake.


a. First
b. Second
c. Third
d. Fourth
42. The HTTP response message leaves out the requested object when method
is used
a. GET
b. POST
c. HEAD
d. PUT

43. A is a small program that runs on a server.

a. Applet

b. URL

c. Servlet

d. TCP

44. JDBC Stands for

a. Java Data Base Connectivity

b. Java Driver Base Class

c. Java Data Basic class

d. Java Data Base Color

45. Each Data base system support ODBC provides a

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.

47. How constructor can be used for a servlet?


a. Initialization
b. Constructor function
c. Initialization and Constructor function
d. Setup() method

48. When destroy() method of a filter is called?


a. The destroy() method is called only once at the end of the life cycle of a filter
b. The destroy() method is called after the filter has executed doFilter method
c. The destroy() method is called only once at the begining of the life cycle of a filter
d. The destroyer() method is called after the filter has executed

49. Which are the session tracking techniques?


i. URL rewriting
ii. Using session object
iii.Using response object
iv. Using hidden fields
v. Using cookies
vi. Using servlet object
a. i, ii, iii, vi
b. i, ii, iv, v
c. i, vi, iii, v
d. i, ii, iii, v

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

52. Application is instance of which class?


a. javax.servlet.Application
b. javax.servlet.HttpContext
c. javax.servlet.Context
d. javax.servlet.ServletContext

53. Which option is true about session scope?


a. Objects are accessible only from the page in which they are created
b. Objects are accessible only from the pages which are in same session
c. Objects are accessible only from the pages which are processing the same request
d. Objects are accessible only from the pages which reside in same application

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

56. Which is not a directive?


a. include
b. page
c. export
d. useBean

57. Which is mandatory in <jsp:useBean /> tag?


a. id, class
b. id, type
c. type, property
d. type,id

58. What is full form of JSP?

a. Java Service Provider


b. Java Service Pages
c. Java Server Provider
d. Java Server Pages

59. Request processing of JSP is done by calling which method?

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

62. Which attribute uniquely identification element?


a. ID
b. Class
c. Name
d. Scope

63. “out” is implicit object of which class?


a. javax.servlet.jsp.PrintWriter
b. javax.servlet.jsp.SessionWriter
c. javax.servlet.jsp.SessionPrinter
d. javax.servlet.jsp.JspWriter

64. Which object stores references to the request and response objects?
a. sessionContext
b. pageContext
c. HttpSession
d. sessionAttribute

65. What temporarily redirects response to the browser?


a. <jsp:forward>
b. <%@directive%>
c. response.sendRedirect(URL)
d. response.setRedirect(URL)

66. Which tag is used to set a value of a JavaBean?


a. <c:set>
b. <c:param>
c. <c:choose>
d. <c:forward>

67. Java code is embedded under which tag in JSP?


a. Declaration
b. Scriptlet
c. Expression
d. Comment

68. Which of the following is not a directive in JSP?


a. page directive
b. include directive
c. taglib directive
d. command directive

69. Which of the following is not an Enterprise Beans type?


a. Doubleton
b. Singleton
c. Stateful
d. Stateless

70. Which of the following is not true about Java beans?


a. Implements java.io.Serializable interface
b. Extends java.io.Serializable class
c. Provides no argument constructor
d. Provides setter and getter methods for its properties
71. Which file separator should be used by MANIFEST file?
a. /
b. \
c. –
d. //

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

73. Which of the following is not a feature of Beans?


a. Introspection
b. Events
c. Persistence
d. Serialization

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

75. Which attribute is used to specify initialization method?


a. init
b. init-method
c. initialization
d. initialization-method

76. Which attribute is used to specify destroy method?


a. destroy
b. destroy-method
c. destruction
d. destruction-method

77. How to specify autowiring by name?


a. @Qualifier
b. @Type
c. @Constructor
d. @Name

78. JSON stands for .

a. JavaScript Object Notation


b. Java Object Notation
c. JavaScript Object Normalization
d. JavaScript Object-Oriented Notation

79. JSON is a for storing and transporting data.

a. xml format
b. text format
c. JavaScript
d. php format

80. The JSON syntax is a subset of the syntax.

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

82. In the JSON syntax, data is separated by .

a. Semicolons
b. Colons
c. Commas
d. Hyper

83. In the JSON syntax, array is written within in .

a. Square brackets
b. Curley braces
c. Paratheses
d. Brackets

84. Which is the correct symbol to insert a comment in JSON?

a. //
b. /*…*/
c. <!-- … -->
d. JSON doesn't support the comments

85. In the JSON syntax, data is in pairs.

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

87. Which is not a JSON data type?

a. number
b. string
c. array
d. date

88. Which is the correct example of a JSON object with name, age, and city?

a. { "record":{"name":"Alex", "age":21, "city":"London"} }


b. { "record"={"name":"Alex", "age":21, "city":"London"} }
c. { "record":{"name":Alex, "age":21, "city":London} }
d. { record :{"name":"Alex", "age":21, "city":"London"} }

89. Which is the correct statement to convert the below given array to string?

const arr = ["Alex", "Alvin", "Bobby", "Dock"];

a. const json_arr = JSON.string(arr);


b. const json_arr = JSON.ToString(arr);
c. const json_arr = JSON.ArrayToString(arr);
d. const json_arr = JSON.stringify(arr);
90. is a method for sending JSON data without worrying about cross-domain issues.

a. JSON
b. json
c. JSONP
d. JSONP_Encode()

91. Which of the following is not true for servlet?

a. Platform independent
b. High performance
c. It is multi threaded
d. It is single threaded.

92. JSP tag is used to transfer processing to another JSP page?

a. <jsp:include>
b. <jsp:forward>
c. <jsp:redirect>
d. <jsp:useBean>

93. Which of the following are not a container for EJB?

I. Internet Information Server.


II. Java System Application Server.
III. Tomcat.
IV. WebLogic.
a. Both (I) and (II) above
b. Both (II) and (III) above
c. Both (III) and (IV) above
d. Both (I) and (III) above.
94. EJB usually represents persistent data?

a. Entity Bean
b. Stateless Session Bean
c. Stateful Session Bean
d. Message-Driven Bean

95. Which is least visibility scope for Java bean in JSP?

a. Page
b. Session
c. Request
d. Application

96. JSP technology?

I. It is persistent.
II. Platform independent.
III. Browser executes the code.

a. Only (I) above


b. Only (II) above
c. Both (I) and (II) above
d. Both (II) and (III) above

97. JNDI technology?

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

99. Which of the following is advantage of using JDBC connection pool?

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

You might also like