0% found this document useful (0 votes)
48 views

Unit 4

Uploaded by

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

Unit 4

Uploaded by

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

CHAPTER-4:( Networking Basics) (CO4)

Q. 1 A set of rules that governs data communication:


(a) Protocols (b) Standards
(c) RFCs (d) Functions
Q. 2 Which of this class is used to create servers that listen for either local or
remote client programs?
(a) HttpServer (b) MimeHeader
(c) HttpResponse (d) ServerSockets
Q. 3 A _______is a program providing services to the _____ program.
(a) Server, Client (b) Client, Server
(d) Host, Client (c) Server, Server
Q. 4 _................server can process multiple requests at a time.
(a) An iterative
(b) A concurrent
(c) A concurrent or an iterative
(d) None of these

Q.5 Network programming needs information to be in the form of ---------_byte


order.
(a) host (b) network
(c) client (d) server

Q. 6 Communication using TCP protodcol is ------


(a) connectionless, iterative
(b) connectionless, concurrent
(c) connection-oriented, iterative
(d) connection-oriented, concurrent

Q. 7 Communication using UDP protocol is -------and---------.


(a) connectionless, iterative
(b) connectionless, concurrent
(c) connection-oriented, iterative
(d) connection-oriented, concurrent
Q. 8 -------- is a server that is mediator between real web server
and client application.
(a) Host (b) H'ITP
(c) Proxy (d) Web
Q. 9 SOCK_STREAM sockets are used by --------- processes.
(a) TCP (b) UDP
(c) SCTP (d) FTP
Q. 10 SOCK_DGRAM sockets are used by ---------- processes.
(a) TCP (b) UDP
(c) SCTP (d) FTP
Q. 11 Which package contains classes and interfaces for
networking?
(a) java.io (b) java.util
(c) java.net (d) java.network
Q. 12 Port number of Telnet is __ .

(a) 21 (b) 23
(d) 79 (c) 25

Q. 13 java.net package consist of interface __ .


(a) ContentHandler Factory.
(b) SocketImplfactory
(c) SocketOption
(d) All of above
Q.14 __ is a protocol for breaking and sending packets to an
address across a network?
(a) TCIPIIP
(c) Socket
Q.15 Full form ofDNS is
(a) Data Network Service
(b) Data Name Service
(c) Domain Network Service
(d) Domain Name System

Q. 16 TCP is -------- oriented protocol.


(a) stream (b) message
(c) block (d) segment
Q.17 What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsUnknownHostException{
4. InetAddress obj1 =InetAddress.getByName("sanfoundary.com");
5. InetAddress obj2 =InetAddress.getByName("sanfoundary.com");
6. boolean x = obj1.equals(obj2);
7. System.out.print(x);
8. }
9. }

a) 0
b) 1
c) true
d) false
Q.18 What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsUnknownHostException{
4. InetAddress obj1 =InetAddress.getByName("cisco.com");
5. InetAddress obj2 =InetAddress.getByName("sanfoundary.com");
6. boolean x = obj1.equals(obj2);
7. System.out.print(x);
8. }
9. }
a) 0
b) 1
c) true
d) false
Q.19. What is the output of this program?
1. Import java.net.*;
2. class networking {
3. public static void main(String[]args) throwsUnknownHostException{
4. InetAddress obj1 =InetAddress.getByName("cisco.com");
5. System.out.print(obj1.getHostName());
6. }
7. }
a) cisco
b) cisco.com
c) www.cisco.com
d) None of the mentioned
Q.20. What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. URLConnection obj1 =obj.openConnection();
6. System.out.print(obj1.getContentType());
7. }
8. }
Note: Host URL is written in html and simple text.
a) html
b) text
c) html/text
d) text/html
Q.21. What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. System.out.print(obj.toExternalForm());
6. }
7. }
a) sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) http://www.sanfoundry.com/javamcq
Q.22.What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. System.out.print(obj.getProtocol());
6. }
7. }
a) http
b) https
c) www
d) com
Q.23. What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. System.out.print(obj.getPort());
6. }
7. }
a) 1
b) 0
c) -1
d) garbage value

Q. 24 Exception is thrown by URL class's constructors is __ .


(a) URLNotFound
(b) URLSourceNotFound
(c) MalformedURLException
(d) URLException
Q. 25 Which method is used to know the full URL of an URL object?
(a) fullHostURLO (b) getHostURLO

(c) ExternalFormO (d) toExternalFormO


Ans.: (d)
Q. 26 Which class is used to access actual bits or content
information of a URL ?

(a) URL
(c) URLConnection
(b) URLDecoder
(d) All of the mentioned

Q. 27 __ thrown to indicate that the IP address of a host could


not be determined.

(a) UnknownHostException (b)


IOException
(c) HostNotFoundException (d) None of these

Q. 28 What are the types offactory pattern ?


(a) Factory Method (b) Abstract Method
(c) All ofthe above (d) None ofthe above
Ans.: (c)
Q. 29 Which class have only one instance?
(a) Adaptor Class (b) Singleton Class

(c) Factory class (d) Proxy Class
•.1
Q. 30 A __ variable is shared by all instances of the class. It
exists even before an object is created.
(a) abstract (b) instance
(c) interface (d) static
Q. 31 __ is wrapper around everything associated with a
reply from an http server?
(a) HTTP (b) HttpResponse
(c) Httpserver (d) httpserver
Q. 32 __ is a bundle of information passed between machines.
(a) Protocol (b) Cache
(c) Datagrams (d) Segment
Q. 33 __ class is necessary to implement datagrams.

(a) DatagramPacket (b) DatagramSocket


(c) Datagram d) Both (a) and (b)

Q. 34 __ method of DatagramPacket is used to find the port


number.

(a) portO
(c) GetPortO
(b) getPortO (d) findPortO
Q. 35 Which of these tranfer protocol must be used so that URL
can be accessed by URLConnectionclass object?

(a) http (b) https


(c) URL (d) None of the mentioned

Q.36 ………………method is used to know when URL is last modified.

(a) LastModifiedO
(c) getlastModifiedO
(b) getLastModifiedO
(d) GetLastModifiedO
Q. 37 __ method is used to know the type of content used in
theURL.
(a) ContenttypeO (b) contentTypeO
(c) getContentTypeO (d) GetContentTypeO
Q. 38 Which package is used for handling security related issues
in a program ?
(a) java.security (b) java.lang.security
(c) java.awt.image (d) java.io.security
Q. 39 Class which allows us to get real time data about private
and protected member of a class is __ .
(a) java.io.security
(b) java.GetInformation
(c) ReflectPermission
(d) MembersPermission
Q. 40 The packages contain classes and interfaces used for input
and output operations of a program is __ .
(a) java.util (b) java.lang
(c) java.io (d) java.file.io
Q. 41 __ class is not a member class of java.io package.
(a) File (b) StringReader
(c) Writer (d) String

Q. 48 To return the currently installed policy object __


method is used.
(a) public Policy getPolicyO
(b) public static Policy GetPolicyO
(c) public Policy getPolicyO
(d) public static Policy getPolicyO

Q.49 A is responsible for determining whether code


executing in the Java runtime environment has permission
to perform a security-sensitive operation.
(a) security object (b) security class
(c) policy object (d) policy method
Q.50 Permission class is a part of package.
(a) java.security
(b) java.lang.Object
(c) java.permission.security
(d) java.security.Permission
Q. 51 Which of following are sub classes of permission class?
(a) AlIPermission (b) FilePermission
(c) ServicePermission (d) All ofthe above
Q.52 What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL("http://www.sanfoundry.com/javamcq");
5. System.out.print(obj.getHost());
6. }
7. }
a) sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) http://www.sanfoundry.com/javamcq
Q53.What is the output of this program?
1. importjava.net.*;
2. class networking {
3. publicstaticvoid main(String[]args)throwsMalformedURLException{
4. URLobj=newURL(“http://www.sanfoundry.com/javamcq”);
5. System.out.print(obj.toExternalForm());
6. }
7. }
a) sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) http://www.sanfoundry.com/javamcq
Q54. RMI stands for?
a) Remote Mail Invocation
b) Remote Message Invocation
c) Remaining Method Invocation
d) Remote Method Invocation
Q55.A remote object is an object whose method can be invoked from another virtual
environment.
a) True
b) False
Q56. A typical _________ program creates some remote objects, makes references to
these objects accessible, and waits for clients to invoke methods on these objects.
a) Server
b) Client
c) Thread
d) Concurrent
Q57.A typical __________ program obtains a remote reference to one or more remote
objects on a server and then invokes methods on them.
a) Server
b) Client
c) Thread
d) Concurrent
Q58. The ___________ layer, which provides the interface that client and server
application objects use to interact with each other.
a) Increasing
b) Count
c) Bit
d) Stub/skeleton

Q59. A layer which is the binary data protocol layer.


a) stub layer
b) skeleton layer
c) remote layer
d) transport protocol
Q60.A middleware layer between the stub skeleton and transport.
a) remote layer
b) instruction layer
c) reference layer
d) remote reference layer
Q61. An object acting as a gateway for the client side.
a) skeleton
b) stub
c) remote
d) server
Q62.A gateway for the server side object.
a) skeleton
b) stub
c) remote
d) server
Q63. RMI uses stub and skeleton for communication with the ________ object.
a) client
b) remote
c) server
d) any
Q64. Which of these interface abstracts the output of messages from httpd?
a) LogMessage
b) LogResponse
c) Httpdserver
d) httpdResponse
Q65. Which of these class is used to create servers that listen for either local or
remote client programs?
a) httpServer
b) ServerSockets
c) MimeHeader
d) HttpResponse
Q66. Which of these is a standard for communicating multimedia content over email?
a) http
b) https
c) Mime
d) httpd
Q67. Which of these methods is used to make raw MIME formatted string?
a) parse()
b) toString()
c) getString()
d) parseString()
Q68. Which of these class is used for operating on request from the client to the
server?
a) http
b) httpDecoder
c) httpConnection
d) httpd
Q69.Which of these method of MimeHeader is used to return the string equivalent of
the values stores on MimeHeader?
a) string()
b) toString()
c) convertString()
d) getString()
Q70.Which of these is an instance variable of class httpd?
a) port
b) cache
c) log
d) All of the mentioned
Q71. Which of these methods of httpd class is used to read data from the stream?
a) getDta()
b) GetResponse()
c) getStream()
d) getRawRequest()
Q72. Which of these method of httpd class is used to get report on each hit to HTTP
server?
a) log()
b) logEntry()
c) logHttpd()
d) logResponse()
Q73. Which of these methods are used to find a URL from the cache of httpd?
a) findfromCache()
b) findFromCache()
c) serveFromCache()
d) getFromCache()
Q74. Which of these variables stores the number of hits that are successfully
served out of cache?
a) hits
b) hitstocache
c) hits_to_cache
d) hits.to.cache
Q75. Which of these method of httpd class is used to write UrlCacheEntry object
into local disk?
a) writeDiskCache()
b) writetoDisk()
c) writeCache()
d) writeDiskEntry()
Q76. Which of these method is used to start a server thread?
a) run()
b) start()
c) runThread()
d) startThread()
Q77. Which of these method is called when http daemon is acting like a normal web
server?
a) Handle()
b) HandleGet()
c) handleGet()
d) Handleget()
Q78. What does URL stands for?
a) Uniform Resource Locator
b) Uniform Resource Latch
c) Universal Resource Locator
d) Universal Resource Latch
Q79. Which of these exceptions is thrown by URL class’s constructors?
a) URLNotFound
b) URLSourceNotFound
c) MalformedURLException
d) URLNotFoundException
Q80. Which of these methods is used to know host of an URL?
a) host()
b) getHost()
c) GetHost()
d) gethost()
Q81. Which of these methods is used to know the full URL of an URL object?
a) fullHost()
b) getHost()
c) ExternalForm()
d) toExternalForm()
Q82. Which of these class is used to access actual bits or content information of
a URL?
a) URL
b) URLDecoder
c) URLConnection
d) All of the mentioned
Q83. Which of these is a wrapper around everything associated with a reply from an
http server?
a) HTTP
b) HttpResponse
c) HttpRequest
d) httpserver
Q84. Which of these transfer protocol must be used so that URL can be accessed by
URLConnection class object?
a) http
b) https
c) Any Protocol can be used
d) None of the mentioned
Q85. Which of these methods is used to know when was the URL last modified?
a) LastModified()
b) getLastModified()
c) GetLastModified()
d) getlastModified()
Q86. Which of these methods is used to know the type of content used in the URL?
a) ContentType()
b) contentType()
c) getContentType()
d) GetContentType()
Q87. Which of these data member of HttpResponse class is used to store the
response from an http server?
a) status
b) address
c) statusResponse
d) statusCode
Q88. Which of these is a bundle of information passed between machines?
a) Mime
b) Cache
c) Datagrams
d) DatagramSocket
Q89. Which of these class is necessary to implement datagrams?
a) DatagramPacket
b) DatagramSocket
c) All of the mentioned
d) None of the mentioned
Q90. Which of these method of DatagramPacket is used to find the port number?
a) port()
b) getPort()
c) findPort()
d) recievePort()
Q91. Which of these method of DatagramPacket is used to obtain the byte array of
data contained in a datagram?
a) getData()
b) getBytes()
c) getArray()
d) recieveBytes()
Q92. Which of these methods of DatagramPacket is used to find the length of byte
array?
a) getnumber()
b) length()
c) Length()
d) getLength()
Q93. Which of these class must be used to send a datagram packets over a
connection?
a) InetAdress
b) DatagramPacket
c) DatagramSocket
d) All of the mentioned
Q94. Which of these method of DatagramPacket class is used to find the destination
address?
a) findAddress()
b) getAddress()
c) Address()
d) whois()
Q95. Which of these is a return type of getAddress() method of DatagramPacket
class?
a) DatagramPacket
b) DatagramSocket
c) InetAddress
d) ServerSocket
Q96. Which API gets the SocketAddress (usually IP address + port number) of the
remote host that this packet is being sent to or is coming from.
a) getSocketAddress()
b) getAddress()
c) address()
d) none of the mentioned
Q97.How does applet and servlet communicate?
a) HTTP
b) HTTPS
c) FTP
d) HTTP Tunneling
Q98. In CGI, process starts with each request and will initiate OS level process.
a) True
b) False
Q99. Which class provides system independent server side implementation?
a) Socket
b) ServerSocket
c) Server
d) ServerReader
Q100. What happens if ServerSocket is not able to listen on the specified port?
a) The system exits gracefully with appropriate message
b) The system will wait till port is free
c) IOException is thrown when opening the socket
d) PortOccupiedException is thrown
Q101. What does bind() method of ServerSocket offer?
a) binds the serversocket to a specific address (IP Address and port)
b) binds the server and client browser
c) binds the server socket to the JVM
d) binds the port to the JVM

You might also like