-->

Motorola Placement Paper

C TEST

1. main()
{
int arr[100];
int c:
int N;
for(i=-:i<N;i++)
arr[i]=i;
minvalue i = .
Maxvalue i = .

Ans 0,100 resp

2. for n=2 the following fn returning value is
int fun(int n)
{
for(i = 1;i<=n;i++)
for(j=i;j<=i;j++)
sum=sum+j;
return(sum);
}

Ans 6

3. Calculate sum=1+1+2+1+2+3+1.

Ans i<=x;j<=i

4. for x=2 y=3 z=1
the following fn return
int fun(int n; int y; int z)
{
int sum
for(i=x;i<=y;i++)
for(j=1;j<=z;z++)
sum=sum+z;
return sum
}

Ans 0(check)

5. The values of sum from above function
for x=0; y=0;z=1

Ans 1

6.How can you insert the following values in stack and numbers
10,20,30,40,50.60
stack [][][][][][]
numb [][][][][][][]

Ans
60 50 40 30 20 10
10 20 30 40 50 60
check.

7. #if endif XYZ

#include "XYZ.h"
#endif
What is meaning ?
Ans: if XYZ is not defined then only include the header file XYZ.h.

8. p:malloc(int*sizeof(int));

Ans: a

9.a=5 b=10 c=7
(a c)?a:((b c)?b:c)

ans 10

10. int term (int x)
{
int sum=0;int i;
for(i=0;i<=5;i++)
sum+=x;
return(sum);
} the above fn value for x=150

11.int x;
scanf("%d",x);
-------------
--------------
What is error in the above program

12.int a[] = { 1, , 9,2.}
int *p;
p=&a[2];
printf("%s",p);
a)7
b)2
c)4407
d)none

Ans: d

13.a[][] = {1,2},{3,4}
b[] [] ={
void fun(A,B)
int i,j;
for(i=1;i<N;i++)
for(j=1;j<N;j++)
sum=sum+A[i][j];
return sum;
}
What is wrong in the above function?

14. A binary tree with depth of '3' has max of 20 nodes Ans: no.
15. Breadth search and depth search in binary tree.