Hi! Friends,
i have attended for SASKEN 1+ walk-in recruitment drive at Corporate office,Domlur ring road, Bangalore on 13th December
Their requirement was for RTOS-Nuclius, Linux and Symbian. They have given test(C or C++ your choice) timing for different people(nerly 100 people each batch-total 3 batches were there.
I have chosen ‘C’ test paper (set1 & set2), which consists 25 questions,45 minutes:
1. void main()
{
200;
printf(“Typical Problem”);
return 0;
}
Output : “Typical Problem”.// NO warnings & NO Error.
- void main()
{
int a=-60,b=-34;
unsigned int c=-24;
printf(“%d”,c);
return 0;
}
Ans : WARNING: initialized to negative value ‘-24’ to ‘unsigned int’.
- void main()
{
printf(“%u”,-1<<4); \
return 0;
}
Ans : ffff0
- void main()
{
printf(“madhu “);
main();
return 0;
}
ANS : INFINITE LOOP
5. void main()
{
int count=10,*temp,sum=0;
temp=&count;
*temp=20;
temp=∑
*temp=count;
printf(“%d %d %d\n”,count,*temp,sum);
return 0;
}
ANS : 20 20 20
- void main()
{
char ch;
for(ch=0;ch<=127;ch++)
printf(“%c %d”,ch,ch);
return 0;
}
- void main()
{
int a[3][4]={1,2,3,4,5,6,7,8,9,12,12,14};
printf(“%d %u %u\n”,sizeof(a),a+1,&a+1);
return 0;
}
- void main()
{
int a[3][4]={1,2,3,4,5,6,7,8,9,12,12,14};
printf(“%d %u %u\n”,sizeof(a),a+1,&a+1);
return 0;
}
If the address location of ‘a’ is 65000 the output=?
Ans : 65000 65016 65048
9. What is the size of a String Variable ?
10. Good way of representing the variables in RECURSION is ?
a)Static b)Global c)Local d)Register
11. True/False based on Storage Classes in ‘C’ .
12. How to call the function for the below : void f1(int **x)
Options: a) int *x,f1(&x);
b) int x,f1(&x);
c) int *x,f1(&&x);
d) int *x,f1(x);
13. They asked to choose a program which leads to Stack Overflow, among given 2 Factorial programs(one contains recursive function, & other general loop logic)
14. variables of Function calls allocated in :
a) Stack & Heap, b) Stack & Data, c) Data & Register d) None
15. #include
Void main()
{
int a=10,j; j=fun(a);
switch(j)
{
case 30 : printf(“Printed 30 \n”);
break;
case 50 : printf(” Printed 50\n”);
break;
default : printf(“Not 30 or 50 “);
break;
}
return 0;
}
int fun(int a)
{
return(a++);
}
16. malloc() internally calls: a) salloc() b) stbrk() c) alloc() d) none.
17. #include
void main()
{
char *p=”madhu”;
printf(“%c”,p);
return 0;
}
18. Question based on Structures (some what complicated)
Some more Questions on Pointers in ‘c’. Three more question based on Unix.