1. What will be the output of the following arithmetic
expression?
5 + 3 * 2 % 10 – 8 * 6
a) –37 b) –42 c) –32 d) –28
2. What will be the output of the following statements?
main()
5 + 3 * 2 % 10 – 8 * 6
a) –37 b) –42 c) –32 d) –28
2. What will be the output of the following statements?
main()
{
int x[4] = {1,2,3};
int x[4] = {1,2,3};
printf("%d %d
%D",x[3],x[2],x[1]);
}
a) 0 3 %D b) 000 c) 032 d) 321
3. What will be the output of the following statement?
printf( 3 + "goodbye");
a) goodbye b) odbye c) bye d) dbye
a) 0 3 %D b) 000 c) 032 d) 321
3. What will be the output of the following statement?
printf( 3 + "goodbye");
a) goodbye b) odbye c) bye d) dbye
4. What will be the output of the following statements?
main()
{
int i = 1,j;
int i = 1,j;
j=i-- - -2;
printf("%d",j);
}
}
a) error b) 2 c) 3 d) -3
5. What will be the output of following program?
main()
{
int x,y = 10;
x = y * NULL;
printf("%d",x);
}
a) error b) 0 c) 10 d) garbage value
6. What will be the output of following statements?
main()
{
char x[ ] = "hello hi";
char x[ ] = "hello hi";
printf("%d%d",sizeof(*x),sizeof(x));
}
a) 88 b) 18 c) 29 d) 19
7. What will be the output of the following statements?
main()
}
a) 88 b) 18 c) 29 d) 19
7. What will be the output of the following statements?
main()
{
int i = 3;
printf("%d%d",i,i++);
}
a) 34 b) 43 c) 44 d) 33
int i = 3;
printf("%d%d",i,i++);
}
a) 34 b) 43 c) 44 d) 33
8.What would be the output of the following program?
main()
{
char str[]="65AB";
printf("\n%d", sizeof(str));
}
1) 7 2) 6 3) 5 4) error
9.What will be the value of `a` after the following code is executed
#include<stdio.h>
#define square(x) x*x
main()
{
int a =
square(2+3);
printf("%d",a);
}
1) 25 2) 13 3) 11 4) 10
10. What will be the output of the following statements?
void func()
{
int x = 0;
static int y = 0;
x++;
10. What will be the output of the following statements?
void func()
{
int x = 0;
static int y = 0;
x++;
y++;
printf( "%d -- %d\n", x, y );
}
int main()
{
func();
func();
return 0;
}
What will the code above print when it is executed?
1)
1 -- 1
1 -- 1
2)
1 -- 1
2 -- 1
3)
1 -- 1
2 -- 2
4)
1 -- 1
1 -- 2
11. What will be the output of the following statements ?
main()
printf( "%d -- %d\n", x, y );
}
int main()
{
func();
func();
return 0;
}
What will the code above print when it is executed?
1)
1 -- 1
1 -- 1
2)
1 -- 1
2 -- 1
3)
1 -- 1
2 -- 2
4)
1 -- 1
1 -- 2
11. What will be the output of the following statements ?
main()
{
int y[4] = {6, 7,
8, 9};
int *ptr = y + 2;
printf("%d\n", ptr[ 1 ] );
}
What is printed when the sample code above is executed?
1) 6 2) 7 3) 8 4) 9
What is printed when the sample code above is executed?
1) 6 2) 7 3) 8 4) 9
No comments:
Post a Comment