aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java Constructors and Design Patterns Quiz
  • What is the output of the following code snippet ?? void ...
Multiple choice technology programming languages

What is the output of the following code snippet ?? void main() { printf("%d", sizeof(2.0)); }

  1. 2

  2. 4

  3. 8

  4. 10

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

sizeof(2.0) evaluates to sizeof(double) because 2.0 is a double literal by default in C. On most modern systems, a double occupies 8 bytes, not 4 (float) or 2 (some int types).

Keep practicing — related questions

  • What will be the output of the following set of code after execution? void main() { printf(“%d %d”,sizeof('...
  • void main() { printf("%d"t, sizeof(7.5)); printf("%d"t, sizeof(80000)); printf("%d"t, sizeof('B')); }. Whic...
  • void main() { int x; x=sizeof(!7.8); printf("%d",x); }
  • What will be the output of the following function? main() { char *p; printf(%d %d ,sizeof(*p),sizeof(p)); }
  • What will be the output of the following program : void main() { printf("%d",sizeof(integer)); }
  • What will be the output of the following set of codes after execution? void main() { printf(“%d %d %d ”,56,...
  • What is the output ? main() { char *p; printf("%d %d ",sizeof(*p),sizeof(p)); }
  • What is the output of the following code fragment? int i = 10; if(i = printf(“%d”, i)) { printf(“%d ”, i); }
Play the full quiz 🎤 Practise this topic out loud

Practice this topic

  • Programming Languages and Compilers (2284 questions)
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy