0% found this document useful (0 votes)
21 views

Report_Practice1_PRA_MCQ_Java

Suvom Nath took the Practice1_PRA_MCQ_Java test on March 12, 2024, scoring 80% with 24 out of 30 questions correct in 39 minutes and 57 seconds. The test covered various Java topics, including Advanced Java, JDBC, and Java Web, with specific scores noted for each category. No comments were provided by the recruiter or team regarding the performance.

Uploaded by

rtandon3102
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Report_Practice1_PRA_MCQ_Java

Suvom Nath took the Practice1_PRA_MCQ_Java test on March 12, 2024, scoring 80% with 24 out of 30 questions correct in 39 minutes and 57 seconds. The test covered various Java topics, including Advanced Java, JDBC, and Java Web, with specific scores noted for each category. No comments were provided by the recruiter or team regarding the performance.

Uploaded by

rtandon3102
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Practice1_PRA_MCQ_Java_1st_Feb_24_KOL  4837503_857_25872691@tcsltd.

com

You can view this report online at : https://www.hackerrank.com/x/tests/1851246/candidates/61473707/report

Full Name: Suvom Nath

Email: [email protected] scored in


80% Practice1_PRA_MCQ_Java_1st_Feb_24_K
Test Name: Practice1_PRA_MCQ_Java_1st_Feb_24_KOL
in 39 min 57 sec on 12 Mar 2024 15:40:00 IS
Taken On: 12 Mar 2024 15:40:00 IST
24/30

Time Taken: 39 min 57 sec/ 40 min

Employee ID: 2558520

Invited by: Velantish

Invited on: 12 Mar 2024 15:39:16 IST

Skills Score:

Tags Score: Adv Java 0/1

Advance Java 0/1

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 Database Connectivity 1/1


Java Web 2/3

Java_Web 5/6

Recruiter/Team Comments:

No Comments.

Question Description Time Taken Score Status

Q1 Adv_Java_1  Multiple Choice 56 sec 0/ 1 


Q2 Adv_Java_2  Multiple Choice 36 sec 1/ 1 
Q3 Adv_Java_3  Multiple Choice 2 min 30 sec 1/ 1 
Q4 Adv_Java_4  Multiple Choice 58 sec 1/ 1 
Q5 Adv_Java_5  Multiple Choice 29 sec 1/ 1 
Q6 Adv_Java_6  Multiple Choice 40 sec 0/ 1 
Q7 Adv_Java_7  Multiple Choice 4 min 32 sec 0/ 1 
Q8 Adv_Java_8  Multiple Choice 4 min 33 sec 1/ 1 
1/13
Q9 Adv_Java_9  Multiple Choice 48 sec 1/ 1 
Q10 Adv_Java_10  Multiple Choice 1 min 22 sec 1/ 1 
Q11 JDBC_1  Multiple Choice 17 sec 1/ 1 
Q12 JDBC_2  Multiple Choice 2 min 9 sec 1/ 1 
Q13 JDBC_3  Multiple Choice 6 sec 1/ 1 
Q14 JDBC_4  Multiple Choice 44 sec 1/ 1 
Q15 JDBC_5  Multiple Choice 20 sec 1/ 1 
Q16 JDBC_6  Multiple Choice 13 sec 1/ 1 
Q17 JDBC_7  Multiple Choice 16 sec 1/ 1 
Q18 JDBC_8  Multiple Choice 4 min 50 sec 1/ 1 
Q19 JDBC_9  Multiple Choice 2 min 24 sec 1/ 1 
Q20 JDBC_10  Multiple Choice 43 sec 1/ 1 
Q21 Java_Web_1  Multiple Choice 3 min 26 sec 1/ 1 
Q22 Java_Web_2  Multiple Choice 43 sec 1/ 1 
Q23 Java_Web_3  Multiple Choice 1 min 34 sec 1/ 1 
Q24 Java_Web_4  Multiple Choice 1 min 41 sec 1/ 1 
Q25 Java_Web_5  Multiple Choice 2 min 1/ 1 
Q26 Java_Web_6  Multiple Choice 13 sec 1/ 1 
Q27 Java_Web_7  Multiple Choice 5 sec 1/ 1 
Q28 Java_Web_8  Multiple Choice 9 sec 0/ 1 
Q29 Java_Web_9  Multiple Choice 8 sec 0/ 1 
Q30 Java_Web_10  Multiple Choice 21 sec 0/ 1 

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

Options: (Expected answer indicated with a tick)

HashSet

LinkedHashSet

TreeSet

PriorityQueue

2/13
No Comments

QUESTION 2 Adv_Java_2 

Multiple Choice Exception Handling Java

Correct Answer
QUESTION DESCRIPTION

Which of these keywords must be used to monitor for exceptions?


Score 1

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

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 ?

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);
}
}

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

ArrayIndexOutOfBoundException

ClassCastException

InputMismatchException

[Chennai, Mumbai, Kolkata, Bangalore]

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

Score 1 CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

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

Options: (Expected answer indicated with a tick)

class Employee extends Manager{// fields and methods}

class Employee inherits Manager{// fields and methods}

class Manager extends Employee{// fields and methods}

class Manager inherits Employee{// fields and methods}

No Comments

QUESTION 6 Adv_Java_6 

Multiple Choice Java

Wrong Answer
QUESTION DESCRIPTION

Score 0 What is the type of inheritance for the following ?

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

Options: (Expected answer indicated with a tick)

Hybrid Inheritance

Simple Inheritance

Multi level 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

Options: (Expected answer indicated with a tick)

Only (A) is true.

Both (A) and (B) are true.

Only (B) is true.

Both (A) and (B) are false.

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

Options: (Expected answer indicated with a tick)

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

Options: (Expected answer indicated with a tick)

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

Options: (Expected answer indicated with a tick)

File myfile = new File("myfile.txt");

FileWriter myfile = new FileWriter("myfile.txt");

PrintWriter myfile = new PrintWriter("myfile.txt");

Scanner myfile = new Scanner("myfile.txt");

No Comments

QUESTION 11 JDBC_1 

Multiple Choice JDBC

Correct Answer
QUESTION DESCRIPTION

Which of the following method is used to perform DML statements in JDBC?


Score 1

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

executeResult()

executeQuery()

executeUpdate()

execute()

6/13
No Comments

QUESTION 12 JDBC_2 

Multiple Choice JDBC

Correct Answer
QUESTION DESCRIPTION

Subhajit is trying to establish the connection with the SQLite Database.


Score 1
Help Subhajit to choose correct code snippet.

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

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

Which of these obtains a Connection in JDBC?


Score 1

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

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

Ritik is learning about a JDBC.


Score 1
Help Ritik to understand the Steps of connecting with Database by choosing correct option.

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

7/13
1. Register the driver class 2. Creating connection 3. Creating statements
4. Executing queries 5. Closing connection

1. Register the driver class 2. Creating connection 3. Executing queries 4.


Creating statements 5. Closing connection

1. Register the driver class 2. Creating connection 3. Closing connection


4. Creating statements 5. Executing queries

1. Register the driver class 2. Creating connection 3. Creating statements


4. Closing connection 5. Executing queries

No Comments

QUESTION 15 JDBC_5 

Multiple Choice JDBC

Correct Answer
QUESTION DESCRIPTION

What is the primary purpose of a JDBC driver?


Score 1

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

To execute SQL queries

To establish a connection between Java applications and databases

To create a database schema

To display the Result Set objects

No Comments

QUESTION 16 JDBC_6 

Multiple Choice JDBC

Correct Answer
QUESTION DESCRIPTION

The executeQuery() method is used to execute SQL statements that:


Score 1

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

Update existing records in the database.

Query the database and return a result set.

Commit pending transactions.

None of the given

No Comments

QUESTION 17 JDBC_7 

Multiple Choice JDBC

Correct Answer
QUESTION DESCRIPTION

What is the return type of the executeUpdate() method in JDBC?


Score 1
8/13
CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

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

Options: (Expected answer indicated with a tick)

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

Options: (Expected answer indicated with a tick)

UPDATE employees SET salary = ? WHERE employee_id = ?;

MODIFY employees SET salary = ? WHERE employee_id = ?;

CHANGE employees SET salary = ? WHERE employee_id = ?;

ALTER employees SET salary = ? WHERE employee_id = ?;

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

Options: (Expected answer indicated with a tick)

getString()

getInt()

getDouble()

getBoolean()

No Comments

QUESTION 21 Java_Web_1 

Multiple Choice Java Web

Correct Answer
QUESTION DESCRIPTION

Which is not a directive?


Score 1

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

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

Options: (Expected answer indicated with a tick)

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

Which of the following is stored at client side ?


Score 1

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

URL rewriting

Hidden form fields

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

Options: (Expected answer indicated with a tick)

request.getParameter()

request.setParameter()

response.getParameter()

response.getAttribute()

No Comments

QUESTION 25 Java_Web_5 

Multiple Choice Java_Web

Correct Answer
QUESTION DESCRIPTION

What is the output of the following Code Snippet ?


Score 1

out.println("Hi Welcome to Validate Servlet");


RequestDispatcher rd = req.getRequestDispatcher("Welcome.html");
rd.forward(req, resp);

CANDIDATE ANSWER

11/13
Options: (Expected answer indicated with a tick)

Hi Welcome to Validate Servlet Contents of Welcome.html

Hi Welcome to Validate Servlet

Contents of Welcome.html

None of the above

No Comments

QUESTION 26 Java_Web_6 

Multiple Choice Java_Web

Correct Answer
QUESTION DESCRIPTION

Which of the following method exposes the Data in the URL ?


Score 1

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

doGet

doPost

doDisplay

None of the above

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

Options: (Expected answer indicated with a tick)

To include external JavaScript files

To import Java packages and classes

To define custom tag libraries

To set the content type of the response

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

Options: (Expected answer indicated with a tick)

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

Options: (Expected answer indicated with a tick)

JDBC (Java Database Connectivity)

JavaBeans

HttpSession

JPA (Java Persistence API)

No Comments

QUESTION 30 Java_Web_10 

Multiple Choice JSP

Wrong Answer
QUESTION DESCRIPTION

How do we identify an expression tag in JSP web pages


Score 0

CANDIDATE ANSWER

Options: (Expected answer indicated with a tick)

<% %>

<%! %>

<%@ %>

<%= %>

No Comments

PDF generated at: 12 Mar 2024 10:51:32 UTC

13/13

You might also like