Sapient Interview Questions

Answer Posted / jitendra narang

Sapient Interview Questions
It will be an online test of 42 questions. The test is
arranged with the help of a consultancy known as

IKM (International Knowledge Measurement) which arranges the
test.

Question 1. What will be the output of the following program?
public class Example {
public static void main(String... args) {
for(int x=0,y=0; x>y; x--,y++){
System.out.println(x + " " + y + " ");
}
}


Question 2. What will be the output of the following program?
public class Sample {
public static void main(String... args) {
int i=0, j =0;
while(i++ < 2)
{
do{
System.out.println(j + " ");
}while(j++ < 2);
}
}
}
Question 3. What will be the output of the following program?
public class Test {
public static void main(String... args) {
List lst = new ArrayList();
for(int i = 1; i < 5; i++)
lst.add(i);
Iterator iter = lst.iterator();
for(Object e : lst)
System.out.println(e);

Question 4 : Which of the following is correct definition of
doGet() method of a http servlet?

a) public void doGet(HttpServletRequest request,
HttpServletResponse response) throws

ServletException, IOException {

b) public void doGet(ServletRequest request, ServletResponse
response) throws httpServletException,

IOException {

c) public void doGet(HttpServletResponse response,
HttpServletRequest request ) throws

ServletException, IOException {

d) private void doGet(ServletResponse response,
ServletRequest request ) throws

HttpServletException, ServletException {


Question 5 : Which of the following will not compile?

a) execute() method on callable statement
b) executeQuery() method on statement
c) executeQuery() method of prepared statement.
d) execute() method of statement.


Question 6 : Which of the following are not valid methods of
EJBContext?

a) abstract public EJBHome getEJBHome();
b) abstract public EJBLocalHome();
c) abstract public EJBRemote getEJBRemote();
d) abstract public Properties getenvironment();

Question 7 : Which of the following piece of code is used to
the update the checked radio buttons

unchecked?
options were like document.frm.test.selected = false;

Question 8 : Which of the following helps increase the Tight
Encapsulation of a class?

Question 9 : Which of the following SQL query can be used to
fetch the customers from customer table

where zip is either '23' or '456' and unique last name?

Answer : select distinct last_name from customers where zip
in ('23', '456');

Question 10 : Creating a stateless session bean contains
calls of which of the following methods.

Question 11 : Which of the following methods can be used to
determine if current HttpSession object

came from a cookie or from an encoded URL ?

Options were like isSessionIdFromCookie() etc

Question 12 : this() and super() constructors can be used at
the same time or in the same constructor or

one below the other or cannot be used at the same time?

Question 13 : There was a question on 'OnMouseOver' event in
Java Script.

Question 14 : Scalar Functions in DBMS.
test
Which of the following are displayed in window status bar?


Question 15 : Which of the following can be used with switch
case :

switch case
a) float double
b) float char
c) byte char
d) char int
e) int char

Question 16 : What will be the output of the following piece
of code?
public class Sample {
public static void main(String... args) {
List lst = new ArrayList();
lst.add("1");
lst.add("2");
lst.add("1","3");
lst.add("2", "4");
System.out.println(lst);
}
}

Is This Answer Correct ?    98 Yes 29 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you understand by connector? Explain connector architecture.

499


Define hashtable in j2ee?

553


What every java developer should know?

477


What is connector?

578


What is event handling in java?

491






What is declaration?

575


Is class a data type in java?

494


CANDOR Services, a leading provider of next-generation staffing services, draws from unparalleled resources and expertise to offer you innovative, quality workforce solutions. We have openings for "J2EE ARCHITECT" with one of our clients. Client is CMM Level 5 company. Location : Hyderabad Roles A J2EE Architect with expertise in Web Architecture (covering Spring MVC, AOP, Webflow, Struts, Tiles, Hibernate, JAAS, Web Application Performance Turning & Measurement) as part of Solutions Architecture Group: Position involves in providing architectural vision, conceptualize and provide architectural approaches, create models and specifications, and validating the architecture against requirements and assumptions. Also involves in providing oversight over ongoing projects as a reviewer and auditor Educational Requirements A minimum of BS or MS (MS preferred) in Computer Science or Engineering or equivalent experience in the IT industry. Skill Sets Overall 8-10 Years of experience in IT industry with 3-4 Years of experience in Service industry Technology Skills Java, J2EE, MVC Frameworks (Struts/WebWork/JSF/Spring), Spring, AOP, WebFlow, ORM Tools (Hibernate/Ibatis/JDO/Tapestry), App servers, Databases, JAAS Web Application Performance Tuning & Measurement 6+ years Java software development experience. 4+ years of enterprise Java development, with emphasis on web-based applications. Strong relational database and SQL skills (5+ years). Mail to : anuradha.k@candorservices.co.in

3080


What is asant?

574


What is the latest technology used in java?

514


Why java is a platform?

466


How to invoke stored procedure in hibernate?

494


What is form-based authentication?

536


What is tomcat in j2ee?

484


What is cmp in j2ee?

489