Advanced Java Programming _Networking in Java Chapter Question Bank


Question Bank: Advanced Java Programming (9165)
Class                    : TYIF / TYCM / TYCO (IF-CM-CO/VI/C)
Chapter No. 02       Networking in Java


Answer the following questions:
(Note: Only one answer is correct).

1.         Which is the connectionless protocol?
a)   TCP
b)   UDP
c)   IP
d)   HTTP

2.         What is the port number of HTTP? 
a)   80
b)   23
c)   47
d)   92

3.         Which protocol that web browsers and servers use to transfer hypertext pages and images? a) TCP/IP
b)   UDP
c)   HTTP
d)   SMTP

4.         Originally, all Internet addresses consisted of ____ bit values.  a) 32
b)   16
c)   24
d)   8

5.         What is the full form of DNS? 
a)   Domain Naming System
b)   Domain Naming Service
c)   Domain Naming Software
d)   Domain Naming Security

6.         What is URL? 
a)   Unicast Resource Location
b)   Uniform Research Launcher
c)   Universal Research Locator
d)   Uniform Resource Locator

7.         What is the full form of DNS? 
e)   Domain Naming System
f)    Domain Naming Service
g)   Domain Naming Software
h)   Domain Naming Security

8.         Which class is used to encapsulate both the numerical IP address and the domain name for that address?  a) InetAddress
b)   SocketAddress
c)   IPAdress
d)   DNSSockets

9.         Which of the following constructor of InetAddress is generally used?  
a)   InetAddress()
b)   InetAddress(int port)
c)   InetAddress(URL url)
d)   There is no any visible constructor for InetAddress

10.      Factory method of InetAddress class throws which of the following exception? 
a)   MalFormedURLException
b)   UnknownHostException
c)   URLException
d)   MalFormedURLIOException

11.      What type of the value that getAllByName( ) returns?
a)   InetAddress[ ]
b)   InetAddress
c)   URL[ ]
d)   URL

12.      In which form the getAddress( ) returns object’s internet address? a) int[ ]
b)   byte[ ]
c)   long[ ]
d)   String

13.      Which method returns a string that represents the host name associated with the InetAddress object? a) hostName( )
b)   myHostName( )
c)   giveHostName( )
d)   getHostName( )

14.      Which Java networking class is designed to be a listener, and for clients to connect before doing anything?
a)   Server
b)   ServerSocket
c)   Servers
d)   Socket

15.      What type of the exception might be thrown by a Socket class? 
a)   URLException
b)   UnknownHostException
c)   MalFormedURLException
d)   None

16.      What the number 80 specifies in following URL? 
a)   Port number
b)   Site number
c)   URL Uniform number
d)   HTML Page number

17.      How to specify the port number to the URL class?
a)   Use the method setPort( )
b)   Use the method setValues( )
c)   Give directly in the constructor
d)   URL takes the value automatically

18.      Which exception might be thrown by URL class?
a)   IOException
b)   UnknownHostException
c)   MalFormedURLException
d)   None of the above 

19.      The openConnection is the method of which class?  
a)   URL
b)   URLConnection
c)   Connection
d)   InetAddress

20.      If we create the datagram packet with following constructor:         DatagramPacket(data, offset, size, address, port)      What ‘size’ specifies?
a)   Size of the packet
b)   Maximum data to read
c)   Minimum data to read
d)   Size of the offset





Show me the answers!

Question 1: The correct answer is the Answer b
Question 2: The correct answer is Answer a
Question 3: The correct answer is Answer c
Question 4: The correct answer is Answer a
Question 5: The correct answer is Answer a
Question 6: The correct answer is Answer d
Question 7: The correct answer is Answer e
Question 8: The correct answer is Answer a
Question 9: The correct answer is Answer d
Question 10: The correct answer is Answer b
Question 11: The correct answer is the Answer 
Question 12: The correct answer is Answer 
Question 13: The correct answer is Answer 
Question 14: The correct answer is Answer b
Question 15: The correct answer is Answer d
Question 16: The correct answer is Answer a
Question 17: The correct answer is Answer 
Question 18: The correct answer is Answer c
Question 19: The correct answer is Answer a
Question 20: The correct answer is Answer a

You answered them all right!

Comments