0% found this document useful (0 votes)
92 views37 pages

Anas Dange: M.E (CMPN), B.E (I.T)

This document contains 20 multiple choice questions related to networking concepts in Java. The questions cover topics like URL, InetAddress, sockets, protocols, ports, and security. An answer key is provided for each question.

Uploaded by

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

Anas Dange: M.E (CMPN), B.E (I.T)

This document contains 20 multiple choice questions related to networking concepts in Java. The questions cover topics like URL, InetAddress, sockets, protocols, ports, and security. An answer key is provided for each question.

Uploaded by

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

MCQs

Anas Dange
M.E(CMPN), B.E(I.T)
Lecturer & Exam Co-ordinator,
Dept. of Computer Engineering,
ARKP, Panvel.
 What does URL stands for?

a) Uniform Resource Locator

b) Uniform Resource Latch


c) Universal Resource Locator
d) Universal Resource Latch

Answer: A
 How to create an instance of InetAddress?
a) getLocalHost()
b) getByName()
c) getAllByName()
d) All of these

Answer: D
 Which of these exception is thrown by URL
class’s constructors?
a) URLNotFound
b) URLSourceNotFound
c) MalformedURLException
d) URLNotFoundException

Answer: C
 Which of these methods is used to know host
of an URL?
a) host()
b) getHost()
c) GetHost()
d) gethost()

Answer: B
 Which of these class is used to encapsulate IP
address and DNS?
a) DatagramPacket
b) URL
c) InetAddress
d) ContentHandler

Answer: C
 What is the output of this program?
import java.net.*;
class networking {
public static void main(String[] args) {
URL obj = new
URL("http://www.mysite.com/javamcq");
System.out.print(obj.getProtocol());
}
}
a) http b) https
c) www d) com

Answer: A
 What is the output of this program?
import java.net.*;
class networking {
public static void main(String[] args) {
URL obj = new
URL("http://www.sanfoundry.com/javamcq");
System.out.print(obj.getHost());
} }
a) Sanfoundry
b) sanfoundry.com
c) www.sanfoundry.com
d) http://www.sanfoundry.com/javamcq

Answer: C
 Which of these package contains classes and
interfaces for networking?
a) java.io
b) java.util
c) java.net
d) java.network

Answer: C
 Which of these is a protocol for breaking and
sending packets to an address across a
network?
a) TCIP/IP
b) DNS
c) Socket
d) Proxy Server

Answer: A
 How many ports of TCP/IP are reserved for
specific protocols?
a) 10
b) 1024
c) 2048
d) 512

Answer: B
 How many bits are in a single IP address?
a) 8
b) 16
c) 32
d) 64

Answer: C
 Which of these class is used to encapsulate IP
address and DNS?
a) DatagramPacket
b) URL
c) InetAddress
d) ContentHandler

Answer: C
 What is the output of this program?
import java.net.*;
class networking {
public static void main(String[] args) {
InetAddress obj1 =
InetAddress.getByName("sanfoundary.com");
InetAddress obj2 =
InetAddress.getByName("sanfoundary.com");
boolean x = obj1.equals(obj2);
System.out.print(x);
} }
a) 0 b) 1
c) true d) false

Answer: C
 When data and acknowledgement are sent in
the same frame, this technique is called as:
A. Piggy packing
B. Piggy backing
C. Back packing
D. Good packing

Answer: B
 In IPV 4, the IP address 200.200.200.200
belongs to
A. Class A
B. Class B
C. Class C
D. Class D

Answer: C
 Which of the following addresses is used to
deliver a message to the correct application
program running on a host?
A. Port
B. IP
C. Logical
D. Physical

Answer: A
 In classful addressing, the IP address
190.255.254.254 belongs to
A. Class A
B. Class B
C. Class C
D. Class D

Answer: B
 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

Answer: B
 Which of these is a standard for
communicating multimedia content over
email?
A. http
B. https
C. Mime
D. httpd

Answer: C
 What is the output of this program?
import java.net.*;
class networking {
public static void main(String[] args) throws Exception {
URL obj = new URL("http://www.mine.com/javamcq");
URLConnection obj1 = obj.openConnection();
System.out.print(obj1.getContentType());
}
}
A. html
B. text
C. html/text
D. text/html

Answer: D
 What are the mechanisms available in
ServletContextListener interface?
A. contextInit(), contextService(),
contextDestroyed()
B. contextInitialized((),contextDestroyed()
C. contextInitialized(), contextService(),
contextDestroyed()
D. None of the above

Answer: B
 The life cycle of a servlet is managed by
A. servlet context
B. servlet container
C. the supporting protocol (such as http or
https)
D. all of the above

Answer: B
 The include() method of RequestDispatcher
A. sends a request to another resource like
servlet, jsp or html
B. includes resource of file like servlet, jsp or
html
C. appends the request and response objects to
the current servlet
D. None of the above

Answer: A
 What is the limit of data to be passed from
HTML when doGet() method is used?
A. 4K
B. 8K
C. 2K
D. 1K

Answer: C
 Which of the following are the session
tracking techniques?
A. URL rewriting, using session object, using
response object, using hidden fields
B. URL rewriting, using session object, using
cookies, using hidden fields
C. URL rewriting, using servlet object, using
response object, using cookies
D. URL rewriting, using request object, using
response object, using session object

Answer: B
 What's the difference between servlets and
applets?
1.Servlets executes on Servers, where as
Applets executes on Browser
2.Servlets have no GUI, where as an Applet has
GUI
3.Servlets creates static web pages, where as
Applets creates dynamic web pages
4.Servlets can handle only a single request,
where as Applet can handle multiple requests
A. 1,2,3 are correct B. 1,2 are correct
C. 1,3 are correct D. 1,2,3,4 are correct

Answer: B
 Which method is used to specify before any
lines that uses the PrintWriter?
A. setPageType()
B. setContextType()
C. setContentType()
D. setResponseType()

Answer: C
 Set of rules that governs data communication
is?
A. Protocols
B. Standards
C. Functions
D. None of these

Answer: A
 Which server is a mediator between real web
server and client application?
A. Host
B. HTTP
C. Proxy
D. Web

Answer: C
 Which processes use SOCK_STREAM sockets?
A. TCP
B. UDP
C. FTP
D. SCTP

Answer: A
 Which processes use SOCK_DGRAM sockets?
A. TCP
B. UDP
C. FTP
D. SCTP

Answer: B
 Port number of Telnet, HTTP, FTP, Email is?
A. 25, 80, 23, 21
B. 23, 80, 21, 25
C. 21, 70, 23, 25
D. 23, 80, 25, 21

Answer: B
 Pretty Good Privacy (PGP) is used in security
of?
A. browser
B. email
C. FTP
D. website

Answer: B
 A bundle of information passed between
machines is called?
A. Protocol
B. Cache
C. DatagramSocket
D. Datagrams

Answer: D
 Which of the following class is not related to
input and output stream in terms of
functioning?
A. InputStream
B. File
C. Writer
D. Reader

Answer: B
“Nothing pushes students to do their
best work like a professor who takes
pride not in his or her own
accomplishments, but in helping others
realize their potential”

You might also like