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

Advanced Java Set 1

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)
21 views

Advanced Java Set 1

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

Advanced JAVA MCQs [set-1]

Chapter: JAVA Networking

1. Which of these package contains classes and interfaces for networking?


A. java.io
B. java.util
C. java.net
D. javax.swing
Answer: C

2. In the following URL, identify the protocol identifier?


https://mcqmate.com:8080/course.php
o m
A. http
. c
B. gtu.ac.in
te
C. //mcqmate.com:80/course.php
a
D. 8080
Answer: A q M
c
M follows connection less service?
3. Which of the following protocol
A. TCP
B. TCP/IP
C. UDP
D. HTTP
Answer: C

4. Which of the following statement is NOT true?


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

5. 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.
Answer: D

6. 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()
Answer: B

7. 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);
Answer: B

8. 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);
Answer: A

9. 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(),

View all MCQ's at McqMate.com


D. "127.0.0.0"
Answer: D

10. 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
Answer: C

11. 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();
Answer: B

12. 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
Answer: A

13. Which of these is a protocol for breaking and sending packets to an address
across a network?
A. TCP/IP
B. DNS
C. Socket
D. Proxy Server
Answer: A

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


A. DatagramPacket
B. URL

View all MCQ's at McqMate.com


C. InetAddress
D. ContentHandler
Answer: C

15. 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
Answer: B

16. 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
Answer: A

17. 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
Answer: A

18. 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
Answer: D

19. 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
Answer: D

20. 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
Answer: B

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


A. DriverManager
B. JDBC driver
C. Connection
D. Statement
Answer: A

22. 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
Answer: C

23. 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.
Answer: C

24. 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.

View all MCQ's at McqMate.com


D. Execute a query using an object of type Statement.
Answer: C

25. 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.
Answer: D

View all MCQ's at McqMate.com

You might also like