0% found this document useful (0 votes)
36 views6 pages

Sanjivani K. B. P. Polytechnic: Department of Computer Technology

Uploaded by

danepratik4
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)
36 views6 pages

Sanjivani K. B. P. Polytechnic: Department of Computer Technology

Uploaded by

danepratik4
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/ 6

Sanjivani Rural Education Society’s

SANJIVANI K. B. P. POLYTECHNIC
Department of Computer Technology
KOPARGAON – 423601, DIST: AHMEDNAGAR
2023-2024

Class Test: [Unit IV - Networking Basics]

1. UDP stands for


a. User Data Port b. User Datagram Protocol c. Used Data Provider d. User Data Protocol
Ans:- User Datagram Protocol

2. IPv6 uses .
a. 4 groups of 8 bits each b. 4 group of 8 hexa‐decimal digits
c. 8 groups of 4 digits each d. 8 groups of 4 hexa‐decimal digits each
ans:- d. 8 groups of 4 hexadecimal digits each

3. Communication using TCP protocol is and .


a. Connection less, Iterative b. Collection less, concurrent c. Connection oriented, Iterative d. Connection oriented, concurrent
Ans:- d. Connection oriented, concurrent

4. Name the class which is used to create a port where the server will listen.
(a) Server (b) Socket (c) ServerSocket (d) SocketServer
Ans:- (c) ServerSocket

5.Which of these is a not a factory method of InetAddress class?


a. static InetAddress getLocalHost( ) b. static InetAddress getByName(String hostname)
c. static InetAddress getAllName(String hostname) d. static InetAddress[ ] getAllByName(String hostname)
Ans:- c. static InetAddress getAllName(String hostname)

6. Which from the below use “Middle tier”.


a. 3 tier b. 4 tier c. n ‐ tier d. all of the above
Ans:- d. all of the above

7. What is the use of WriteUTF( ) method?


a. This method writes a string into underlying output stream. b. This method reads a sting from underlying input stream.
c. This method writes a byte array into underlying output stream. d. This method writes a character array into underlying output stream.
Ans:- a. This method writes a string into underlying output stream.

8. Which of these is a bundle of information passed between machines?


a. MIME b. Cache c. Datagram d. Socket
Ans:- c. Datagram

9. int getServerPort( ) method


a. returns the port number on which this request was received. b. returns the port name on which the request was received.
c. returns the server number on which this request was received. d. returns the port number on which this response/request was received.
Ans:- a. returns the port number on which this request was received

10. In this constructor ServerSocket(int port, int max_queue) what is the default value for max_queue?
a. 100 b. 50 c. 75 d. 80
Ans:- b. 50

11. The constructor of URL can throw an exception called


a. MalformedUrlException b. UrlNotFoundException d. UrlException d. UrlSourceNotFoundException

ans:- a. MalformedUrlException

12. Which IP address is multicast IP address?


a. 192.168.2.32 b. 235.55.45.2 c. 12.22.1.2 d. None of these
ans:- b. 235.55.45.2

13. How many ports of TCP/IP are reserved for specific protocols?
a. 10 b. 1024 c. 2048 d. 512
Ans:- b. 1024

14. How many bits are in a single IP address?


a. 8 b. 16 c. 32 d. 64
ans:- c. 32

15. Which of these is a full form of DNS?


a. Data Network Service b. Data Name Service c. Domain Network Service d. Domain Name Service
ans:- b . Domain Name Service

16. Which of these class is used to encapsulate IP address and DNS?


a. DatagramPacket b. URL c. InetAddress d. ContentHandler
ans:- c. InetAddress

17. Network programming in any language definitely needs to deal with and .
a. user names; port numbers b. IP addresses; link‐ layer address c. IP addresses; port numbers d. None of the choices are correct
ans:- c. IP addresses; port numbers

18. The class used in Java network programming for socket address is the class.
a. InetAddress b. Socket address c. InetSocketAddress d. None of the choices are correct
ans:- c. InetSocketAddress

19. Which of the following protocol follows connection less service?


a. TCP b. TCP/IP c. UDP d. HTTP
ans:- c. UDP

20. Which method is establish a connection between server and client?


a. accept() b. open() c).getLocalHost() d. openConnection()
ans:- a. accept()

21. Which of these package contains classes and interfaces for networking?
A. java.io B. java.util C. java.net D. javax.swing
Ans:- C. java.net

22. In the following URL, identify the protocol identifier? https://mcqmate.com:8080/course.php


A. https B. php C. //mcqmate.com:80/course.php D. 8080
Ans:- A. https

23. Which 5 parameters uniquely identify a connection?


a. Local IP, Remote IP, Local MAC, Remote MAC and Protocol b. Local IP, Local PORT, Remote MAC, Remote PORT and Protocol
c. Local MAC, Local PORT, Remote MAC, Remote PORT and Protocol d. Local IP, Local PORT, Remote IP, Remote PORT and Protocol
ans:- d. Local IP, Local PORT, Remote IP, Remote PORT and Protoco

24. Which of the following statement is NOT true?


A. TCP is a reliable but slow. B. UDP is not reliable but fast.
C. In HTTP, all communication between two computers are encrypted
D. File Transfer Protocol (FTP) is a standard Internet protocol for transmitting files between computers on the Internet over TCP/IP connections.
McqMate.com
Ans:- C. In HTTP, all communication between two computers are encrypted

25. Which of the following statement is TRUE?


A. With stream sockets there is no need to establish any connection and data flows between the processes are as continuous streams.
B. Stream sockets are said to provide a connection‐less service and UDP protocol is used
C. Datagram sockets are said to provide a connection‐oriented service and TCP protocol is used
D. With datagram sockets there is no need to establish any connection and data flows between the processes are as packets.
Ans:- D. With datagram sockets there is no need to establish any connection and data flows between the processes are as packets
26. Which of the following method call is valid to obtain the server's hostname by invoking an applet?
A. getCodeBase().host() B. getCodeBase().getHost() C. getCodeBase().hostName() D. getCodeBase().getHostName()
Ans:- D. getCodeBase().getHostName()

27. The server listens for a connection request from a client using which of the following statement?
A. Socket s = new Socket(ServerName, port); B. Socket s = serverSocket.accept()
C. Socket s = serverSocket.getSocket() D. Socket s = new Socket(ServerName);
Ans:- B. Socket s = serverSocket.accept()

28. The client requests a connection to a server using which of the following statement?
A. Socket s = new Socket(ServerName, port); B. Socket s = serverSocket.accept();
C. Socket s = serverSocket.getSocket(); D. Socket s = new Socket(ServerName);
Ans:- A. Socket s = new Socket(ServerName, port);

29. To connect to a server running on the same machine with the client, which of the following cannotbe used for the hostname?
A. “localhost” B. "127.0.0.1" C. InetAddress.getLocalHost(), D. "127.0.0.0"
Ans:- D. "127.0.0.0"

30. In the socket programming, for an IP address, which can be used to find the host name and IP address of a client/ server?
A. The ServerSocket class B. The Socket class C. The InetAddress class D. The Connection interface
Ans:- C. The InetAddress class

31. To create an InputStream on a socket, say s, which of the following statement is necessary?
A. InputStream in = new InputStream(s); B. InputStream in = s.getInputStream();
C. InputStream in = s.obtainInputStream(); D. InputStream in = s.getStream();
Ans:- B. InputStream in = s.getInputStream();

32. Which of the following protocols is/are for splitting and sending packets to an address across a network?
A. TCP/IP B. FTP C. SMTP D. UDP
Ans:- A. TCP/IP and D. UDP

33. Which of the following type of JDBC driver, is also called Type 1 JDBC driver?
A. JDBC‐ODBC Bridge plus ODBC driver B. Native‐API, partly Java driver C. JDBC‐Net, pure Java driver D. Native‐protocol, pure Java driver
Ans:- A. JDBC-ODBC Bridge plus ODBC driver

34. Select the method used to create URL connection.


a. URL Connection b. open Connection c. URL d. URL Decoder
ans:- b. openConnection

35. Which of the following type of JDBC driver, is also called Type 2 JDBC driver?
A. JDBC‐ODBC Bridge plus ODBC driver B. Native‐API, partly Java driver C. JDBC‐Net, pure Java driver D. Native‐protocol, pure Java driver
Ans:- B. Native-API, partly Java driver

36. Which of the following holds data retrieved from a database after you execute an SQL query using Statement objects?
A. ResultSet B. JDBC driver C. Connection D. Statement
Ans:- A. ResultSet

37. Which of the following is not a valid type of ResultSet?


A. ResultSet.TYPE_FORWARD_ONLY B. ResultSet.TYPE_SCROLL_INSENSITIVE
C. ResultSet.TYPE_SCROLL_SENSITIVE D. ResultSet.TYPE_BACKWARD_ONLY
Ans:- D. ResultSet.TYPE_BACKWARD_ONLY

38. Which of the following type of JDBC driver, uses database native protocol?
A. JDBC‐ODBC Bridge plus ODBC driver B. Native‐API, partly Java driver
C. JDBC‐Net, pure Java driver View all MCQ's at McqMate.com D. Native‐protocol, pure Java driver
Ans:- D. Native-protocol, pure Java driver

39. What is JDBC?


A. JDBC is a java based protocol.
B. JDBC is a standard Java API for database‐independent connectivity between the Java programming language and a wide range of databases.
C. JDBC is a specification to tell how to connect to a database.
D. Joint Driver for Basic Connection
Ans:- B. JDBC is a standard Java API for database‐independent connectivity between the Java programming language and a wide range of
databases

40. URL is an acronym for?


A. Uniform Resource Locator B. Unified Resource Locator C. Uniform Restore Locator D. Unified Restore Locator
Ans:- A. Uniform Resource Locator

41. URL stands for Uniform Resource Locator and represents a resource on the World Wide Web, such as a Web page or FTP directory.
A. True B. False
Ans:- A. True

42 Which class is used to create servers that listen for either local client or remote client programs?
A. ServerSockets B. httpServer C. httpResponse D. None of the above
Ans:- A. ServerSocket

43. Which constructor of DatagramSocket class is used to creates a datagram socket and binds it with the given Port Number?
A. DatagramSocket(int port) B. DatagramSocket(int port, InetAddress address)
C. DatagramSocket() D. None of the above
Ans:- A. DatagramSocket(int port)

44. Which methods are commonly used in ServerSocket class?


A. public OutputStream getOutputStream() B. public Socket accept() C. public synchronized void close() D. None of the above
Ans:- B. public Socket accept()

45. Which classes are used for connection‐less socket programming?


A. DatagramSocket B. DatagramPacket C. Both A & B D.None of the above
Ans:- C. Both A & B

46. Which method of URL class represents a URL and it has complete set of methods to manipulate URL in Java?
A. java.net.URL B. java.net.URLConnection C. Both A & B D. None of the above
Ans:- A. java.net.URL

47. The class is used to create TCP server.


a. Server b. SocketServer c. ServerSocket d. Socket
ans:- c. ServerSocket

48. Which package provides core functionality?


A. java.net B. java.rmi C. java.lang D. java.math
Ans:- C. java.lang

49. The DatagramSocket and DatagramPacket classes are not used for connection‐less socket programming.
A. True B. False
Ans:- B. False

50. Which of the following manages a list of database drivers in JDBC?


A. DriverManager B. JDBC driver C. Connection D. Statement
Ans:- A. DriverManager
51. Which of the following type of JDBC driver should be used if your Java application is accessing multiple types of databases at the same time?
A. Type 1 B. Type 2 C. Type 3 D. Type 4
Ans:- C. Type 3

52. Which of the following is correct about JDBC?


A. JDBC architecture decouples an abstraction from its implementation. B. JDBC follows a bridge design pattern.
C. Both of the above. D. None of the above.
Ans:- C. Both of the above.

53. Which of the following step establishes a connection with a database?


A. Import packages containing the JDBC classes needed for database programming.
B. Register the JDBC driver, so that you can open a communications channel with the database.
C. Open a connection using the DriverManager.getConnection () method.
D. Execute a query using an object of type Statement.
Ans:- C. Open a connection using the DriverManager.getConnection() method.

54. Which of the following is true about JDBC?


A. The JDBC API is an API to access different relational databases.
B. You use it to access relational databases without embedding a dependency on a specific database type in your code.
C. JDBC stands for Java DataBase Connectivity.
D. All of the above.
Ans:- D. All of the above.

55. The client in socket programming must know which informations?


a. IPaddress of Server b. Port number c. Both A & B d. None of the above
ans:- C. Both A & B

56. The URLConnection class can be used to read and write data to the specified resource referred by the URL
a. True b. False
ans:- A. True

57. Datagram is basically an information but there is no guarantee of its content, arrival or arrival time.
a. True b. False
ans:- A. True

58. Which of the following type of JDBC driver, is also called Type 1 JDBC driver?
A. JDBC‐ODBC Bridge plus ODBC driver B. Native‐API, partly Java driver C. JDBC‐Net, pure Java driver D. Native‐protocol, pure Java driver
Ans:- A. JDBC‐ODBC Bridge plus ODBC driver

59. What does the java.net.InetAddress class represent?


a. Socket b. IP Address c. Protocol d. MAC Address
ans:- B. IP Address

60. The flush() method of PrintStream class flushes any uncleared buffers in memory
a. True b. False
ans:- A. True

61. Which method of ServerSocket will wait for a client to initiate communication and then communication with the client?
a. wait( ) b. connect( ) c. waitForClient( ) d. WaitForConnect( )
ans:- B. connect()

62.A server socket can connect to clients.


a. 1 b. 2 c. 10 d. multiple
ans:- D. multiple

63. Resolver in DNS system maps .


a. Domain name to IP address b. IP address to domain name c. Domain name to MAC address d. MAC address to IP address
Ans:- A. Domain name to IP address

64. TCP does not supports Multicasting and Broadcasting because .


a. It supports full duplex communication. b. It provides error control. c. It provides flow control d. It is connection oriented protocol
ans:-D. It is connection-oriented protocol

65. Which is the proper method to retrieve the host name of local machine?
a. static InetAddress getLocalHost( ) throws UnknownHostException
b. static InetAddress getByName(String host_name ) throws UnknownHostException
c. static InetAddress getAllByName(String host_name ) throws UnknownHostException
d. String getHostAddress( )
Ans:- A. static InetAddress getLocalHost() throws UnknownHostException

66. Which constructor of DatagramPacket class are used for receiving purpose?
a. DatagramPacket(byte data[ ], int size) DatagramPacket(byte data[ ], int size, int offset, int port)
b. DatagramPacket(byte data[ ], int size, InetAddress ip, int port) DatagramPacket(byte data[ ], int offset, int size, InetAddress ip, int port)
c. DatagramPacket(byte data[ ], int size) DatagramPacket(byte data[ ], int size, InetAddress ip, int port)
d. All of these
Ans:- C. DatagramPacket(byte data[], int size) DatagramPacket(byte data[], int size, InetAddress ip, int port

You might also like