Académique Documents
Professionnel Documents
Culture Documents
Q1. One or more of the following is not a valid C built-in type. Please mark the
wrong one(s) with an X.
int
double
unsigned short
float
real
long long
Q2. One or more of the following declarations is wrong. Please mark the wrong
one(s) with X.
Q3. One or more of the following will NOT print HELLO. Please mark these with
X.
Q4. One or more of the following C programs will produce a compilation error.
Please mark these with X.
main (){1,2,3;}
main (){{{}}}
main (){;;;}
main (){1+2+3}
main (){1;2;3;}
Q6. Assuming that x is declared as an int, the following lines alter bit 3 of x. One
line turns bit-3 on, one turns bit-3 off and one toggles the value of bit-3. Which
line does which?
x = x | (1 << 2)
x = x & ~(1 << 2)
x = x ^ (1 << 2)
Q7. Which one of the lines of code below copies 0xAE to the contents of address
0x00010000?
main ()
{
double f,c;
Output
0.000000F = -0.000000C
40.000000F = 0.000000C
80.000000F = 0.000000C
120.000000F = 0.000000C
Q9. One of the following C statements calls a function at address 0x3000. Tick
the correct one.
((void ()(void))0x3000)(*);
((void (*)(void))0x3000)();
((void ()(void))0x3000)();
((void (*)(void))0x3000)(*);
Q10. What would you expect the following program to print in a little endian
system? Assume to variable x is located at memory address 0x10008000.
#include <stdio.h>
main ()
{
unsigned long int x = 0x12345678;
unsigned char *p = (unsigned char *)&x;
int i;