1. Which of these package contains classes and interfaces for networking?
Correct : C. java.net
2. In the following URL, identify the protocol identifier?
https://mcqmate.com:8080/course.php
Correct : A. http
3. Which of the following protocol follows connection less service?
Correct : C. UDP
4. Which of the following statement is NOT true?
Correct : D. In HTTP, all communication between two computers are encrypted
5. Which of the following statement is TRUE?
Correct : D. With datagram sockets there is no need to establish any connection and data flows between the processes are as packets.
6. Which of the following method call is valid to obtain the server's hostname by invoking
an applet?
Correct : B. getCodeBase().getHost()
7. The server listens for a connection request from a client using which of the following statement?
Correct : B. Socket s = serverSocket.accept()
8. The client requests a connection to a server using which of the following statement?
Correct : A. Socket s = new Socket(ServerName, port);
9. To connect to a server running on the same machine with the client, which of the following cannotbe used for the hostname?
Correct : D. "127.0.0.0"
10. In the socket programming, for an IP address, which can be used to find the host name
and IP address of a client/ server?
Correct : C. The InetAddress class
11. To create an InputStream on a socket, say s, which of the following statement is
necessary?
Correct : B. InputStream in = s.getInputStream();
12. Which of the following protocols is/are for splitting and sending packets to an address
across a network?
Correct : A. TCP/IP
13. Which of these is a protocol for breaking and sending packets to an address across a
network?
Correct : A. TCP/IP
14. Which of these class is used to encapsulate IP address and DNS?
Correct : C. InetAddress
15. Which of the following type of JDBC driver, is also called Type 2 JDBC driver?
Correct : B. Native-API, partly Java driver
16. Which of the following type of JDBC driver, is also called Type 1 JDBC driver?
Correct : A. JDBC-ODBC Bridge plus ODBC driver
17. Which of the following holds data retrieved from a database after you execute an SQL
query using Statement objects?
Correct : A. ResultSet
18. Which of the following is not a valid type of ResultSet?
Correct : D. ResultSet.TYPE_BACKWARD_ONLY
19. Which of the following type of JDBC driver, uses database native protocol?
Correct : D. Native-protocol, pure Java driver
20. What is JDBC?
Correct : B. JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.
21. Which of the following manages a list of database drivers in JDBC?
Correct : A. DriverManager
22. Which of the following type of JDBC driver should be used if your Java application is
accessing multiple types of databases at the same time?
Correct : C. Type 3
23. Which of the following is correct about JDBC?
Correct : C. Both of the above.
24. Which of the following step establishes a connection with a database?
Correct : C. Open a connection using the DriverManager.getConnection () method.
25. Which of the following is true about JDBC?
Correct : D. All of the above.
26. How many Result sets available with the JDBC 2.0 core API?
Correct : B. 3
27. Which method is used to establish the connection with the specified url in a Driver Manager class?
Correct : C. public static Connection getConnection(String url)
28. Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridge to the DBMS server?
Correct : A. JDBC-Net
29. JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it is
easy and flexible to use.
Correct : A. True
30. The ResultSet.next method is used to move to the next row of the ResultSet, making it the
current row.
Correct : A. True
31. Which JDBC product components does the Java software provide?
Correct : D. All mentioned above
32. Which class has traditionally been the backbone of the JDBC architecture?
Correct : A. the JDBC driver manager
33. Which was the first most widely used programming interface for accessing relational databases and it offers the ability to connect all the databases on all the platforms.?
Correct : B. ODBC API
34. JDBC is a Java API that is used to connect and execute query to the database
Correct : A. True
35. In the following JDBC drivers which is known as fully java driver?
Correct : D. Both B & C
36. Which JDBC drivers will run your program?
Correct : C. The JDBC driver test suite
37. What is the reason that a java program cannot directly communicate with an ODBC
driver?
Correct : B. ODBC written in C language
38. A leading database connectivity vendor, worked together to produce the ____.
Correct : C. Both A & B
39. Which driver converts JDBC calls directly into the vendor-specific database protocol?
Correct : C. Thin driver
40. Which models do the JDBC API support for the database access?
Correct : C. Both A & B
41. Which of the following JDBC drivers is known as a partially java driver?
Correct : B. Native-API driver
42. The JDBC API is what allows access to a data source from a Java middle tier
Correct : A. True
43. Which driver uses ODBC driver to connect to the database?
Correct : A. JDBC-ODBC bridge driver
44. How many JDBC product components does the Java software provides?
Correct : A. 3
45. How many types of JDBC drivers are available?
Correct : B. 4
46. Which method is used for an SQL statement that is executed frequently?
Correct : A. prepareStatement
47. How is the dynamic interception of requests and responses to transform the information
done?
Correct : D. servlet filter
48. Which type of ServletEngine is a server that includes built-in support for servlets?
Correct : C. Standalone ServletEngine
49. What type of servlets use these methods doGet(), doPost(),doHead, doDelete(),
doTrace()?
Correct : B. HttpServlets
50. Which cookie it is valid for single session only and it is removed each time when the user
closes the browser?
Correct : B. Non-persistent cookie
51. Sessions is a part of the SessionTracking and it is for maintaining the client state at server
side.
Correct : A. True
52. When destroy() method of a filter is called?
Correct : A. The destroy() method is called only once at the end of the life cycle of a filter
53. Web server is used for loading the init() method of servlet.
Correct : A. True
54. Servlets handle multiple simultaneous requests by using threads.
Correct : A. True
55. Which method is used to send the same request and response objects to another servlet in
RequestDispacher ?
Correct : A. forward()
56. The sendRedirect() method of HttpServletResponse interface can be used to redirect
response to another resource, it may be servlet, jsp or html file
Correct : A. True
57. Which packages represent interfaces and classes for servlet API?
Correct : C. Both A & B
58. Which class can handle any type of request so that it is protocol-independent?
Correct : A. GenericServlet
59. Which HTTP Request method is non-idempotent?
Correct : C. Both A & B
60. Which object is created by the web container at time of deploying the project?
Correct : B. ServletContext
61. What is the lifecycle of a servlet?
Correct : D. All mentioned above
62. Which method in session tracking is used in a bit of information that is sent by a web server to a browser and which can later be read back from that browser?
Correct : C. Cookies
63. Which are the examples of Application Server?
Correct : C. JBoss
64. How many techniques are used in Session Tracking?
Correct : A. 4
65. In HTTP Request method Get request is secured because data is exposed in URL bar
Correct : B. False
66. In the following statements identify the disadvantages of CGI?
Correct : D. All mentioned above
67. Servlet technology is used to create web application
Correct : A. True
68. Which method is used to specify before any lines that uses the PintWriter?
Correct : C. setContentType()
69. What are functions of Servlet container?
Correct : D. All of the above
70. Which object of HttpSession can be used to view and manipulate information about a
session?
Correct : D. All mentioned above
71. Which methods are used to bind the objects on HttpSession instance and get the objects?
Correct : C. Both A & B
72. Which method take a string not a URL?
Correct : A. sendRedirect
73. Which of the following are interface?
1. ServletContext
2. Servlet
3. GenericServlet
4. HttpServlet
Correct : B. 1,2
74. The life cycle of a servlet is managed by
Correct : B. servlet container
75. Which of the following code is used to get an attribute in a HTTP Session object in
servlets?
Correct : A. session.getAttribute(String name)
76. What is the difference between servlets and applets?
i. Servlets execute on Server; Applets execute on browser ii. Servlets have no GUI; Applet has GUI iii. Servlets creates static web pages; Applets creates dynamic web pages iv. Servlets can handle only a single request; Applet can handle multiple requests
Correct : B. i, ii are correct
77. 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
Correct : B. i, ii, iv, v
78. A deployment descriptor describes
Correct : B. Web component setting
79. The values of <servlet-name> and <servlet-class> in web.xml file
Correct : C. may be same
80. Which one is the correct order of phases in JSP life cycle?
Correct : C. Compilation, Initialization, Execution, Cleanup
81. Which technology do we mix our business logic with the presentation logic?
Correct : A. Servlet
82. Which attribute specifies a JSP page that should process any exceptions thrown but not caught in the current page?
Correct : A. The ErrorPage Attribute
83. The ASP and JSP technologies are quite similar in the way they support the creation of Dynamic pages, using HTML templates, scripting code and components for business logic.
Correct : A. True
84. Which of the following is an advantage of the statement – Separation of business logic
from JSP ?
Correct : A. Custom Tags in JSP
85. JSPs eventually are compiled into Java servlets, you can do as much with JSPs as you can
do with Java servlets.
Correct : A. True
86. JavaServer Pages often serve the same purpose as programs implemented using the
Common Gateway Interface (CGI)
Correct : A. True
87. Which is the Microsoft solution for providing dynamic Web content?
Correct : A. ASP
88. Which tag is used to execute java source code in JSP?
Correct : B. Scriptlet tag
89. A JSP page consists of which tags?
Correct : C. Both A & B
90. Which packages does a JSP API consist of?
Correct : D. Both A & C
91. Which of the scripting of JSP not putting content into service method of the converted
servlet?
Correct : C. Expressions
92. The difference between Servlets and JSP is the …………….
Correct : C. syntax
93. Which of the following are the valid scopes in JSP?
Correct : A. request, page, session, application
94. JSP includes a mechanism for defining …………………………. or custom tags.
Correct : C. dynamic attributes
95. Why DB connections are not written directly in JSPs?
Correct : D. Both B and C
96. Which is not a directive?
Correct : C. export
97. Which http method send by browser that asks the server to get the page only?
Correct : A. get
98. Which tag should be used to pass information from JSP to included JSP?
Correct : B. Using <%jsp:param> tag
99. _jspService() method of HttpJspPage class should not be overridden.