Patni




Patni

Filed under:

Patni Placement Question Paper

Sample Test Paper

1. #include
/* This problem is given in PCS BOMBAY walk-in-interview.
* What is the final value of i and how many times loop is
* Executed ?
*/

main()

{
int i,j,k,l,lc=0;
/* the input is given as 1234 567 */
printf("Enter the number string:<1234 567 >n");
scanf("%2d%d%1d",&i,&j,&k);
for(;k;k–,i++)
for(l=0;l> printf("%d %dn",i,l);}
printf("LOOPS= %dn", lc-1);
}
/* Ans: i = 17, and loop is executed for 169 times */

2. #include
main()
{
func(1);
}
func(int i){
static char *str[] ={ “One","Two","Three","Four"};
printf("%sn",str[i++]);
return;
}
/* Ans:- it will give warning because str is pointer to the char but
it is initialized with more values
if it is not considered then the answer is Two */

3. #include
main()
{
int i;
for (i=1;i<100; i++)
printf("%d %0xn",i,i);
}
/* Ans:- i is from 1 to 99 for the first format,
for the second format 1to9, ato f, 10 to 19,1ato1f, 20 to 29, etc */

4. #include
/* This problem was asked in PCS Bombay in a walk-in-interview
* Write a recursive function that calculates
* n * (n-1) * (n-2) * ……. 2 * 1
*/

main() {
int factorial(int n);
int i,ans;
printf("n Enter a Number:");
scanf("%d",&i);
ans = factorial(i);
printf("nFactorial by recursion = %dn", ans);
}
int factorial(int n)
{
if (n < = 1) return (1);
else
return ( n * factorial(n-1));
}

5. #include
/* This problem is asked in PCS Bombay walk-in-interview
* What is the output of the following problem
*/
main(){
int j,ans;
j = 4;
ans = count(4);
printf("%dn",ans);
}
int count(int i)
{
if ( i < 0) return(i);
else
return( count(i-2) + count(i-1));
}

/* It is showing -18 as an answer */

6. #include
/* This problem is given in PCS BOMBAY walk-in-interview.
* What is the final value of i and how many times loop is
* Executed ?
*/

main()

{
int i,j,k,l,lc=0;
/* the input is given as 1234 567 */
printf("Enter the number string:<1234 567 >n");
scanf("%2d%d%1d",&i,&j,&k);
for(;k;k–,i++)
for(l=0;l> printf("%d %dn",i,l);}
printf("LOOPS= %dn", lc-1);
}
/* Ans: i = 16, and loop is executed for 169 times */

Related Plament Papers and Companies

Patni

Patni Placement Question Paper Sample Test Paper 1. What is the angle between teo hands of a clock when time is 8-30 ans:75(appro) 2. A student is ranked 13th from right and 8th from left.how many are there(similer) 3. a,b,c,d,e,f are arranged in a circle b is to right of c and so on(rs aggrewal) 4. chain rule(work&time) 5. Puzzle test.some data is given and he asked three qustions below.based on data we have to answer. 6. six questions on venn diagrams 7. 5 years ago sum of ages of father and son ans:40,10 8.assertion and reasoning 1.clouds 2.capital city of

Patni

Patni Placement Question Paper Sample Questions 1. Number of Weights needed for weighing 1 to 40 kgs? 27 9 3 1 ans : 4 2. Venn diagram problem venndiagram find the formulae. Ans. (AB+BC+CA)(A'+B'+C') 3. a +2b=6,ab=4 2/a + 1/b=? ans : 3/2 4. Age of 4 persons given in a relation find smallest age? ans : meera 5. find floating point result (float)25/2, float(25/2), 25/(float)2 ,25/2 ans: 1 & 3 6. find equivalent *(*(s+x)+y) ==> s[x][y] ans : content of s[x][y]

Patni Placement Question Papers

Patni Placement Question Papers 1. square root of(PQ)=8 then 4 options Ans:p+q =1: is not possible 2. equilateral triangle of side 10 units. cow is teethered with a rope of length 7 units at one of the vertex. Find the area of the field grazed. ans-77/3 3. Series till 50 terms: 2+3-5 +2+3-5+.... ans:5 4. when x is diveded by 299 remainder is 100. then when x is divided by 23 remainder is ? ans:8 5. there r 2 groups A and B. A boy goes from gp A to gp B. When he goes the ave wt of

Patni

Patni Placement Question Paper Question pattern 1. An aircraft is flying at a height of 3000m from the ground at an average speed of 400 km/hr while descending.It has to travel 5 kms before it can touch down the runway and start operating its break system.It will take less than 10 seconds to reach the touch down point.How far it is from the touch down point if it had been on thye ground. a)5 kms b)4 kms c)3 kms d)none of these

  • Resources













  • Placement Papers Archives