Professional Documents
Culture Documents
ASSIGNMENT
I. MCQ [1 x 5 = 5]
3. What would be the size of the following union declaration? (Assuming size of double = 8, size of
int = 4, size of char = 1)
#include <stdio.h>
union uTemp
double a;
int b[10];
char c;
}u;
a) 4
b) 8
c) 40
d) 80
3. What will be the output of the following C code (Assuming size of int and float is 4)?
#include <stdio.h>
union
{
int ival;
float fval;
} u;
void main()
{
printf("%d", sizeof(u));
}
a) 16
b) 8
c) 4
d) 32
5. fwrite() can be used only with files that are opened in binary mode.
a) true
b) false
#include<stdio.h>
int main()
{
struct simp
{
int i = 6;
char city[] = "chennai";
};
struct simp s1;
printf("%d",s1.city);
printf("%d", s1.i);
return 0;
}
A. chennai 6
C. Runtime Error
D. Compilation Error