Advanced Java Set 1
Advanced Java Set 1
6. Which of the following method call is valid to obtain the server's hostname by
invoking an applet?
A. getCodeBase().host()
B. getCodeBase().getHost()
C. getCodeBase().hostName()
D. getCodeBase().getHostName()
Answer: B
7. The server listens for a connection request from a client using which of the
following statement?
A. Socket s = new Socket(ServerName, port);
B. Socket s = serverSocket.accept()
C. Socket s = serverSocket.getSocket()
D. Socket s = new Socket(ServerName);
Answer: B
9. To connect to a server running on the same machine with the client, which of the
following cannotbe used for the hostname?
A. “localhost”
B. "127.0.0.1"
C. InetAddress.getLocalHost(),
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?
A. The ServerSocket class
B. The Socket class
C. The InetAddress class
D. The Connection interface
Answer: C
12. Which of the following protocols is/are for splitting and sending packets to an
address across a network?
A. TCP/IP
B. FTP
C. SMTP
D. UDP
Answer: A
13. Which of these is a protocol for breaking and sending packets to an address
across a network?
A. TCP/IP
B. DNS
C. Socket
D. Proxy Server
Answer: A
15. Which of the following type of JDBC driver, is also called Type 2 JDBC driver?
A. JDBC-ODBC Bridge plus ODBC driver
B. Native-API, partly Java driver
C. JDBC-Net, pure Java driver
D. Native-protocol, pure Java driver
Answer: B
16. Which of the following type of JDBC driver, is also called Type 1 JDBC driver?
A. JDBC-ODBC Bridge plus ODBC driver
B. Native-API, partly Java driver
C. JDBC-Net, pure Java driver
D. Native-protocol, pure Java driver
Answer: A
17. Which of the following holds data retrieved from a database after you execute
an SQL query using Statement objects?
A. ResultSet
B. JDBC driver
C. Connection
D. Statement
Answer: A
19. Which of the following type of JDBC driver, uses database native protocol?
A. JDBC-ODBC Bridge plus ODBC driver
B. Native-API, partly Java driver
C. JDBC-Net, pure Java driver
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?
A. Type 1
B. Type 2
C. Type 3
D. Type 4
Answer: C