On This Page

This set of Advanced JAVA Multiple Choice Questions & Answers (MCQs) focuses on JAVA Networking Set 1

Q1 | To connect to a server running on the same machine with the client, which of the following cannotbe used for the hostname?
  • “localhost”
  • 127.0.0.1
  • InetAddress.getLocalHost(),
  • 127.0.0.0
Q2 | In the socket programming, for an IP address, which can be used to find the host nameand IP address of a client/ server?
  • The ServerSocket class
  • The Socket class
  • The InetAddress class
  • The Connection interface
Q3 | To create an InputStream on a socket, say s, which of the following statement isnecessary?
  • InputStream in = new InputStream(s);
  • InputStream in = s.getInputStream();
  • InputStream in = s.obtainInputStream();
  • InputStream in = s.getStream();
Q4 | Which of the following protocols is/are for splitting and sending packets to an addressacross a network?
  • TCP/IP
  • FTP
  • SMTP
  • UDP
Q5 | Which of these is a protocol for breaking and sending packets to an address across anetwork?
  • TCP/IP
  • DNS
  • Socket
  • Proxy Server
Q6 | Which of these class is used to encapsulate IP address and DNS?
  • DatagramPacket
  • URL
  • InetAddress
  • ContentHandler
Q7 | Which of the following type of JDBC driver, is also called Type 2 JDBC driver?
  • JDBC-ODBC Bridge plus ODBC driver
  • Native-API, partly Java driver
  • JDBC-Net, pure Java driver
  • Native-protocol, pure Java driver
Q8 | Which of the following type of JDBC driver, is also called Type 1 JDBC driver?
  • JDBC-ODBC Bridge plus ODBC driver
  • Native-API, partly Java driver
  • JDBC-Net, pure Java driver
  • Native-protocol, pure Java driver
Q9 | Which of the following holds data retrieved from a database after you execute an SQLquery using Statement objects?
  • ResultSet
  • JDBC driver
  • Connection
  • Statement
Q10 | Which of the following is not a valid type of ResultSet?
  • ResultSet.TYPE_FORWARD_ONLY
  • ResultSet.TYPE_SCROLL_INSENSITIVE
  • ResultSet.TYPE_SCROLL_SENSITIVE
  • ResultSet.TYPE_BACKWARD_ONLY
Q11 | Which of the following type of JDBC driver, uses database native protocol?
  • JDBC-ODBC Bridge plus ODBC driver
  • Native-API, partly Java driver
  • JDBC-Net, pure Java driver
  • Native-protocol, pure Java driver
Q12 | What is JDBC?
  • JDBC is a java based protocol.
  • JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases.
  • JDBC is a specification to tell how to connect to a database.
  • Joint Driver for Basic Connection
Q13 | Which of the following manages a list of database drivers in JDBC?
  • DriverManager
  • JDBC driver
  • Connection
  • Statement
Q14 | Which of the following type of JDBC driver should be used if your Java application isaccessing multiple types of databases at the same time?
  • Type 1
  • Type 2
  • Type 3
  • Type 4
Q15 | Which of the following is correct about JDBC?
  • JDBC architecture decouples an abstraction from its implementation.
  • JDBC follows a bridge design pattern.
  • Both of the above.
  • None of the above.
Q16 | Which of the following step establishes a connection with a database?
  • Import packages containing the JDBC classes needed for database programming.
  • Register the JDBC driver, so that you can open a communications channel with the database.
  • Open a connection using the DriverManager.getConnection () method.
  • Execute a query using an object of type Statement.
Q17 | Which of the following is true about JDBC?
  • The JDBC API is an API to access different relational databases.
  • You use it to access relational databases without embedding a dependency on a specific database type in your code.
  • JDBC stands for Java DataBase Connectivity.
  • All of the above.
Q18 | How many Result sets available with the JDBC 2.0 core API?
  • 2
  • 3
  • 4
  • 5
Q19 | Which method is used to establish the connection with the specified url in a Driver Manager class?
  • public static void registerDriver(Driver driver)
  • public static void deregisterDriver(Driver driver)
  • public static Connection getConnection(String url)
  • public static Connection getConnection(String url,String userName,String password)
Q20 | Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridge to the DBMS server?
  • JDBC-Net
  • JDBC-ODBC bridge
  • Native API as basis
  • Native protocol as basis
Q21 | JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it iseasy and flexible to use.
  • True
  • False
  • none
  • all
Q22 | The ResultSet.next method is used to move to the next row of the ResultSet, making it thecurrent row.
  • True
  • False
  • none
  • all
Q23 | Which JDBC product components does the Java software provide?
  • The JDBC driver manager
  • The JDBC driver test suite
  • The JDBC-ODBC bridge
  • All mentioned above
Q24 | Which class has traditionally been the backbone of the JDBC architecture?
  • the JDBC driver manager
  • the JDBC driver test suite
  • the JDBC-ODBC bridge
  • All mentioned above
Q25 | 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.?
  • JDBC API
  • ODBC API
  • Both A & B
  • None of the above