Report_Practice1_PRA_MCQ_Java
Report_Practice1_PRA_MCQ_Java
com
Skills Score:
Collection 1/1
Collection Framework Java 0/1
Collections 0/1
Exception Handling 2/2
JDBC 10/10
JSP 0/1
Java 5/6
Java_Web 5/6
Recruiter/Team Comments:
No Comments.
QUESTION 1 Adv_Java_1
Multiple Choice Collections Advance Java Collection Framework Java
Wrong Answer
QUESTION DESCRIPTION
Which of the collection classes will be helpful when we need to store unique elements and their
Score 0
insertion order is maintained?
CANDIDATE ANSWER
HashSet
LinkedHashSet
TreeSet
PriorityQueue
2/13
No Comments
QUESTION 2 Adv_Java_2
Multiple Choice Exception Handling Java
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
try
finally
thrown
catch
No Comments
QUESTION 3 Adv_Java_3
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
Score 1 Siddhant is trying to execute following code . What will be the output after execution ?
CANDIDATE ANSWER
ArrayIndexOutOfBoundException
ClassCastException
InputMismatchException
No Comments
QUESTION 4 Adv_Java_4
Multiple Choice Java
QUESTION DESCRIPTION
3/13
QUESTION DESCRIPTION
Which of the following is an unchecked exception in Java?
Correct Answer
NullPointerException
ArithmeticException
ClassNotFoundException
IOException
No Comments
QUESTION 5 Adv_Java_5
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
Score 1 How do you define a Manager class that inherits from the Employee class in java?
CANDIDATE ANSWER
No Comments
QUESTION 6 Adv_Java_6
Multiple Choice Java
Wrong Answer
QUESTION DESCRIPTION
class Company{
// some code
}
class Employee extends Company{
// some code
}
class Programmer extends Employee{
// some code
}
class Tester extends Employee{
// some code
}
4/13
CANDIDATE ANSWER
Hybrid Inheritance
Simple Inheritance
Multiple Inheritance
No Comments
QUESTION 7 Adv_Java_7
Multiple Choice Adv Java
Wrong Answer
QUESTION DESCRIPTION
Which of the following statement(s) is/are true for compile time Polymorphism in java?
Score 0
(A) The call is resolved by the compiler.
(B) It provides fast execution.
CANDIDATE ANSWER
No Comments
QUESTION 8 Adv_Java_8
Multiple Choice Exception Handling
Correct Answer
QUESTION DESCRIPTION
Score 1 Suppose you are developing a Java application for an online bookstore. When a user tries to purchase
a book, your code encounters an unexpected situation where the book they want is out of stock. To
handle this scenario, you decide to use exception handling.
What type of exception handling mechanism in Java would be most suitable for handling the
situation when a user attempts to purchase an out-of-stock book?
CANDIDATE ANSWER
FileNotFoundException
OutOfMemoryError
NullPointerException
CustomOutOfStockException
No Comments
5/13
QUESTION 9 Adv_Java_9
Multiple Choice Collection
Correct Answer
QUESTION DESCRIPTION
Manish Reddy wants to create a list of Student names that allows duplicate entries, and the insertion order
Score 1
is maintained. Which java collection should he will use?
CANDIDATE ANSWER
HashSet
ArrayList
TreeSet
HashMap
No Comments
QUESTION 10 Adv_Java_10
Multiple Choice Java
Correct Answer
QUESTION DESCRIPTION
Score 1 Which of the following is a valid way to create a new file in Java?
CANDIDATE ANSWER
No Comments
QUESTION 11 JDBC_1
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
executeResult()
executeQuery()
executeUpdate()
execute()
6/13
No Comments
QUESTION 12 JDBC_2
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
Class.forName("org.mysql.jdbc.EmbeddedDriver");
con=DriverManager.getConnection("jdbc:derby:C:\\User\\MyDB;create=true");
Class.forName("org.sqlite.JDBC");
con=DriverManager.getConnection("jdbc:sqlite:C:\\User\\MyDB");
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");
No Comments
QUESTION 13 JDBC_3
Multiple Choice JDBC Java Database Connectivity
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
DriverManager.getConnection(url)
new Connection(url)
Driver.getConnection(url)
Connection.getConnection(url)
No Comments
QUESTION 14 JDBC_4
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
7/13
1. Register the driver class 2. Creating connection 3. Creating statements
4. Executing queries 5. Closing connection
No Comments
QUESTION 15 JDBC_5
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
No Comments
QUESTION 16 JDBC_6
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
No Comments
QUESTION 17 JDBC_7
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
int
ResultSet
boolean
number
No Comments
QUESTION 18 JDBC_8
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
In a web application, you need to insert user registration data into a database table called users. The
Score 1
user data includes username, email, and password. Which JDBC interface is most suitable for
executing this kind of query to prevent SQL injection attacks ?
CANDIDATE ANSWER
Statement
ResultSet
CallableStatement
PreparedStatement
No Comments
QUESTION 19 JDBC_9
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
Shreya has a Java application that needs to update the salary of an employee with a specific ID in
Score 1
the database. Help Shreya in writing the SQL query template that would she use with a
PreparedStatement to achieve this ?
CANDIDATE ANSWER
No Comments
9/13
QUESTION 20 JDBC_10
Multiple Choice JDBC
Correct Answer
QUESTION DESCRIPTION
You are developing an e-commerce application in Java that needs to fetch product information
Score 1
including name, price, and availability from a database. Which method of ResultSet would you use
to retrieve the availability of a product?
CANDIDATE ANSWER
getString()
getInt()
getDouble()
getBoolean()
No Comments
QUESTION 21 Java_Web_1
Multiple Choice Java Web
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
include
page
export
useBean
No Comments
QUESTION 22 Java_Web_2
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
CANDIDATE ANSWER
session.getAttribute(String name)
session.alterAttribute(String name)
session.updateAttribute(String name)
session.setAttribute(String name)
10/13
No Comments
QUESTION 23 Java_Web_3
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
URL rewriting
SSL sessions
Cookies
No Comments
QUESTION 24 Java_Web_4
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
The doGet() method in the example extracts values of the parameter’s type and number by using
Score 1
__________
CANDIDATE ANSWER
request.getParameter()
request.setParameter()
response.getParameter()
response.getAttribute()
No Comments
QUESTION 25 Java_Web_5
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
11/13
Options: (Expected answer indicated with a tick)
Contents of Welcome.html
No Comments
QUESTION 26 Java_Web_6
Multiple Choice Java_Web
Correct Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
doGet
doPost
doDisplay
No Comments
QUESTION 27 Java_Web_7
Multiple Choice Java Web
Correct Answer
QUESTION DESCRIPTION
In JavaServer Pages (JSP), what is the purpose of the <%@ page import="..." %> directive?
Score 1
CANDIDATE ANSWER
No Comments
QUESTION 28 Java_Web_8
Multiple Choice Java_Web
Wrong Answer
QUESTION DESCRIPTION
JSP expressions begin with <%= ...%> tags and do not include semicolons. True or False
Score 0
12/13
CANDIDATE ANSWER
TRUE
FALSE
No Comments
QUESTION 29 Java_Web_9
Multiple Choice Java Web
Wrong Answer
QUESTION DESCRIPTION
Score 0 You are developing a web application for an online quiz platform using Java technologies. The
application involves displaying questions dynamically and collecting user responses. As you work with
JavaServer Pages (JSP) and Servlets, you encounter a scenario related to user authentication and
session management.
When a user successfully logs in to the quiz platform, what Java technology is commonly used to
maintain their session information throughout their interaction with the application?
CANDIDATE ANSWER
JavaBeans
HttpSession
No Comments
QUESTION 30 Java_Web_10
Multiple Choice JSP
Wrong Answer
QUESTION DESCRIPTION
CANDIDATE ANSWER
<% %>
<%! %>
<%@ %>
<%= %>
No Comments
13/13