Tutorial 4
1. What does the acronym "HTTP" stand for in the context of web communication?
A. Hyperlink Transfer Protocol B. Hypertext Transfer Protocol
C. Hyper Transfer Text Protocol D. High-Speed Text Protocol
2. In Java, which class is commonly used to establish a server socket for network communication?
A. Socket B. ServerSocket
C. DatagramSocket D. InetAddress
3. Which Java package provides classes for working with sockets and networking?
A. java.net B. java.io
C. java.lang D. java.util
4. Which protocol is typically used for sending email in Java applications?
A. HTTP B. FTP
C. SMTP D. POP3
5. Which Java class is used to represent an IP address?
A. IPAdress B. InetAddress
C. IPHost D. HostAddress
6. Which Java class allows you to create and manage URL objects?
A. URLBuilder B. URLManager
C. URLEncoder D. URLConnection
7. What does DNS stand for?
a) Dynamic Network System b) Domain Name System
c) Data Network Service d) Digital Network Security
8. Which port is commonly used for HTTP communication?
a) 21 b) 80
c) 443 d) 8080
9. Which Java class is used for handling UDP (User Datagram Protocol) communication?
a) DatagramSocket b) UDPSocket
c) DatagramConnection d) UDPConnection
10. Which Java method is used to establish a connection to a remote server using TCP/IP?
a) connect() b) open()
c) accept() d) bind()
11. What is the purpose of the InetAddress class in Java?
a) To represent IP addresses b) To establish socket connections
c) To send emails d) To read from files
12. In Java networking, what is the purpose of the InetAddress.getByName() method?
a. To get the IP address of a domain name b. To retrieve the host's hostname
c. To set the local host's IP address d. To create a new InetAddress object
13. What is the role of the java.net.URL class in networking?
a. To read and write files locally b. To manage database connections
c. To represent a Uniform Resource Locator d. To encrypt data during transmission
14. Which Java class is commonly used to establish a client-server connection for network communication?
a) Socket b) Datagram
c) URLConnection d) HttpRequest
15. What does IP stand for in networking?
a. Internet Protocol b. Internet Port
c. Internal Protocol d. Internet Portability
16. What does the java.net.InetAddress class represent?
a. Socket b. IP Address
c. Protocol d. MAC Address
17. TCP,FTP,Telnet,SMTP,POP etc. are examples of ?
A. Socket B. IP Address
C. Protocol D. MAC Address
18. Check whether the following code is correct or not?
import javax.net.*;
import java.io.*;
public class Net1 {
public static void main(String args[]) {
try {
InetAddress ip=InetAddress.getByName("www.javapoint.com");
System.out.println("Host Name: "+ip.getHostName());
System.out.println("Host Address: "+ip.getHostAddress());
} catch(Exception e) {
System.out.println(e);
}}}
a. Correct b. Incorrect
19. IPv6 uses ________.
a. 4 groups of 8 bits each b. 4 group of 8 hexa‐decimal digits
c. 8 groups of 4 digits each d. 8 groups of 4 hexa‐decimal digits each
20. Communication using TCP protocol is …….and ……..
a. Connection less, Iterative b. Collection less, concurrent
c. Connection oriented, Iterative d. Connection oriented, concurrent
21. Which of these is a not a factory method of InetAddress class?
a. static InetAddress getLocalHost( ) b. static InetAddress getByName(String hostname)
c. static InetAddress getAllName(String hostname) d. static InetAddress[ ] getAllByName(String hostname)
22. How many ports of TCP/IP are reserved for specific protocols?
a. 10 b. 1024 c. 2048 d. 512
23. How many bits are in a single IP address?
a. 8 b. 16 c. 32 d. 64
24. Network programming in any language definitely needs to deal with____ and ____.
a. user names; port numbers b. IP addresses; link‐ layer address
c. IP addresses; port numbers d. None of the choices are correct
25. In the following URL, identify the protocol identifier? https://mcqmate.com:8080/course.php
A. https B. php
C. //mcqmate.com:80/course.php D. 8080
26. A server socket can connect to ________ clients.
a. 1 b. 2 c. 10 d. multiple
27. Which is the proper method to retrieve the host name of local machine?
a. static InetAddress getLocalHost( ) throws UnknownHostException
b. static InetAddress getByName(String host_name ) throws UnknownHostException
c. static InetAddress getAllByName(String host_name ) throws UnknownHostException
d. String getHostAddress( )