11.
What is the output of this C code (on a 32-bit machine) ?
int main()
{
int x = 10000;
double y = 56;
int *p = &x;
double *q = &y;
printf("p and q are %d and %d", sizeof(p), sizeof(q));
return 0;
}
A. p and q are 4 and 4
B. p and q are 4 and 8
C. Compiler error
D. p and q are 2 and 8
Answer: A
Explanation:
Size of any type of pointer is 4 on a 32-bit machine.
Output:
$ cc pgm6.c
$ a.out
p and q are 4 and 4
---------------------------------------------------------------------------------------------
12.
Which is correct with respect to size of the datatypes?
A. char > int > float
B. int > char > float
C. char < int < double
D. double > char > int
Answer: C
Explanation:
char has lesser bytes than int and int has lesser bytes than double in any system.
-------------------------------------------------------------------------------------------
13.
Which of the datatypes have size that is variable?
A. int
B. struct
C. float
D. double
Answer: B
Explanation:
Since the size of the structure depends on its fields, it has a variable size.
---------------------------------------------------------------------------------------------
14.
Predict the output
#include
int main()
{
float c = 5.0;
printf ("Temperature in Fahrenheit is %.2f", (9/5)*c + 32);
return 0;
}
A. Temperature in Fahrenheit is 41.00
B. Temperature in Fahrenheit is 37.00
C. Temperature in Fahrenheit is 0.00
D. Compiler Error
Answer: B
----------------------------------------------------------------------------------------
First Previous
---------------------------------------------------------------------------------------
More Imp Topics: