Upwork JDBC 2.1 TEST 2016

Hello Freelancer, Welcome to allupworktestanswers.com Here to get the JDBC 2.1 TEST of Latest version 2016. We are ready here to provide your desire upwork test answer. We already tested all exam test information Available include on here. So Dear, Why Late? Read the below full exam test and get more information from our website.

1. Under which category does the following driver fall:
WebLogic’s Tengah “all Java Type-3 driver”
  1. JDBC-ODBC Bridge Driver
  2. Native-API Partly-Java Driver
  3. Net-Protocol All-Java Driver
  4. Native-Protocol All-Java Driver
  5. Native-Protocol Part-Java Driver
2. Which JDBC driver is considered best in terms of performance and efficiency?
  1. Type-1 Driver
  2. Type-2 Driver
  3. Type-3 Driver
  4. Type-4 Driver
3. Please select all the correct options. JDBC Driver Manager is:
  1. Able to activate registered drivers
  2. Able to activate unregistered drivers
  3. Not required for activation of drivers with DataSource
  4. Required for activation of drivers with DataSource
4. Consider the following statement:
PreparedStatement ps=con.prepareStatement(“INSERT INTO ORDER (CUSTOMER_ID ,PRICE) VALUES(?,?)”);
Which of the following should come after this statement?
  1. ps.clearParameters(); ps.setInt(1,3); ps.setDouble(2,790.50); ps.executeUpdate(sql);
  2. ps.clearParameters(); ps.setInt(1,3); ps.setDouble(2,790.50); ps.executeUpdate();
  3. ps.clear(); ps.setInt(1,3); ps.setDouble(2,790.50); ps.executeUpdate(sql);
  4. ps.clearParameters(); ps.setInt(1,3.09); ps.setDouble(2,790.50); ps.execute(sql);
  5. ps.clearParameters(); ps.setDouble(2,790.50); ps.execute(sql);
5. You want to start a transaction for bank account processing. Which of the following methods will you execute on the Connection object to begin it?
  1. con.setAutoCommit(false);
  2. con.setCommit(false);
  3. con.setAutoCommit();
  4. con.setAutoCommit(true);
  5. con.autoCommit();
6. You need to use a third party driver for establishing a connection with the database. The subprotocol is “webx” and the DSN is “webdsn”. What is the syntax of the URL?
  1. jdbc:odbc:webx:webdsn
  2. odbc:jdbc:webx:webdsn
  3. jdbc:webx:webdsn
  4. thin:jdbc:odbc:dsn:webdsn
  5. thick:jdbc:odbc:dsn:webdsn
  6. None of the above
7. You have to handle an erroneous situation in a transaction. Which method comes handy in this case?
  1. con.commit(false);
  2. con.commit();
  3. con.rollback();
  4. con.revertback();
  5. con.rollback(true);
8. How will you create a new instance of a JDBC driver explicitly?
  1. Class.forName(“driver”);
  2. Class.newInstance(“driver”);
  3. Class.driver(“driver”);
  4. Class.getDriver(“driver”);
  5. Class.forName(“driver”).newInstance();
9. JDBC is based on:
  1. X/Open CLI (Call Level Interface)
  2. JDBC/Open CLI
  3. Java/Open CLI
  5. X/Close CLI
10. You are developing a shopping cart for your client. Where would you like to put your business logic?
  1. Inside the database
  2. Inside the client application
  3. In middleware servlets
  4. In COM / DCOM components
  5. Inside the code for the cart
11. You want to execute the following query string, using the connection named “con”:
String query = “SELECT * FROM CUSTOMER”;
What should the syntax be?
  1. Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query);
  2. Statement stmt=new Statement(); ResultSet rs=stmt.executeQuery(query);
  3. Statement stmt=con.createStatement(); ResultSet rs=stmt.execute(query);
  4. Statement stmt=con.getStatement(); ResultSet rs=stmt.executeQuery(query);
  5. Statement stmt=con.getStatement(); ResultSet rs=con.executeQuery(query);
12. Which exception will be thrown in your code, if the specified driver could not be loaded?
  1. ActivationException
  2. ClassNotFoundException
  3. ClassNotAvailableException
  4. ClassUnavailableException
  5. InstantiationException
13. A process allows you to group multiple SQL statements. Commit or Rollback can be performed on the group together. This process is known as:
  1. Binding
  2. Synchronization
  3. Registry
  4. Transaction
  5. Late binding
14. Which of the following JDBC methods is used for retrieving large text strings?
  1. getBinaryStream
  2. getText
  3. getAsciiStream
  4. getString
  5. getObjectStream
15. Open Database Connectivity is:
  1. Platform independent
  2. Platform dependent
  3. Architecture neutral
  4. Network independent
  5. Machine independent
16. Which of the following methods eliminates the need to call wasNull() method to handle null database fields?
  1. getObject();
  2. getInt();
  3. getString();
  4. getFloat();
  5. getNull();
17. Transactions have a property called atomicity, which means:
  1. Everything takes place one by one
  2. Everything takes place once
  3. Everything takes place randomly
  4. Everything takes place twice
  5. Everything takes place thrice
18. What should the syntax be to establish a connection with a Database?
  1. Connection con = DriverManager.getConnection(url,”myLogin”, “myPassword”);
  2. Connection con = DriverManager.getConnection(“myLogin”, “myPassword”,url);
  3. Connection con = DriverManager.getConnection(“myLogin”, “myPassword”);
  4. Connection con = DriverManager.setConnection(url,”myLogin”, “myPassword”);
  5. Connection con = DriverManager.createConnection(url,”myLogin”, “myPassword”);
19. ResultSet objects follow index patterns of:
  1. Array standard
  2. Java standard
  3. RDBMS standard
  4. C++ standard
  5. PL/SQL standard
20. When you are handling user-submitted SQL, you may retrieve a ResultSet or a count. Which of the following methods is handy in this situation?
  1. executeQuery()
  2. exceuteUpdate()
  3. execute()
  4. executeQueryUpdate()
  5. update()
21. You want to execute a CallableStatement named ‘cs’. It is expected to return multiples results. Which of the following methods will you choose?
  1. ResultSet rs=cs.execute()
  2. ResultSet rs=cs.executeQuery()
  3. ResultSet rs=cs.executeUpdate()
  4. ResultSet rs=cs.executeQuery(sql)
  5. ResultSet rs=execute()
22. Your project leader has asked you to improve the performance of JDBC connectivity by reusing objects in your Servlet’s code. Which of the following is an appropriate solution?
  1. Reuse the database connection and reuse PreparedStatement objects
  2. Reuse the database connection and use PreparedStatement objects with synchronized blocks
  3. Reuse the database connection only
  4. Reuse the PreparedStatement objects only
  5. Reuse the GetPreparedStatement objects only
23. Which of the following methods will you use to execute INSERT, UPDATE and DELETE SQL statements?
  1. executeQuery();
  2. executeUpdate();
  3. executeQueryUpdate();
  4. update();
  5. query();
24. How do you register a JDBC driver?
  1. Class.forName(“driver”);
  2. Class.newInstance(“driver”);
  3. Class.driver(“driver”);
  4. Class.getDriver(“driver”);
  5. Class.postDriver(“driver”);
25. Which of the following JDBC methods is used for retrieving large binary objects?
  1. getBinaryStream
  2. getText
  3. getAsciiStream
  4. getString
  5. getObjectStream
26. Name the interface you will use to retrieve the underlying structure of the query result:
  1. ResultSet
  2. ResultSetMetaData
  3. ResultStructure
  4. Result
  5. ResultMetaData
27. Which type of statement object will you use to execute a stored procedure?
  1. Statement
  2. PreparedStatement
  3. CallableStatement
  4. StoredStatement
  5. Stat
28. A warning can be thrown by a Connection object, a Statement object or a ResultSet object. Which method is used to retrieve the warning:
  1. getWarnings()
  2. getWarned()
  3. getWarning()
  4. getError()
  5. getErrorsWarning()
29. You have obtained a ResultSet object named ‘rs’ after executing the following query:
Which loop can you use to return all the records in the ResultSet?
  1. while(rs.next())
  2. while(rs.hasNext())
  3. while(true)
  4. while(rs.nextElement())
30. You executed a query to retrieve 40 products from the database and obtained a scrollable ResultSet named ‘scrollrs’. You started scrolling the ResultSet as follows:
At which row number is the cursor currently located?
  1. 16
  2. 24
  3. 26
  4. 17
  5. 6
31. The code segment below defines a query:
Which of the following code snippets will create a scrollable ResultSet?
  1. Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet srs=st.executeQuery(qry);
  2. Statement st=con.createStatement(qry,ResultSet.CONCUR_READ_ONLY,ResultSet.TYPE_SCROLL_SENSITIVE); ResultSet srs=st.executeQuery();
  3. Statement st=con.createStatement(qry,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet srs=st.executeQuery();
  4. Statement st=con.createStatement(ResultSet.CONCUR_READ_ONLY,ResultSet.TYPE_SCROLL_SENSITIVE); ResultSet srs=st.executeQuery(qry);
32. Which of the following is the syntax for creating a CallableStatement?
  1. CallableStatement cs=con.prepareCall(“{call SHOW_ORDER}”)
  2. CallableStatement cs=con.prepareCall(‘{call SHOW_ORDER}’)
  3. CallableStatement cs=con.prepareCall(“(call SHOW_ORDER)”)
  4. CallableStatement cs=con.prepareCall(“call SHOW_ORDER”)
  5. CallableStatement cs=prepareCall(“call SHOW_ORDER”)
33. Which of the following is not true?
  1. CallableStatement is a subclass of PreparedStatement
  2. CallableStatement can take PreparedStatement as an input parameter
  3. CallableStatement can use executeUpdate() method
  4. CallableStatement can use execute() method
  5. CallableStatement cannot take INOUT parameters
34. Which of the following is not true for a ResultSet?
  1. JDBC 2.0 API supports Scrollable ResultSets
  2. ResultSet cursors are moved forward using next() method
  3. ResultSet cursors are moved backwards using previous() method
  4. Methods next() and previous() return -1 beyond the ResultSet
35. Java Database Connectivity (JDBC) is a:
  1. Database-dependent API
  2. Database-independent API
  3. Machine-dependent API
  4. Network-dependent database API
36. Servlet developers should avoid using JDBC-ODBC bridge driver because:
  1. Drivers are bundled with JDK
  2. The driver’s native code can crash the entire server
  3. The driver is not secure
  4. The driver is of Type-1
  5. The driver is of Type-2
37. You have obtained a scrollable ResultSet named ‘srs’ by executing a query. Which of the following methods will you use to verify the position of the cursor?
  1. srs.relative(-4)
  2. srs.relative()
  3. srs.absolute(-4)
  4. srs.getRow()
  5. srs.postRow()
38. A user leaves an online shopping cart without checking out. Which of following interfaces will notify to Rollback the transaction?
  1. HttpSession
  2. HttpSessionBindingListener
  3. HttpServlet
  4. SingleThreadModel
  5. FtpSession
39. After executing the following code, resultvar contains false. What should the next step be?
boolean resultvar=stmt.execute(sql);
  1. stmt.getResultSet();
  2. stmt.getUpdateCount();
  3. stmt.executeUpdate();
  4. stmt.executeQuery();
  5. stmt.executeUpdateQuery();
40. SQLException has a method, which provides the feature of chaining or encapsulation of additional Exception objects. Identify the method from the following:
  1. getEncapsulatedException()
  2. getEncapException()
  3. getMessage()
  4. getNextException()
  5. getException()
41. Your project leader has given you a new task. You have to work on a module in which the transaction has to be extended across multiple page requests and multiple servlets. How will you implement this?
  1. By synchronizing the doPost() method
  2. By creating a new connection for each transaction
  3. By session tracking and using HttpSession to hold a connection for each user
  4. By creating a single connection in the init() method and implementing SingleThreadModel
  5. By synchronizing doGet ()
42. SQLWarning object deals with database access warnings. It is a subclass of:
  1. SQLWarn
  2. SQLException
  3. SQLError
  4. SQLWarning
  5. SQLErrorsWarning
43. Will the below script execute properly?
  1. Yes. The table will be created successfully.
  2. No. Line 3 should be modified to: VARCHAR(32) CUS_NAME,INTEGER SUP_ID ,FLOAT PRICE , INTEGER SALES
  3. No. Line 3 should be modified to: ‘CUS_NAME VARCHAR(32)’,’SUP_ID INTEGER’,’ PRICE FLOAT’, ‘SALES INTEGER’
  4. No. Line 3 should be modified to: ‘CUS_NAME’ VARCHAR(32),’SUP_ID’ INTEGER,’PRICE’ FLOAT, ‘SALES’ INTEGER
44. You are trying to connect to a database through JDBC. There is a problem with one of the methods immediately after the driver has been loaded. Which exception will be thrown?
  1. ClassNotFoundException
  2. SQLException
  3. SQLNotFoundException
  4. ActivationException
  5. JDBCException
Finally no more words require about the JDBC 2.1 TEST  information in this session of this content. If you are require knowing more, Please ask to us via our contact us form or comment box. Please make sure that, you don’t send Personal information via the Comment box.  Thank you very mutch for being with us