Top 50+ Solved JAVA Networking MCQ Questions Answer
Q. Which of these package contains classes and interfaces for networking?
a. javio
b. java.util
c. java.net
d. javax.swing
Q. In the following URL, identify the protocol identifier? https://gtu.ac.in:8080/course.php
a. http
b. gtu.ac.in
c. //gtu.ain:80/course.php
d. 8080
Q. Which of the following statement is NOT true?
a. TCP is a reliable but slow.
b. UDP is not reliable but fast.
c. File Transfer Protocol (FTP) is a standard Internet protocol for transmitting files between computers on the Internet over TCP/IP connections.
d. In HTTP, all communication between two computers are encrypted
Q. Which of the following statement is TRUE?
a. With stream sockets there is no need to establish any connection and data flows between the processes are as continuous streams.
b. Stream sockets are said to provide a connection-less service and UDP protocol is used
c. Datagram sockets are said to provide a connection-oriented service and TCP protocol is used
d. With datagram sockets there is no need to establish any connection and data flows between the processes are as packets.
Q. Which of the following method call is valid to obtain the server's hostname by invokingan applet?
a. getCodeBase().host()
b. getCodeBase().getHost()
c. getCodeBase().hostName()
d. getCodeBase().getHostName()
Q. 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);
Q. The client requests a connection to a server 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);
Q. 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(),
d. "127.0.0.0"
Q. In the socket programming, for an IP address, which can be used to find the host nameand IP address of a client/ server?
a. The ServerSocket class
b. The Socket class
c. The InetAddress class
d. The Connection interface
Q. To create an InputStream on a socket, say s, which of the following statement isnecessary?
a. InputStream in = new InputStream(s);
b. InputStream in = s.getInputStream();
c. InputStream in = s.obtainInputStream();
d. InputStream in = s.getStream();
Q. Which of the following protocols is/are for splitting and sending packets to an addressacross a network?
a. TCP/IP
b. FTP
c. SMTP
d. UDP
Q. Which of these is a protocol for breaking and sending packets to an address across anetwork?
a. TCP/IP
b. DNS
c. Socket
d. Proxy Server
Q. Which of these class is used to encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler
Q. 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