0% found this document useful (0 votes)
48 views2 pages

Unit IV

Port number 80 is reserved for the HTTP protocol. The URL class represents a URL and has methods to manipulate it in Java. The java.net package contains networking classes and interfaces. A client must know the server's IP address and port number to connect via sockets. The output of the given Java program that compares InetAddress objects for equality would be TRUE.

Uploaded by

Rupesh Bavge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views2 pages

Unit IV

Port number 80 is reserved for the HTTP protocol. The URL class represents a URL and has methods to manipulate it in Java. The java.net package contains networking classes and interfaces. A client must know the server's IP address and port number to connect via sockets. The output of the given Java program that compares InetAddress objects for equality would be TRUE.

Uploaded by

Rupesh Bavge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

MARATHAWADA MITRAMANDAL’S POLYTECHNIC, THERGAON, PUNE-33

Academic Year 2019-2020

Program: CO5I Course: Advanced Java Programming (22517) Course Co-ordinator: Mrs.Chavan P.P.
Unit IV- Networking Basics
Question Bank

Sr.
Question Option A Option B Option C Option D
No.

1 Port number 80 is reserved for ______protocol FTP HTTHP SMTP Telnet

While using the getLocalHostO method the exception _____ is


2 UnknownHostException NullHostException LostHostException IOException
thrown
The class_______ is used for accessing the attributes of remote
3 URLconnection URL URI none of these
resource.
ServerSocket(int port, int
ServerSocket(int port, int
4 The correct way of using ServerSocket is__ . ServerSocket(int port) maxQueue, InetAddress All of these
maxQueue)
IocatAddress)
Which method of URL class represents a URL and it has complete
5 java.net.URL java.net.URLconnection java.net. URI None of the above
set of methods to manipulate URL in Java?

Which package contains the classes and interfaces required for


6 java.io java.util java.net java.awt
Java networking?

public OutputStream public synchronized void


7 Which methods are commonly used in ServerSocket class? public Socket accept() none of the above
getOutputStream() close()
Which class is used to create servers that listen for either local
8 ServerSockets httpServer httpResponse none of the above
client or remote client programs?

public OutputStream public synchronized void


9 Which methods are commonly used in ServerSocket class? public Socket accept() none of the above
getOutputStream() close()

Which of these is a protocol for breaking and sending packets to an


10 TCP/IP DNS Socket Proxy Server
address across a network?

11 How many ports of TCP/IP are reserved for specific protocols? 10 1024 2048 512

12 How many bits are in a single IP address? 8 16 32 64


URL stands for Uniform Resource Locator and represents a
13 TRUE FALSE
resource on the World Wide Web, such as a Web page.

14 Which of these class is used to encapsulate IP address and DNS ? DatagramPacket URL InetAddress ContentHandler

The Datagramsocket and DatagramPacket classes are not used for


15 TRUE FALSE
connection-less programming.
16 Which of these is a full form of DNS ? Data Network Service Data Name Service Domain Network Service Domain Name Service

What is the output of this program ?


import java.net. *;
class networking {
public static void main(String[) args) throws
UnknownHostException {
Inet;4ddress objl = InetAddress.getByName(..www.google.com");
17 0 1 TRUE FALSE
InetAddress obj2 = InetAddress.getByName(
•.www.facebook.com");
boolean x = objl.equals(obj2);
System.out.print(x);
}
}

18 The client in socket programming must know which informations ? IP address of server Port number Both a and b none of the above

Datagram is basically an information but there is no guarantee of


19 TRUE FALSE
its content, arrival or arrival time

What is the output of this program ?


import java.net. *;
class networking {
public static void main(String() args) throws
UnknownHostException {
20 InetAddress objl = InetAddress.getByName("www.google.com"); 0 1 TRUE FALSE
InetAddress obj2 = InetAddress.getByName(..www.google.com");
boolean x = obj1.equals(obj2);
System.out.print(x);
}
}

You might also like