Sasken Exam 20th Jul 2004
Pattern : C(10 Qs) + Aptitude(10 Qs) + Discpline based[CS/EC](10 Qs)
Duration : 1 Hr
C questions
------------
1.Consider the following declaration:-
char const *p = ,d,;
Which of the following is not a permissible operation
(a) *p++
(b) ++p
(c) (*p)++
(d) All
2.What is the output of the following code:-
void print_arr(float **p)
{
printf(" 0 %f 1 %f 2 %f\n",p[0][0],p[0][1],p[0][2]);
}
void main()
{
float arr[2][3] = {{0,1,2},{3,4,5}};
float **fl_arr;
fl_arr = (float *)arr;
print_arr(fl_arr);
fl_arr++;
print_arr(fl_arr);
}
(a)
(d)segmentation fault
3.What is the output of the following code:-
#define putchar (c) printf("%c",c)
void main()
{
char s=,c,;
putchar (s);
}
(a) c
(b) 99
(c) Compilation error
(d) Execution error
4.What is the output of the following code:-
void main()
{
printf("%d",printf("ABC\\"));
}
(a) ABC\\
(b) 1
(c) ABC\4
(d) ABC\3
5.What is the output of the following code:-
int compute(int n)
{
if(n>0)
{
n=compute(n-3)+compute(n-1);
return(n);
}
return(1);
}
void main()
{
printf("%d",compute(5));
}
(a) 6
(b) 9
(c) 12
(d) 13
6.What is the output of the following code:-
void main()
{
int i;
for(i=0;i