Unit 3 Cwipedia
Unit 3 Cwipedia
Unit 3 Cwipedia
e-Exam Manage Questions for Advanced Java Programming (17625) for topic 3 Go Back to Subjects
Q To Fig Q Mar
Question Answer Edit Delete
No pic ure Type ks
2 TCP/IP reserves the ____________ ports for specific protocols 3 N R 1 lower 1024 Edit Delete
13 Communication using TCP protocol is __________and _________ 3 N R 1 connection-oriented, concurrent Edit Delete
16 How many bytes are required to represent an IPv4 address? 3 N R 1 4 Edit Delete
18 In the format for defining the URL what is the last part? 3 N R 1 File path Edit Delete
19 In the URL, http://www.osborne.com:80/index.htm, 80 represents 3 N R 1 Port number Edit Delete
20 In UDP send() and receive() methods belong to which class? 3 N R 1 DatagramSocket Edit Delete
21 In which class the constructors are not visible 3 N R 1 Inetaddress class Edit Delete
24 Java.net package include following classes. 3 N R 1 URLConnection, Socket, InetAddress Edit Delete
Name the class which is used to create a port where the server will
25 3 N R 1 ServerSocket Edit Delete
listen?
33 Select the proper constructor of ServerSocket class 3 N R 1 All of above Edit Delete
34 Select the proper constructor of URL class 3 N R 1 All of the above Edit Delete
38 TCP/IP sockets are used to impelement __________ connections. 3 N R 1 All of the above Edit Delete
The class which encapsulates both the numerical IP address and the
39 3 N R 1 InetAddress Edit Delete
domain name for that address.
41 The constructor which is used to create client socket is ____________. 3 N R 1 Socket(InetAddress IPAddress, int port). Edit Delete
45 The method int getPort( ) of Socket class returns____________ 3 N R 1 remote port to which this Socket object is connected. Edit Delete
The server listens for a connection request from a client using the
50 3 N R 1 Socket s = ServerSocket.accept() Edit Delete
following statement:
51 The valid sequence for URL format is ___________________ 3 N R 1 protocol, Hostname, portnumber, filepath Edit Delete
54 To create an InputStream on a Socket s, you use __________. 3 N R 1 InputStream in = s.getInputStream(); Edit Delete
56 To return an instance of InetAddress class you have to use 3 N R 1 Factory Methods of InetAddress class Edit Delete
60 UDP Protocol uses following classes for communication 3 N R 1 DatagramPacket and DatagramSocket Edit Delete
63 What does the openConnection() method of java.net.* return? 3 N R 1 Object of URLConnection class Edit Delete
64 What does URL stands for? 3 N R 1 Uniform Resource Locator Edit Delete
65 What is return type of getAddress() method of InetAddress class? 3 N R 1 byte[] Edit Delete
69 What is the optional part of URL Address 3 N R 1 Port Number Edit Delete
73 When a URL object is created __________ 3 N R 1 a connection is automatically established with that URL Edit Delete
78 Which class is used to implement datagrams with UDP protocol. 3 N R 1 DatagramSocket Edit Delete
Which class of java.net package can be used to find the host name
79 3 N R 1 The InetAddress class Edit Delete
and IP address of the client.
80 Which classes are used for connection-oriented socket programming 3 N R 1 Both A and B Edit Delete
87 Which is the correct syntax from given? 3 N R 1 byte[] getAddress() Edit Delete
89 Which method is used to know the full URL of an URL object? 3 N R 1 toExternalForm() Edit Delete
90 Which method is used to retrieve the host name associated with URL 3 N R 1 getHost() Edit Delete
91 Which method is used to return the IPAddress of local machine 3 N R 1 static InetAddress getLocalHost( ) Edit Delete
93 Which method of URL class is used to create object of URLConnection? 3 N R 1 openConnection Edit Delete
94 Which of the following are Factory Methods of InetAddress class 3 N R 1 All the Above Edit Delete
95 Which of the following class defines accept() method? 3 N R 1 ServerSocket Edit Delete
96 Which of the following constructor of InetAddress is generally used? 3 N R 1 InetAddress class does not contain any visible constructor. Edit Delete
97 Which of the following is a connection oriented protocol? 3 N R 1 TCP Edit Delete
Which of the following is mediator between real web server and client
98 3 N R 1 Proxy Edit Delete
application
99 Which of the following is not a constructor of DatagramSocket 3 N R 1 DatagramSocket(InetAddress address) Edit Delete
102 Which of the following is true about UDP? 3 N R 1 No retransmission of lost packets. Edit Delete
103 Which of the following is true for TCP ? 3 N R 1 TCP is realiable and connection oriented Edit Delete
104 Which of the following is true for UDP ? 3 N R 1 UDP is unrealiable and connection less Edit Delete
107 Which of the ServerSocket method listen client request for connection? 3 N R 1 accept() Edit Delete
108 Which of these class is necessary to implement datagrams? 3 N R 1 Both of these Edit Delete
Which of these class is used to create servers that listen for either
109 3 N R 1 ServerSockets Edit Delete
local or remote client programs?
110 Which of these class is used to encapsulate IP address and DNS? 3 N R 1 InetAddress Edit Delete
112 Which of these is a bundle of information passed between machines? 3 N R 1 Datagram Edit Delete
114 Which of these is a not a factory method of InetAddress class? 3 N R 1 static InetAddress getAllName(String hostName) Edit Delete
118 Which of these method does not belongs to DatagramPacket class 3 N R 1 getAddress() Edit Delete
122 Which of these methods is used to know the full URL of an URL object? 3 N R 1 toExternalForm() Edit Delete
Which of these methods is used to know when was the URL last
124 3 N R 1 getLastModified() Edit Delete
modified?
125 Which package is used for handling security related issue? 3 N R 1 java.security Edit Delete
126 Which socket class can send packets unreliably? 3 N R 1 java.net.DatagramSocket() Edit Delete
________ is a low level routing protocol that breaks data into smaller
131 3 N R 1 Internet protocol. Edit Delete
packets.
133 __________ is a factory method which returns an array of addresses. 3 N R 1 getAllByName. Edit Delete
151 From given list which address is called as loopback address ? 3 N U 2 127.0.0.0 Edit Delete
154 getPort() method of socket class return 3 N A 2 Returns the port number on which the socket is connected Edit Delete
Given the following lines from a Java program segment: byte[] dataOut
= new byte [512]; String userInput = "Java Programming"; dataOut =
userInput.getBytes(); Which of the following lines of code could be DatagramPacket packet = new DatagramPacket(dataOut,
157 3 N A 2 Edit Delete
used to create a new UDP datagram packet to send the data that was userInput.length, InetAddress, 9876)
provided by the user to a host identified by the InetAddress object
IPAddress?
159 Identify the valid method of URL class. 3 N U 2 All of the mentioned Edit Delete
160 Identify the valid ServerSocket constructor. 3 N U 2 public ServerSocket(int portno) Edit Delete
If you use either Telnet or FTP, which is the highest layer you are using
163 3 N U 2 Application Edit Delete
to transmit data?
In following java program fill statement showing *****. Select any one
option from given options. import java.net.*; public class InetDemo {
public static void main(String[] args) { try { InetAddress
171 ip=InetAddress.**************** System.out.println("Host Name: 3 N A 2 getByName("www.msbte.com"); Edit Delete
"+ip.getHostName()); System.out.println("IP Address:
"+ip.getHostAddress()); } catch(Exception e) { System.out.println(e); }
}}
In the following program choose the correct strings from given options
to pass in URL constructor to get an output without any exception.
import java.net.*; class URLDemo { public static void main(String
args[]) throws MalformedURLException { URL hp = new
URL("__________"); System.out.println("Protocol: " +
176 hp.getProtocol()); System.out.println("Port: " + hp.getPort()); 3 N A 2 All Edit Delete
System.out.println("Host: " + hp.getHost()); System.out.println("File: "
+ hp.getFile()); } } A. http://www.msbte.com/mainsite/index.php B.
http://www.msbte.com:80/mainsite/index.php C. www.msbte.com/ D.
www.msbte.com/mainsite/index.php
179 InputStream class is used in TCP Client-server program to 3 N U 2 Send/receive message from client to server Edit Delete
180 IPv6 uses ---------------------- 3 N U 2 Eight groups of four hexadecimal digits each Edit Delete
183 Name the components of the URL in order of their appearance 3 N U 2 Protocol,Hostname,Port Number, File Name Edit Delete
190 Select pacakge used for handling security related issues in a program 3 N U 2 java.security Edit Delete
191 Select proper method used to create the instance InetAddress class. 3 N U 2 getLocalHost(),getByName(),getAllByName() Edit Delete
194 Select the fullform of DNS 3 N U 2 Domain Name System Edit Delete
195 Select the method of DatagramPacket used to find the port number 3 N U 2 getPort() Edit Delete
196 Select the method used to create a URL Connection 3 N U 2 openConnection Edit Delete
197 Select the method which throws UnKnownHostException 3 N U 2 All of the above Edit Delete
select the proper class for creating servers that listen for either local or
198 3 N U 2 ServerSockets Edit Delete
remote client programs
199 Select the proper constructor of ServerSocket 3 N U 2 ServerSocket(int port, int maxQueue) Edit Delete
200 Select the proper constructor of the Socket class 3 N U 2 Socket(String hostName, int port) Edit Delete
201 Select the proper constructor of URL class 3 N U 2 All of above Edit Delete
202 Select the proper InetAddress factory method. 3 N U 2 static InetAddress getLocalHost() Edit Delete
204 Select the proper method to know the type of content used in the URL. 3 N U 2 getContentType() Edit Delete
Select the proper method to retrieve the host name & IP address of static InetAddress getByName(String hostName)throws
205 3 N U 2 Edit Delete
remote machine having domain name as "www.msbte.com" UnknownHostException
Select the proper method to retrieve the host name and IP Address of static InetAddress getLocalHost( )throws
206 3 N U 2 Edit Delete
local machine UnknownHostException
208 select the proper method to retrive the data from DatagramPacket 3 N U 2 getData() Edit Delete
Select the proper output for following code import java.net.*; class
DemoURL { public static void main(String args[])throws
209 3 N A 2 Port: -1 File: /downloads/index.php Edit Delete
MalformedURLException { URL hp=new
URL("http://www.msbte.com/downloads/index.php");
System.out.println("Port: "+hp.getPort()); System.out.println("File:
"+hp.getFile()); } }
213 TCP does not supports Multicasting and Broadcasting because: 3 N U 2 It is connection oriented protocol. Edit Delete
The URL connection classes are good enough for simple programs that
214 3 N U 2 HTTP Edit Delete
want to connect to ______ server to fetch content.
217 The connection establishment in TCP is called 3 N U 2 three- way handshaking Edit Delete
218 The Constructor of URL can throws an Exception called 3 N U 2 MalFormedURLException Edit Delete
The following code can be used to produce a permisson to read the file perm=new
219 3 N U 2 Edit Delete
named "abc " in the /tmp directory java.io.FilePermission("/tmp/abc","read");
The server listens for a connection request from a client using the
224 3 N U 2 Socket s = serverSocket.accept() Edit Delete
following statement:
The Socket class has how many constructors that a client uses to
225 3 N A 2 2 Edit Delete
connect to a server:
226 The User Datagram Protocol (UDP) is 3 N U 2 All of them Edit Delete
238 URL Connection is class used for_____________________. 3 N U 2 Accessing the attributes of a remote resource. Edit Delete
240 URLConnection object is retrived using following method? 3 N U 2 openConnection() Edit Delete
253 What is proper method to retrieve the host name of local machine 3 N U 2 static InetAddressgetLocalHost( )throws UnknownHostException Edit Delete
what is the out of following code if Host URL was last modified on july
18 tuesday 2013 . mport java.net.*; class networking { public static
260 void main(String[] args) throws Exception { URL obj = new 3 N A 2 Tue Jun 18 2013 Edit Delete
URL("http://www.sanfoundry.com/javamcq"); URLConnection obj1 =
obj.openConnection(); System.out.print(obj1.getLastModified); } }
264 What is the purpose of InetAddress class? 3 N U 2 To retrieve IP address of the specified host machine. Edit Delete
266 What is the use of bind() method 3 N U 2 bind a socket to a local IP address and port Edit Delete
267 What is the use of writeUTF( ) method? 3 N U 2 This method writes a string into underlying output stream Edit Delete
270 What the method getDate() of URLConnection class returns? 3 N U 2 returns time and date of response in terms of millisecond Edit Delete
272 What type of exception might be thrown by Socket class. 3 N U 2 UnknownHostException Edit Delete
when creating a client on a server port that is alerady in use client can connect to the server regardless of whehter the port is
276 3 N U 2 Edit Delete
________________ in use
277 When UnknownHostException is thrown, that indicates 3 N U 2 The IP address of a host could not be determined Edit Delete
Which class can be used to create a server socket. This object is used
281 3 N U 2 Both A & B Edit Delete
to establish communication with the clients ?
282 Which code segment listens for a socket connection? 3 N U 2 Socket socket = HttpURLConnection.open(8080); Edit Delete
285 Which Exception is thrown by DatagramSocket class constructor 3 N U 2 SocketException Edit Delete
286
Which five parameters uniquely identify a Connection ? 3 N U 2 Local IP, Remote IP, Local MAC, Remote MAC and Protocol Edit Delete
292 Which is reserved port of HTTP & FTP 3 N U 2 80 & 21 Edit Delete
295 Which method is used to obtain the Portno of client in Client Program 3 N U 2 getLocalPort() Edit Delete
296 Which method Returns the output stream of the URL connection ? 3 N U 2 getOutputStream() Edit Delete
297 Which methods are commonly used in ServerScocket class ? 3 N U 2 public Socket accept() Edit Delete
301 Which of these are correct constructor/s of URL class? 3 N U 2 All of above Edit Delete
302 Which of these class is used to encapsulate IP address and DNS? 3 N U 2 InetAddress Edit Delete
303 Which of these methods is used to know host of an URL? 3 N U 2 getHost() Edit Delete
which of this class is not related to input and output stream in terms of
304 3 N A 2 Reader Edit Delete
functioning?
311 _______ method is used to examine the address and port information 3 N U 2 getInetAddress(). Edit Delete
by the socket.
314 ___________ is a bundle of information passed between machines. 3 N U 2 Datagram Edit Delete
316 ___________ server can process multiple request at a time 3 N U 2 a concurrent Edit Delete
318 _____________ class is necessory to implements Datagram 3 N U 2 both a and b Edit Delete
326 Which client accesses the Web server by using a GET MESSAGE? 3 N U 2 HTTP Edit Delete