Capgemini Technical-Java Contributed by sourav singh updated on Nov 2021

# Capgemini Technical-Java previously asked questions

1 Three pipes, A, B, & C are attached to a tank. A & B can fill it in 20 & 30 minutes respectively while C can empty it in 15 minutes. If A, B & C are kept open successively for 1 minute each, how soon will the tank be filled?

Ans.167 minutes.

2        Output of the following program is
main()
{int i=0;
for(i=0;i<20;i++)
{switch(i)
case 0:i+=5;
case 1:i+=2;
case 5:i+=5;
default i+=4;
break;}
printf("%d,",i);
}
}

a) 0,5,9,13,17
b) 5,9,13,17
c) 12,17,22
d) 16,21
e) Syntax error

Ans. (d)

3    What is the output in the following program
main()
{char c=-64;
int i=-32
unsigned int u =-16;
if(c>i)
{printf("pass1,");
if(c
printf("pass2");
else
printf("Fail2");
}
else
printf("Fail1);
if(i
printf("pass2");
else
printf("Fail2")
}

a) Pass1,Pass2
b) Pass1,Fail2
c) Fail1,Pass2
d) Fail1,Fail2
e) None of these

Ans. (c)

4 Two trains are traveling from point A to point B such that the speed of first train is 65 kmps and the speed of 2 train is 29 kmph. Where is the distance b/w A&B such that the slower train reached 5 hrs late compared to the faster.

5 if a row dominated two dimensional array in the following which one is advantage and why?

a) for(i=0;i<1000;i++)

for(j=0;j<1000;j++)

temp=temp+a[i][j];

b) for(j=0;j<1000;j++)

for(i=0;i<1000;i++)

temp=temp+a[i][j]

Consider the prog and select answer

#include<stdio.h>

void main ( )

{

int k=4,j=0:

switch (k)

{

case 3;

j=300;

case 4:

j=400:

case 5:

j=500;

}

printf (%d ,j);

}

A. 300

B. 400

C. 500

D. 0

6 If Log2 x - 5 Log x + 6 = 0, then what would the value / values of x be?

Ans.. x = e2 or e3.

7 What is HQL ?
HQL stands for Hibernate Query Language. Hibernate allows the user to express queries in its own portable SQL extension and this is called as HQL. It also allows the user to express in native SQL.

JSP is used mainly for presentation only. A JSP can only be HttpServlet that means the only supported protocol in JSP is HTTP. But a servlet can support any protocol like HTTP, FTP, SMTP etc.

8 What is Struts Validator Framework ?

Struts Framework provides the functionality to validate the form data. It can be use to validate the data on the users browser as well as on the server side. Struts Framework emits the java scripts and it can be used validate the form data on the client browser. Server side validation of form can be accomplished by sub classing your From Bean with DynaValidatorForm class.

9 How many types of literals are there in JAVA ?
There are four types of literals they are Integer literals, Floating point literals, Boolean literals and character literals.

10 What is ActionServlet ?

The class org.apache.struts.action.ActionServlet is the called the ActionServlet. In the the Jakarta Struts Framework this class plays the role of controller. All the requests to the server goes through the controller. Controller is responsible for handling all the requests.

feedback