Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger


Thursday, 10 July 2008

Patni Computer Services(PCS) Sample Paper Paper - 38

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]

7. find invalid statement : int a[3]
1. scanf("%d",a[2]);
2. scanf("%d",&a[2]);
3. scanf("%d",a);
4. all
ans : 1

8. One palindrome programme was given in recursion ans : pal(f++,t--)

9. main program:
i=foo(2) foo(int s)
{
if(!s)
return s;
else
{ int i=5; return i}
}
ans : 5

10. k=0 i=0j=1;
if(i0)&&(k=2) printf(k);
if(i0|| k=0)
printf(k)
ans: 2 2

11. cube is moulded as a sphere. find the ratio of cube of surface area of sphere to squareof surface area of cube. ans pi/6

12. Teacher in math=4 p6=3 kmistry=3 each can take 2 subject minimum teacher needed for school ans : 5

13. 3 vowels,4 consonents formulate string of 6 letters with a vowel in a string max no of string ? ans: 5040

14. binnary of .6875. 0.1011

15. man walks at speed of 8 km/h 300 mtrs length train crosses man in 30 sec from back, find speed of train ans: 44 km/hr

16. main()
{
char ch;
int count=0;
while((ch = getch() != ,\n,)
{
while (ch == , ,)
ch = getch();
while((ch!=, ,) && (ch!=,.,))
{
count++;
ch=getch();
}
}
ans : 11

17. Radius of a circle is 5cm , if we draw a rectangle of maximum size, what is the area of rectangle ans : 50 cmsq

18. main()
{
int i;
for(i=0;i<3;i++)
switch(i)
{
case 1: printf("%d",i);
case 2 : printf("%d",i);
default: printf("%d"i);
}
}
ans 011122

19. There r 3 boys 7 4 girls; Howmany ways they r arranged such that boys should be always together ???Ans: 240

20. If n.....; What is the max no that divides (Ans: 8)

21. A,B,C,D has values from 0 to 9.... What is D ? (Ans: 6)

22. A wodden piece taken which is in shape of Triangle , of 10 X 24 X 26 ; Then cut at some ..... which is rearranged
in rectangle format; so what is ... (Ans: 5)

23. There r 5 numbers. The average is 25; the highest value excluded then average is 25, if the lowest is excluded the avg is ..Then average of remaining is ? (Ans: 30)

24. The square is cut such that the end point of one side is shown in fig.. This is repeated two times, what is the area ??
(Ans: 3.61)

25. The route problem... what is the shortest rout to p1 to p2... (There may be circle figure......) (Ans: From p1 to 0 & form 0 to p8)

26. Two motor cycles A & B are started from one point at 4 Kmph & 6 Kmph; After 45 min B starts returning , at what
time they will reach.... (Ans: 3.6 km)

27. All integer from 0 to 9, what is the smallest no perfectly devides; (Ans: c)

28. Some figure (Triangle in a rectangle)..... What is perimeter if triangle (Ans: 20)



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 %d\n",i,l);}
printf("LOOPS= %d\n", 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("%s\n",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 %0x\n",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 = %d\n", 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("%d\n",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 %d\n",i,l);}
printf("LOOPS= %d\n", lc-1);
}
/* Ans: i = 16, and loop is executed for 169 times */

No comments:

Post a Comment