iNautics Previous Years Solved Sample Placement Papers
-
main( )
{
printf(“%d %d %d”,sizeof(‘3’),sizeof(“3”),sizeof(3));
}
(a) 1 1 1
(b) 2 2 2
(c) 1 2 2 (Ans)
(d) 1 1 1
Note: Assume size of int is 2 bytes -
main( )
{
char a[ ];
a[0] = ‘A’;
printf(“%c”, a[0]);
}
(a) Compilation Error (Ans)
(b) No output
(c) A
(d) None
-
main( )
{
int x = 5;
printf(“%d %d”, x++, ++x);
return 0;
}
(a) Error
(b) 6, 6
(c) 5, 7 (Ans)
(d) 7, 6
-
main( )
{
int z = 4;
printf( “%d”, printf(“ %d %d “, z, z));
}
(a) 4 4 3
(b) 4 4 5 (Ans)
(c) 4 4 4
(d) Error
-
int i = 0;
main( )
{
printf(“i = %d”, i);
i++;
val( );
printf(“After i=%d”, i);
val( );
}
val( )
{
i =100;
printf(“val’s i=%d\n”, i);
i++;
}
(a) i = 0
(b) i = 0
(c) Error (Ans)
(d) None of the above
val’s i=100 val’s i=100 i = 1 i = 101 val’s i = 100 val’s i = 100 -
main( )
{
int a[ ] = { 10, 20, 30, 40, 50};
int j;
for (j = 0; j < 5; j++)
{
printf(“ \n %d”, *a);
a++;
}
}
(a) 0..5
(b) 0..4
(c) Error (Ans)
(d) None of the above
-
main( )
{
int a[5] = {2, 4, 6, 8, 10};
int i, b = 5;
for (i = 0; i < 5; i++)
{
f(a[i], &b);
printf(“\n %d %d”, a[i], b);
}
}
f(int x, int *y)
{
x = *(y) += 2;
}
(a) 2 7
(b) 4 9 (Ans)
(c) 7 2
(d) Error
4 9 6 11 9 4 6 11 8 13 11 6 8 13 10 15 13 8 10 15 12 17 15 10 -
main ( )
{
int n=20, i = 0;
while(n-- > 0);
i = i + n;
}
The end value of i is
(a) 210
(b) 20
(c) -1 (Ans)
(d) 200
-
main( )
{
int i = 0; char ch = ‘A’;
do {
printf(“%c”, ch);
} while (i++ < 5 || ++ch <= ‘F’);
}
The output of above program is
(a) ABCDEF (Ans)
(b) AAAAAA BCDEF
(c) A will be displayed infinitely
(d) None of the above
-
Assume that a, b, c are integer variables. Values of a, b and c are 2, 3 and 1 respectively. Which of the following statement is correct regarding the assignment d = a < b < c - 1;
(a) Above statement is syntactically not correct
(b) Value zero will be stored in variable d (Ans)
(c) Value one will be stored in variable d
(d) Value -1 will be stored in variable d