C Programming Questions and Answers – Sizeof Keyword – 1

This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Sizeof Keyword – 1”.

Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.

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

Answer: c
Explanation: None.

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

advertisement
advertisement
    #include <stdio.h>
    printf("%d", sizeof('a'));

a) 1
b) 2
c) 4
d) None of the mentioned
View Answer

Answer: c
Explanation: 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);
View Answer

Answer: a
Explanation: None.
advertisement

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

  1.     #include <stdio.h>
  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
View Answer

Answer: c
Explanation: None.
advertisement

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

Answer: d
Explanation: None.

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

Answer: c
Explanation: None.

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

Answer: b
Explanation: None.

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

Answer: c
Explanation: None.

Sanfoundry Global Education & Learning Series – C Programming Language.

To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.