Anda di halaman 1dari 3

Suppose that you would like to create an instance of a new Map that has an itera tion order that

is the same as the iteration order of an existing instance of a Map. Which concrete implementation of the Map interface should be used for the n ew instance? A. TreeMap B. HashMap C. LinkedHashMap D. Hashtable ANSWER: C

You need to store elements in a collection that guarantees that no duplicates ar e stored and all elements can be accessed in natural order. Which interface prov ides that capability? A. java.util.Map B. java.util.Set C. java.util.List D. java.util.Collection ANSWER: B

What is the difference between throw and throws? A. The throws key word is used to explicitly throw an exception, while throw utilized to handle checked exceptions B. The throw key word is used to implicitly throw an exception, while throws utilized to handle checked exceptions C. The throws key word is used to implicitly throw an exception, while throw utilized to handle checked exceptions D. The throw key word is used to explicitly throw an exception, while throws utilized to handle checked exceptions ANSWER: D is is is is

If the following piece of code is put into the main method. what will be the out put? int a=0; while(a<10) { if(a>5) break; sop(a++); } A) 0 1 2 3 B) 0 1 2 3 C) 1 2 3 4 D) none of ANSWER: A 4 5 4 5 these

What will be the output of the program? class Test { public static void main(String [] args) { int x=20;

String sup = (x < 15) ? "small" : (x < 22)? "tiny" : "huge"; System.out.println(sup); } } A. B. C. D. ANSWER: small tiny huge Compilation fails B

What will be the output of the program? class Bitwise { public static void main(String [] args) { int x = 11 & 9; int y = x ^ 3; System.out.println( y 12 ); } } A. B. C. D. ANSWER: 0 7 8 14 D

To execute a stored procedure totalStock in a database server, which of the follow ing code snippet is used? A. Statement stmt = connection.createStatement();stmt.execute("totalStock()"); B. CallableStatement clbstmnt = con.prepareCall("{call totalStock}");cs.executeQ uery(); C. StoreProcedureStatement spstmt = connection.createStoreProcedure("totalStock( )");spstmt.executeQuery(); D. PrepareStatement pstmt = connection.prepareStatement("totalStock()");pstmt.ex ecute(); ANSWER: B Ram is working in a software company as a java developer. He is working on a thr ee tier application, he has to store and select and data from database from the table called as products. when he inserts the records in the table it takes long time to insert. which of the following will you suggest to Ram so as to insert records faster? A. use normal statement and use type-1 driver. B. use type-4 driver C. use PreparedStatement instead of normal statement D. both b and c ANSWER: D Bob is a database administrator he wants to give developers easy way to insert m ultiple records in a employee table so as to minimize the response time. which o f the following will you suggest to Bob? A. create a table employee with less columns B. create table without primary key C. create a prepared statement to insert the records

D. keep proper isolation levels on the table employee ANSWER: C Priya is a java developer in software company. She need to connect to the Mysql database server whose ip address is 178.45.23.212 which uses 5689 port number. T he database name to which she wants to connect is PRODUCTION, username and passw ord of database server is root and password respectively? What is the correct UR L string she needs to write so as to connect to MySql server? A. "jdbc:odbc://178.45.23.212/PRODUCTION" B. "jdbc.odbc...178.45.23.212:5689:PRODUCTION","root","password" C. "jdbc:mysql://178.45.23.212:5689/PRODUCTION","root","password" D. "jdbc:mysql://178:45:23:212.5689/PRODUCTION","root","password" ANSWER: C Tom works as senior developer, one of his junior working on a java project and h e is using type-4 driver to connect to the mysql database. As and when he compil es the java code he finds no error, but when he try to execute the class he get 'NoSuchClassFoundException:com.mysql.jdbc.Driver'. so he calls Tom to check. Wha t might be the problem do you think tom should resolve? A. Problem is path so change the path from older version of java to newer. B. Problem is with the database IP address and port number. C. problem is with the classpath to set the correct path. D. problem is with the DSN to which he is trying to connect. ANSWER: C

Anda mungkin juga menyukai