Professional Documents
Culture Documents
int main()
{
int i = 1024;
for (; i; i >>= 1)
printf("Hello");
return 0;
}
a) 10 b) 4 c) 6 d) 7
4) The default value of an integer global variable is ________
5) Predict the output of the following program, if a, b and c are 5, 7 and 3 respectively
(assume integer range is -32768 to 32767)
void main ()
{
int a,b,c;
printf (\n Enter three numbers);
scan f (%d %d %d, &a, &b, &c);
if ((a-b) & 32768)
{
if ((a-c) & 32768)
printf ( %d, a);
else
printf ( %d, c);
}
else
if ((b-c) & 32768)
printf ( %d, b);
else
printf ( %d, c);
}
a) 5 b) 3 c) 6 d) 7
6) If a=4, b=6 then the values of a and b after the following code executes is
a=a^b;
b=b^a;
a=a^b;
8) If a is a float(assume size of float is 4 bytes) variable and &a=1000, then int *p=&a; p=p+4;
then printf(%d,p) will print the value ______________
9) The output of the following C program is
void fun(int *p)
{
int q = 10;
p = &q;
}
int main()
{
int r = 20;
int *p = &r;
fun(p);
printf("%d", *p);
return 0;
}
int main()
{
float c = 5.0;
printf ("Temperature in Fahrenheit is %.2f", (9/5)*c + 32);
return 0;
}
int main()
{
for(fun(); fun(); fun())
printf("%d ", fun());
return 0;
}
a) Infinite loop b) 13 10 7 4 1 c) 14 11 8 5 2 d) 15 12 8 5 2
12) Predict the output of the following program
int main()
{
int x=10;
int *ptr = &x;
printf("%d\n", *&*&*ptr);
return 0;
}
a) 2 2 b) 2 1 c) 0 1 d) 0 2
14) The value printed by the following program is
void f(int* p, int m)
{
m = m + 5;
*p = *p + m;
return;
}
void main()
{
int i=5, j=10;
f(&i, j);
printf("%d", i+j);
}
a) 10 b) 20 c) 30 d) 40