Motorola Placement Paper

Company: Motorola

1. main()
{
int arr;
int c:
int N;
for(i=-:i<=x;j<=i 5. 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)

6. The values of sum from above fn for x=0; y=0;z=1
Ans 1

7.how can you insert the following values in stack and numbers 0,20,30,40,50.60 stack [][][][][][] numb [][][][][][][] Ans 60 50 40 30 20 10 10 20 30 40 50 60 check.

8. # if ndif XYZ #include “XYZ.h” #endif what is meaning ?
Ans: if XYZ is not defined then only include the header file XYZ.h.

9. p:malloc(int*sizeof(int)); ans: a 10.a=5 b=10 c=7 (a>c)?a:((b>c)?b:c)
ans 10

11. debugging eliminates Ans[c]
ans: both logical & ruin time errors.

12. int term (int x)
{ int sum=0;int i;
for(i=0;i<=5;i++) sum+=x; /*problel is wrong but
Ans is 650.*/ return(sum); }
Ans 650 the above fn value for x=150

13.int x; scanf(“%d”,x); what is error in the above program

14.int a[] = { 1, , 9,2…….} int *p; p=&a; printf(“%s”,p); a)7 b)2 c)4407 d)none
ans: d

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

16. OTHER QUESTIONS ARE MAINLY CONCENTRATED ON ERRORS LIKE (i)syntax (ii) runtime (iii) logical (iv) debugging.

17. A binary tree with depth of ‘3’ has max kof 20 nodes ans: no.

18.. malloc ? 2. char * p =” hwllo world ” , what is wrong?

19. char *(*(*a(N))())();?

20. *p++ = ?

21 int i=7 printf( “%d n”,i++ i++) o/p =?
ans 56

22. n=2 pow((2.0,n),++n)?

23. #define macro for ( i,g) ?

24. int reg=2 is there any wrong ? write a reason

25. #define max 10 p=&(a+b); q=*max; } what is wrong

26. strcat( string,’O’); wrong? werite reason?

27.char *s=char * …. else (string)….? wrong? write reason?

Motorola Placement Paper