Motorola Placement Paper (Technical-C Test)


Paper: Motorola Placement Paper (Technical-C Test)

Technical:

Q.  write a C code

1.To reverse a string using a recursive function, without swapping or using an extra memory.

2.To reverse a linked list as above.

3.  what will MAX(i++,j),MAX(i,j++) return.

4. Difference between Macro and ordinary definition.

5. Difference between Class and Struct.

6. Give the outputs of a compiler and assembler and loader and linker etc.

7. If a new data structure, suppose a queue is to be added like int, long  etc., where shall the changes be -- lex or yacc or where.

8. what is a Real Time OS.

9. Describe VRTX in few words.

10. How does the scheduler know the time how it should be scheduled.

11. Name some sockets, TLI, streams. and much about project.

12. What is deadlock? How do you avoid it?

13. What is a semaphore?

14. What exactly happens after each system call in sockets, both at the client and at the server.

15. What is the difference between widget & gadget in XWindows?

16. Tell about strtok & strstr functions.

17. Matricide:Mother:: Homicide:? Ans Human

18.20%loss;20 % gain Ans 4% loss

19.Calls:Tissus::Atom:? Ans:Molecules


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
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)


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

5.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

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

7. p:malloc(int*sizeof(int));
ans: a

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

ans 10

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

10. 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


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. Others questions are mainly concentrated on errors like :-
(i)syntax (ii) runtime (iii) logical (iv) debugging.


15. A binary tree with depth of '3' has max kof 20 nodes ans: no.

16. malloc ? 2. char * p =" hwllo world " , what is wrong?

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

18. *p++ = ?

19.  int i=7
      printf( "%d
",i++ i++) o/p =? ans 56

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

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

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

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

24. strcat( string,'O');
wrong? werite reason?

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



Shared by: