Report Practice2 PRA MCQ Java
Report Practice2 PRA MCQ Java
com
EmployeeID: 2589920
Skills Score:
Java 9/10
Java_Web 6/10
Recruiter/Team Comments:
No Comments.
1/15
Q14 Java_JDBC_4 Multiple Choice 57 sec 1/ 1
Q15 Java_JDBC_5 Multiple Choice 14 sec 1/ 1
Q16 Java_JDBC_6 Multiple Choice 11 sec 1/ 1
Q17 Java_JDBC_7 Multiple Choice 29 sec 1/ 1
Q18 Java_JDBC_8 Multiple Choice 2 min 12 sec 1/ 1
Q19 Java_JDBC_9 Multiple Choice 2 min 20 sec 1/ 1
Q20 Java_JDBC_10 Multiple Choice 47 sec 1/ 1
Q21 Java_Web_1 Multiple Choice 51 sec 0/ 1
Q22 Java_Web_2 Multiple Choice 48 sec 1/ 1
Q23 Java_Web_3 Multiple Choice 1 min 55 sec 0/ 1
Q24 Java_Web_4 Multiple Choice 6 sec 0/ 1
Q25 Java_Web_5 Multiple Choice 1 min 8 sec 1/ 1
Q26 Java_Web_6 Multiple Choice 7 sec 1/ 1
Q27 Java_Web_7 Multiple Choice 32 sec 1/ 1
Q28 Java_Web_8 Multiple Choice 1 min 22 sec 1/ 1
Q29 Java_Web_9 Multiple Choice 3 min 22 sec 1/ 1
Q30 Java_Web_10 Multiple Choice 2 min 4 sec 0/ 1
Correct Answer
QUESTION DESCRIPTION
class DemoClass
{
static void test() throws RuntimeException
{
throw new ArithmeticException();
}
public static void main (String args[])
{
try{
test();
}
catch (RuntimeException re)
{
System.out.println("Exception Handled");
}
}
}
2/15
CANDIDATE ANSWER
RuntimeException
CompilationError
ExceptionHandled
No Comments
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
getMessage()
printStackTrace()
toString()
getDescription()
No Comments
Correct Answer
QUESTION DESCRIPTION
Score 1
Jane is trying to run the following code on method overloading , she is
confused while executing the code that the statement 1 she has
written calls which method . Help jane to understand the concept by
choosing correct option
class MethodOverloading{
void display(int a,float b) { // Method
1
System.out.println(a+b);
}
void display(int a,int b) { //
Method 2
System.out.println(a+b);
}
void display(int a,long b) { // Method 3
System.out.println(a+b);
}
void display(int a,double b) {
System.out.println(a+b); // Method 4
}
}
public class DemoClass{
public static void main(String[] args) {
MethodOverloading mo=new MethodOverloading();
3/15
mo.display(10, 10.5); //
Statement 1
}
}
CANDIDATE ANSWER
Method 1
Method 2
Method 3
Method 4
No Comments
QUESTION 4 Adv_Java_4
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
Lion roars
Dog Barks
Dog Barks
Lion roars
4/15
Lion roars
Dog Barks
Animal makes a sound
No Comments
QUESTION 5 Adv_Java_5
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
Score 1
what will be the output of following code after execution ?
class DemoClass{
public static void main(String[] args) {
Stack<Integer> stk= new Stack<>();
stk.push(1000);
stk.pop();
stk.push(2000);
stk.push(3000);
stk.pop();
stk.push(4000);
System.out.println(stk.size());
}
}
CANDIDATE ANSWER
No Comments
QUESTION 6 Adv_Java_6
Multiple Choice Java
Wrong Answer
QUESTION DESCRIPTION
Score 0
Sameer is trying to execute following code . what will be the output after
execution ?
public class DemoClass{
public static void main(String[] args) {
ArrayList list=new ArrayList();
list.add("Chennai");
list.add("Mumbai");
list.add("Kolkata");
list.add("Bangalore");
int a=(int)list.get(0);
System.out.println(list);
}
}
5/15
CANDIDATE ANSWER
ArrayIndexOutOfBoundException
ClassCastException
InputMismatchException
No Comments
QUESTION 7 Adv_Java_7
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
Score 1
what will be the output of following code after execution ?
class DemoClass{
public static void main(String[] args) {
Stack<Integer> stk= new Stack<>();
stk.push(1000);
stk.pop();
stk.push(2000);
stk.push(3000);
stk.pop();
stk.push(4000);
System.out.println(stk.size());
}
}
CANDIDATE ANSWER
No Comments
QUESTION 8 Adv_Java_8
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
Score 1
Sameer is trying to execute following code . what will be the output after
execution ?
public class DemoClass{
public static void main(String[] args) {
ArrayList list=new ArrayList();
list.add("Chennai");
list.add("Mumbai");
list.add("Kolkata");
list.add("Bangalore");
int a=(int)list.get(0);
6/15
System.out.println(list);
}
}
CANDIDATE ANSWER
ArrayIndexOutOfBoundException
ClassCastException
InputMismatchException
No Comments
QUESTION 9 Adv_Java_9
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
Score 1
what will be the output of following code after execution ?
public class LinkedListCollection {
public static void main(String args[]) {
}
}
CANDIDATE ANSWER
No Comments
QUESTION 10 Adv_Java_10
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
7/15
CANDIDATE ANSWER
NullPointerException
FileNotFoundException
ClassNotFoundException
IOException
No Comments
QUESTION 11 Java_JDBC_1
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
Score 1
Which method is used to retrieve the auto-generated keys after executing
an INSERT statement in JDBC ?
CANDIDATE ANSWER
executeUpdate()
executeQuery()
getGeneratedKeys()
getResultSet()
No Comments
QUESTION 12 Java_JDBC_2
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
Which JDBC interface is used to execute a parameterized SQL query to retrieve data from a database?
Score 1
CANDIDATE ANSWER
Statement
ResultSet
PreparedStatement
CallableStatement
No Comments
8/15
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
Connection.getConnection(url)
Driver.getConnection(url)
DriverManager.getConnection(url)
new Connection(url)
No Comments
QUESTION 14 Java_JDBC_4
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
Jay is trying to connect with database. help jay by selecting correct method to connect with Database ?
Score 1
CANDIDATE ANSWER
connect( )
openConnection( )
getConnection( )
createConnection( )
No Comments
QUESTION 15 Java_JDBC_5
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
No Comments
QUESTION 16
9/15
Correct Answer
Java_JDBC_6 Multiple Choice JDBC
QUESTION DESCRIPTION
Score 1
Rahul is trying to end the database connection. help rahul to end the database connection by using proper
method
CANDIDATE ANSWER
shutdown()
close()
endconnection()
disconnect()
No Comments
QUESTION 17 Java_JDBC_7
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
2. Creating connection
3. Creating statements
4. Executing queries
5. Closing connection
2. Creating connection
3. Executing queries
4. Creating statements
5. Closing connection
2. Creating connection
3. Closing connection
4. Creating statements
5. Executing queries
10/15
1. Register the driver class
2. Creating connection
3. Creating statements
4. Closing connection
5. Executing queries
No Comments
QUESTION 18 Java_JDBC_8
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
SQLException
DatabaseException
ConnectionException
ConnectivityException
No Comments
QUESTION 19 Java_JDBC_9
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
Hritik is trying to establish the connection with the Apche derby database.
Score 1
Help Hritik to choose correct code snippet
CANDIDATE ANSWER
Class.forName("org.mysql.jdbc.EmbeddedDriver");
con=DriverManager.getConnection("jdbc:derby:C:\\User\\MyDB;create=true");
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
con=DriverManager.getConnection("jdbc:derby:C:\\User\\MyDB;create=true");
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
con=DriverManager.getConnection("derby:C:\\User\\MyDB;create=true");
Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
con=DriverManager.getConnection("jdbc:C:\\User\\MyDB;create=true");
11/15
No Comments
QUESTION 20 Java_JDBC_10
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
Which of the following statements about the PreparedStatement interface in JDBC is True ?
Score 1
CANDIDATE ANSWER
No Comments
QUESTION 21 Java_Web_1
Multiple Choice Java_Web
Wrong Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
The GET method sends the encoded user information appended to the
page request.
The GET method is the defualt method to pass information from browser
to web server.
No Comments
QUESTION 22 Java_Web_2
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
Which of the following code is used to get a HTTP Session object in servlets?
Score 1
CANDIDATE ANSWER
request.getSession()
response.getSession();
12/15
new Session()
No Comments
QUESTION 23 Java_Web_3
Multiple Choice Java_Web
Wrong Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
It cannot be overridden.
No Comments
QUESTION 24 Java_Web_4
Multiple Choice Java_Web
Wrong Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
2.02E+11
20
15
No Comments
QUESTION 25 Java_Web_5
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
Which of the following code is used to get an attribute in a HTTP Session object in servlets?
Score 1
13/15
CANDIDATE ANSWER
session.getAttribute(String name)
session.alterAttribute(String name)
session.updateAttribute(String name)
session.setAttribute(String name)
No Comments
QUESTION 26 Java_Web_6
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
URL rewriting
SSL sessions
Cookies
No Comments
QUESTION 27 Java_Web_7
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
<jsp:forward>
<%@directive%>
response.sendRedirect(URL)
response.setRedirect(URL)
No Comments
QUESTION 28 Java_Web_8
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
page directive
include directive
taglib directive
command directive
No Comments
QUESTION 29 Java_Web_9
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
Request
HttpRequest
HttpServletRequest
ServletRequest
No Comments
QUESTION 30 Java_Web_10
Multiple Choice Java_Web
Wrong Answer
QUESTION DESCRIPTION
The doGet() method in the example extracts values of the parameter’s type and number by using
Score 0
__________
CANDIDATE ANSWER
request.getParameter()
request.setParameter()
response.getParameter()
response.getAttribute()
No Comments
15/15