McqMate
These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Master of Science in Information Technology (MSc IT) , Master of Science in Computer Science (MSc CS) , Bachelor of Business Administration in Computer Applications (BBA [CA]) , Programming Languages , Master of Science in Software Engineering (MSc SE) .
Chapters
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. java.net |
2. |
In the following URL, identify the protocol identifier? https://mcqmate.com:8080/course.php |
A. | http |
B. | gtu.ac.in |
C. | //mcqmate.com:80/course.php |
D. | 8080 |
Answer» A. http |
3. |
Which of the following protocol follows connection less service? |
A. | TCP |
B. | TCP/IP |
C. | UDP |
D. | HTTP |
Answer» C. UDP |
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. In HTTP, all communication between two computers are encrypted |
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. With datagram sockets there is no need to establish any connection and data flows between the processes are as packets. |
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. getCodeBase().getHost() |
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. Socket s = serverSocket.accept() |
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. Socket s = new Socket(ServerName, port); |
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(), |
D. | "127.0.0.0" |
Answer» D. "127.0.0.0" |
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. The InetAddress class |
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. InputStream in = s.getInputStream(); |
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. TCP/IP |
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. TCP/IP |
14. |
Which of these class is used to encapsulate IP address and DNS? |
A. | DatagramPacket |
B. | URL |
C. | InetAddress |
D. | ContentHandler |
Answer» C. InetAddress |
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. Native-API, partly Java driver |
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. JDBC-ODBC Bridge plus ODBC driver |
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. ResultSet |
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. ResultSet.TYPE_BACKWARD_ONLY |
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 |
D. | Native-protocol, pure Java driver |
Answer» D. Native-protocol, pure Java driver |
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. JDBC is a standard Java API for database-independent connectivity between the Java programming language and a wide range of databases. |
21. |
Which of the following manages a list of database drivers in JDBC? |
A. | DriverManager |
B. | JDBC driver |
C. | Connection |
D. | Statement |
Answer» A. DriverManager |
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. Type 3 |
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. Both of the above. |
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. |
D. | Execute a query using an object of type Statement. |
Answer» C. Open a connection using the DriverManager.getConnection () method. |
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. All of the above. |
26. |
How many Result sets available with the JDBC 2.0 core API? |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» B. 3 |
27. |
Which method is used to establish the connection with the specified url in a Driver Manager class? |
A. | public static void registerDriver(Driver driver) |
B. | public static void deregisterDriver(Driver driver) |
C. | public static Connection getConnection(String url) |
D. | public static Connection getConnection(String url,String userName,String password) |
Answer» C. public static Connection getConnection(String url) |
28. |
Which driver Network connection is indirect that a JDBC client makes to a middleware process that acts as a bridge to the DBMS server? |
A. | JDBC-Net |
B. | JDBC-ODBC bridge |
C. | Native API as basis |
D. | Native protocol as basis |
Answer» A. JDBC-Net |
29. |
JDBC RowSet is the wrapper of ResultSet,It holds tabular data like ResultSet but it is easy and flexible to use. |
A. | True |
B. | False |
C. | none |
D. | all |
Answer» A. True |
30. |
The ResultSet.next method is used to move to the next row of the ResultSet, making it the current row. |
A. | True |
B. | False |
C. | none |
D. | all |
Answer» A. True |
31. |
Which JDBC product components does the Java software provide? |
A. | The JDBC driver manager |
B. | The JDBC driver test suite |
C. | The JDBC-ODBC bridge |
D. | All mentioned above |
Answer» D. All mentioned above |
32. |
Which class has traditionally been the backbone of the JDBC architecture? |
A. | the JDBC driver manager |
B. | the JDBC driver test suite |
C. | the JDBC-ODBC bridge |
D. | All mentioned above |
Answer» A. the JDBC driver manager |
33. |
Which was the first most widely used programming interface for accessing relational databases and it offers the ability to connect all the databases on all the platforms.? |
A. | JDBC API |
B. | ODBC API |
C. | Both A & B |
D. | None of the above |
Answer» B. ODBC API |
34. |
JDBC is a Java API that is used to connect and execute query to the database |
A. | True |
B. | False |
C. | none |
D. | all |
Answer» A. True |
35. |
In the following JDBC drivers which is known as fully java driver? |
A. | Native-API driver |
B. | Network Protocol driver |
C. | Thin driver |
D. | Both B & C |
Answer» D. Both B & C |
36. |
Which JDBC drivers will run your program? |
A. | The JDBC-ODBC bridge |
B. | The JDBC driver manager |
C. | The JDBC driver test suite |
D. | None of the above |
Answer» C. The JDBC driver test suite |
37. |
What is the reason that a java program cannot directly communicate with an ODBC driver? |
A. | ODBC written in C# language |
B. | ODBC written in C language |
C. | ODBC written in C++ language |
D. | None of the above |
Answer» B. ODBC written in C language |
38. |
A leading database connectivity vendor, worked together to produce the ____. |
A. | JDBC-ODBC Bridge |
B. | JDBC Driver Test Suite |
C. | Both A & B |
D. | None of the above |
Answer» C. Both A & B |
39. |
Which driver converts JDBC calls directly into the vendor-specific database protocol? |
A. | Native - API driver |
B. | Network Protocol driver |
C. | Thin driver |
D. | Both B & C |
Answer» C. Thin driver |
40. |
Which models do the JDBC API support for the database access? |
A. | Two-tier models |
B. | Three-tier models |
C. | Both A & B |
D. | None of the above |
Answer» C. Both A & B |
41. |
Which of the following JDBC drivers is known as a partially java driver? |
A. | JDBC-ODBC bridge driver |
B. | Native-API driver |
C. | Network Protocol driver |
D. | Thin driver |
Answer» B. Native-API driver |
42. |
The JDBC API is what allows access to a data source from a Java middle tier |
A. | True |
B. | False |
C. | none |
D. | all |
Answer» A. True |
43. |
Which driver uses ODBC driver to connect to the database? |
A. | JDBC-ODBC bridge driver |
B. | Native - API driver |
C. | Network Protocol driver |
D. | Thin driver |
Answer» A. JDBC-ODBC bridge driver |
44. |
How many JDBC product components does the Java software provides? |
A. | 3 |
B. | 2 |
C. | 4 |
D. | 5 |
Answer» A. 3 |
45. |
How many types of JDBC drivers are available? |
A. | 3 |
B. | 4 |
C. | 2 |
D. | 5 |
Answer» B. 4 |
46. |
Which method is used for an SQL statement that is executed frequently? |
A. | prepareStatement |
B. | prepareCall |
C. | createStatement |
D. | None of the above |
Answer» A. prepareStatement |
47. |
How is the dynamic interception of requests and responses to transform the information done? |
A. | servlet container |
B. | servlet config |
C. | servlet context |
D. | servlet filter |
Answer» D. servlet filter |
48. |
Which type of ServletEngine is a server that includes built-in support for servlets? |
A. | Add-on ServletEngin |
B. | Embedded ServletEngine |
C. | Standalone ServletEngine |
D. | None of the above |
Answer» C. Standalone ServletEngine |
49. |
What type of servlets use these methods doGet(), doPost(),doHead, doDelete(), doTrace()? |
A. | Genereic Servlets |
B. | HttpServlets |
C. | All of the above |
D. | None of the above |
Answer» B. HttpServlets |
50. |
Which cookie it is valid for single session only and it is removed each time when the user closes the browser? |
A. | Persistent cookie |
B. | Non-persistent cookie |
C. | All the above |
D. | None of the above |
Answer» B. Non-persistent cookie |
Done Studing? Take A Test.
Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.