Professional Documents
Culture Documents
TCS PRA MCQs
TCS PRA MCQs
Email *
Your email
URL rewriting
SSL sessions
Cookies
1 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
The doGet() method in the example extracts values of the parameterLs type 1 point
request.getParameter()
request.setParameter()
response.getParameter()
response.getAttribute()
You can store elements dynamically without de�ning the size beforehand.
None
2 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
What is the default access modifier for class members in Java if no access 1 point
modifier is specified?
public
private
default
package - private
Which of these class is related to all the exceptions that cannot be caught? 1 point
Error
Exception
RuntimeException
method?
INSERT
DELETE
SELECT
UPDATE
3 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Which of the below statement is incorrect about class name requirements? 1 point
Class name can contain only letters and cannot have digits,underscore or dollar
sign.
The doGet() method in the example extracts values of the parameters type 1 point
request.getParameter()
request.setParameter()
response.getParameter()
response.getAttribute()
Which SQL constraint do we use to set some value to a field whose value has 1 point
UNIQUE
Not Null
DEFAULT
CHECK
4 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
page directive
include directive
taglib directive
command directive
Siddhant is trying to execute following code . What will be the output after 1 point
execution ?
ArrayindexOutOfBoundException
ClassCastException
InputMismatchException
5 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
It cannot be overridden.
Which of the following method exposes the Data in the URL ? 1 point
doGet
doPost
doDisplay
Float
Numeric
Decimal
Character
6 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
JSP expressions begin with <%= ...%> tags and do not include semicolons. 1 point
True or False
True
False
Ritik is learning about a JDBC. Help Ritik to understand the Steps of 1 point
7 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
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.
None
Which of the following statements are true for Final keword in java ? 1 point
Prevents Inheritance
Once a variable is declared with �nal , it can be assigned value only once
java.lang
java.util
java.net
java.awt
8 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
True
False
What should be present in blank for the below SQL statement ? 1 point
query
update
statement
How is a new record inserted into the database in JDBC with a parameterized 1 point
9 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
}
}
}
RuntimeException
CompilationError
ExceptionHandled
Which class can be used to print the dynamic content of HTML ? 1 point
SystemWriter
OutWriter
PrintWriter
10 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
12345
In�nite Loop
1234
Error
Using “response.setContentType("text/html")"
With “request.setContentType("text/html")"
11 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
How is a new. record inserted into the database in JDBC with a 1 point
In method overloading, methods must have the same name and different
signatures.
True
False
12 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Shreya has a Java application that needs to update the salary of an employee 1 point
with a specific ID in the database. Help Shreya in writing the SQL query
template that would she use with a PreparedStatement to achieve this ?
Ritik wants to store unique names in collection . Help Ritik to choose correct 1 point
Set
Map
List
Queue
You can store elements dynamically without de�ning the size beforehand.
13 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
NullPointerException
FileNotFoundException
ClassNotFoundException
IOException
Declaration
Scriptlet
Expression
Comment
14 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
How do you define a Manager class that inherits from the Employee class in 1 point
java?
What is the correct way to define a URL mapping for a Servlet using 1 point
annotations?
@WebServiet("/ServletPath”)
@URLMapping("/ServletPath")
@HttpServiet("/ServletPath”)
@RequestMapping("/ServletPath")
15 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
General sound.
Bark!
Compilation error.
No output.
16 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Which of the following specifies when the trigger will be executed? 1 point
BEFORE
AFTER
INSTEAD OF
RuntimeException
Exception
Throwable
Error
17 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
try-catch Block
throws Clause
catch-throw Block
�nally Block
10 / 0
No output
18 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
How is form data sent using the GET method received in a Servlet? 1 point
Using ‘request.getAttribute()’
Using “response.getParameter()"
Using “request.getParameter()"
With “response.getAttribute()"
What will happen if you try to get the value of a key that does not exist in a 1 point
“HashMap"?
It returns ‘null’.
It throws an exception.
executeUpdate()
executeQuery()
executeinsert()
execute()
19 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
What do Collections.sort internally uses if the number of elements are more 1 point
than 7?
Insertion sort
Merge sort
Quick sort
Subhajit is trying to establish the connection with the SQLite Database. Help 1 point
Class.forName("org.mysql.jdoc.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’);
20 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Functions
Procedures
Triggers
None
Which file is created to configure the servlet container and servlet mappings 1 point
META-INF
web.xml
mapping.xml
WEB-INF
Which JDBC component is used for establishing a connection with the 1 point
ResultSet
Statement
PreparedStatement
DriverManager
21 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Car started.
Compilation error.
No output.
22 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
In method overloading, methods must have the same name and different 1 point
signatures.
True
False
23 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
/SampleServlet
*.do
*/*
SampleServiet
Which of the following code is used to get a HTTP Session object in servlets 1 point
request.getSession()
response.getSession()
new Session()
24 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Which of the following is a valid way to create a new file in Java? 1 point
25 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
The doGet() method in the example extracts values of the parameter’s type 1 point
request.getParameter()
request.setParameter()
response.getParameter()
response.getAttribute(
True
False
error
26 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Left join
self-join
Outer join
Right join
To create a new class from an existing class, allowing for shared structure and
behavior.
length() returns the capacity of ArrayList and size() returns the actual number of
elements stored in the list
27 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Client
Server
tomcat
%NOTFOUND
%FOUND
%ROWCOUNT
%ISOPEN
28 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
What feature of Java allows for implementing multiple ways of performing a 1 point
single action?
Inheritance
Abstraction
Polymorphism
Encapsulation
Which of the following code is used to get an attribute in a HTTP Session 1 point
object in servlets ?
session.getAttribute(String name)
session.alterAttribute(String name)
session.updateAttribute(String name)
session.setAttribute(String name)
29 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
In a web application, you need to insert user registration data into a database 1 point
table called users. The user data includes username, email, and password.
Which JDBC interface is most suitable for executing this kind of query to
prevent SQL injection attacks ?
Statement
ResultSet
CallableStatement
PreparedStatement
connect()
openConnection()
getConnection()
createConnection()
30 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
id, class
id, type
type, property
type, id
Which of the following code can be used to redirect user to different url? 1 point
request.sendRedirect(location)
response.sendRedirect(location)
header.sendRedirect(location)
31 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Ronaldo
Messi
Neymar
IndexOutOfBoundExcpetion
32 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
document.write("111"==111); 1 point
True
False
To handle runtime errors and maintain the normal �ow of the program.
Which of the following Is true about JSP scriptlets ("<% %>" syntax)? 1 point
They allow embedding multiple lines of java code for server-side processing
33 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Which of the following is a database used for creating JDBC connections? 1 point
SQL
Derby
PLSQL
Unix
What is the output of embedding ~<%= new java.util.Date() %> in a JSP 1 point
page?
stop
exit
return
break
34 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
What is the primary purpose of JSP expressions (<%= %>~ syntax) in a JSP 1 point
page?
How can you import a Java class into a JSP file? 1 point
Statement
ResultSet
PreparedStatement
CallableStatement
35 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Which of the following is used to send HTML response from a Servlet? 1 point
HttpServietResponse.send()
HttpServietResponse.getWriter()
HttpServietRequest.getWriter()
HttpServietResponse.getOutputStream()
System.out.printIn((7==9)?1:false); 1 point
no output
False
36 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Suppose Raju Rastogi is developing a Java web application for an online 1 point
bookstore. The application allows users to browse books, add them to a cart,
and make purchases. The application uses a MySQL database to store book
information. His task is to implement a feature that displays the top three
bestselling books based on the number of purchases made by users. Which
of the following Java technologies would be most suitable for implementing
this feature ?
How can you import a Java class into a JSP file? 1 point
37 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
You are developing an e-commerce application in Java that needs to fetch 1 point
getString()
getint()
getDouble()
getFloat()
c.terminate()
c.closeConnection()
c.end()
c.close()
38 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Given the following field and method declaration, what Is the Value in al1] 1 point
39 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Hybrid inheritance
Simple inheritance
Contents of Welcome.html
Page 1 of 1
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy
40 of 41 27-11-2023, 08:53 pm
TCS PRA MCQs https://docs.google.com/forms/d/e/1FAIpQLSeCy9Mv2WOEaSCEN...
Forms
41 of 41 27-11-2023, 08:53 pm