250+ TOP MCQs on Sizeof Keyword and Answers

C programming questions on “Sizeof”. One shall practice these questions to improve their C programming skills needed for various interviews (campus interviews, walkin interviews, company interviews), placements, entrance exams and other competitive exams. These questions can be attempted by anyone focusing on learning C Programming language. They can be a beginner, fresher, engineering graduate or an experienced IT professional. Our C programming questions come with detailed explanation of the answers which helps in better understanding of C concepts.

Here is a listing of C programming questions on “Sizeof” along with answers, explanations and/or solutions:

1. What is the sizeof(char) in a 32-bit C compiler?
a) 1 bit
b) 2 bits
c) 1 Byte
d) 2 Bytes
Answer: c
Clarification: None.

2. What will be the output of the following C code?

    #include 
    printf("%d", sizeof('a'));

a) 1
b) 2
c) 4
d) None of the mentioned
Answer: c
Clarification: None.

3. Size of an array can be evaluated by __________

(Assuming array declaration int a[10];)

a) sizeof(a);
b) sizeof(*a);
c) sizeof(a[10]);
d) 10 * sizeof(a);
Answer: a
Clarification: None.

4. What will be the output of the following C code?

  1.     #include 
  2.     union temp
  3.     {
  4.         char a;
  5.         char b;
  6.         int c;
  7.     }t;
  8.     int main()
  9.     {
  10.         printf("%d", sizeof(t));
  11.         return 0;
  12.     }

a) 1
b) 2
c) 4
d) 6
Answer: c
Clarification: None.

5. Which of the following is not an operator in C?
a) ,
b) sizeof()
c) ~
d) None of the mentioned
Answer: d
Clarification: None.

6. Which among the following has the highest precedence?
a) &
b) <<
c) sizeof()
d) &&
Answer: c
Clarification: None.

7. What is the sizeof(void) in a 32-bit C?
a) 0
b) 1
c) 2
d) 4
Answer: b
Clarification: None.

8. What type of value does sizeof return?
a) char
b) short
c) unsigned int
d) long
Answer: c
Clarification: None.

Leave a Reply

Your email address will not be published. Required fields are marked *