Skip to main content

Upwork JDBC 2.1 Test Answers

JBDC (Java Database Connectivity)
1. Under which category does the following driver fall:

 WebLogic's Tengah "all Java Type-3 driver"
 Answers: • Net-Protocol All-Java Driver

 2. Which JDBC driver is considered best in terms of performance and efficiency?
 Answers: • Type-1 Driver

 3. Please select all the correct options. JDBC Driver Manager is:
 Answers: • Able to activate registered drivers

 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?
 Answers: • ps.clearParameters(); ps.setInt(1,3); ps.setDouble(2,790.50); ps.executeUpdate();

 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?
 Answers: • con.setAutoCommit(false);

 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?
 Answers: • jdbc:webx:webdsn

 7. You have to handle an erroneous situation in a transaction. Which method comes handy in this case?
 Answers: • con.rollback();

 8. How will you create a new instance of a JDBC driver explicitly?
 Answers: • Class.forName("driver").newInstance();

 9. JDBC is based on:
 Answers: • X/Open CLI (Call Level Interface)

 10. You are developing a shopping cart for your client. Where would you like to put your business logic?
 Answers: • In middleware servlets

 11. You want to execute the following query string, using the connection named "con":

 String query = "SELECT * FROM CUSTOMER";

 What should the syntax be?
 Answers: • Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery(query);

 12. Which exception will be thrown in your code, if the specified driver could not be loaded?
 Answers: • ClassNotFoundException

 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:
 Answers: • Transaction

 14. Which of the following JDBC methods is used for retrieving large text strings?
 Answers: • getAsciiStream

 15. Open Database Connectivity is:
 Answers: • Platform independent

 16. Which of the following methods eliminates the need to call wasNull() method to handle null database fields?
 Answers: • getObject();

 17. Transactions have a property called atomicity, which means:
 Answers: • Everything takes place once

 18. What should the syntax be to establish a connection with a Database?
 Answers: • Connection con = DriverManager.getConnection(url,"myLogin", "myPassword");

 19. ResultSet objects follow index patterns of:
 Answers: • Array 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?
 Answers: • execute()

 21. You want to execute a CallableStatement named 'cs'. It is expected to return multiples results. Which of the following methods will you choose?
 Answers: • ResultSet rs=cs.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?
 Answers: • Reuse the database connection and use PreparedStatement objects with synchronized blocks

 23. Which of the following methods will you use to execute INSERT, UPDATE and DELETE SQL statements?
 Answers: • executeUpdate();

 24. How do you register a JDBC driver?
 Answers: • Class.forName("driver");

 25. Which of the following JDBC methods is used for retrieving large binary objects?
 Answers: • getBinaryStream

 26. Name the interface you will use to retrieve the underlying structure of the query result:
 Answers: • ResultSetMetaData

 27. Which type of statement object will you use to execute a stored procedure?
 Answers: • CallableStatement

 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:
 Answers: • getWarnings()

 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?
 Answers: • while(

 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?
 Answers: • 24

 31. The code segment below defines a query:


 Which of the following code snippets will create a scrollable ResultSet?
 Answers: • Statement st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY); ResultSet srs=st.executeQuery(qry);

 32. Which of the following is the syntax for creating a CallableStatement?
 Answers: • CallableStatement cs=con.prepareCall("{call SHOW_ORDER}")

 33. Which of the following is not true?
 Answers: • CallableStatement cannot take INOUT parameters

 34. Which of the following is not true for a ResultSet?
 Answers: • Methods next() and previous() return -1 beyond the ResultSet

 35. Java Database Connectivity (JDBC) is a:
 Answers: • Database-independent API

 36. Servlet developers should avoid using JDBC-ODBC bridge driver because:
 Answers: • The driver is of Type-1

 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?
 Answers: • srs.getRow()

 38. A user leaves an online shopping cart without checking out. Which of following interfaces will notify to Rollback the transaction?
 Answers: • HttpSessionBindingListener

 39. After executing the following code, resultvar contains false. What should the next step be?

 boolean resultvar=stmt.execute(sql);
 Answers: • stmt.getUpdateCount();

 40. SQLException has a method, which provides the feature of chaining or encapsulation of additional Exception objects. Identify the method from the following:
 Answers: • getNextException()

 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?
 Answers: • By session tracking and using HttpSession to hold a connection for each user

 42. SQLWarning object deals with database access warnings. It is a subclass of:
 Answers: • SQLException

 43. Will the below script execute properly?

 Answers: • Yes. The table will be created successfully.

 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?
 Answers: • SQLException


Popular posts from this blog

Upwork Knowledge of Microsoft Office Skills Test Answer

In Microsoft Word 2010, "Keep lines together" paragraph formatting:
Answers: • does not work for paragraphs within a table if "Allow row to break across pages" is also selected.

You want to add an image as the first character in your paragraph. Which type of text wrapping treats your graphic as if it were a character?
Answers: • In Line with Text

In the given screenshot, the contents of the 'Name of User' column have been oriented at an angle. How is this done?
Answers: • By using the 'Orientation' button in the alignment group of the 'Home' tab.

In the given screenshot, the letter X is pointing to an area between the first Row header, and the first Column header. What will happen when this particular area is selected?
Answers: • It will select the whole sheet, having the same effect as that of Ctrl+A.

Which of the following types of worksheets will not load in Microsoft Excel Services?
Answers: • Worksheets with ActiveX controls

Why would you use con…

Upwork/oDesk Google AdWords Test Answers (part1)

1. Which of the following is not a valid geographical targeting option?
Answers: • Targeting female english speakers

 2. In the My Client Center, what does MDS stand for?
Answers: • Manager Defined Spend

 3. If you have an exact match keyword being bid below the estimated first page minimum bid, can it show adverts on the first page?
Answers: • Yes. It could even be below the estimated first page bid, and still show in position 1 at the top of the page.

 4. Can you use the same keywords in different ad groups?
Answers: • Yes, always

 5. How is the ad ranking calculated?
Answers: • Bid x Quality Score = Ad Ranking

 6. What happens when your cost reaches your budget amount?
Answers: • Your ads will stop showing for that day

 7. AdWords will automatically ______ your keywords.
Answers: • bolden

 8. Each campaign has a _________ budget.
Answers: • daily

 9. How do you

Upwork/oDesk SMM(Social Media Marketing) Test

New Test Answers for Upwork's Social Media Marketing Test - Updated on January 2016:

1. What is the character limit for posts on Twitter?
Answers: • 140 characters

 2. How can a company place itself as an expert in a certain area of expertise?
Answers: • Actively answer questions in the Q&A section of the site

 3. What type of status updates would drive visitors to the company site?
Answers: • A link to a new press release hosted on the company site

 4. What is meant by A/B testing in marketing?
Answers: • Testing 2 versions of an advertisement to see which elicits the best response

 5. Using which of the following two methods can a company ensure that the proper audience finds their YouTube videos?
Answers: • Post links on the company blog to the YouTube videos

 6. How does a blog directly impact sales of a company?
Answers: • It is typically used as the way to disperse company coupons

 7. What is meant by "micro-blogging"?
Answers: • Blogs with limited individual posts, limited …