C- Declarations and Initializations Questions and Answers

Take Exam

Understanding C Declarations and Initializations is fundamental for mastering C programming. These concepts are frequently covered in programming questions and answers for placement tests and technical interviews at companies like TCS, Infosys, and Wipro. Declarations define variables, while initializations assign values to them, both ensuring efficient memory and data handling in C. This guide provides C programming MCQs and practical examples that clarify variable scope, storage classes, and initialization rules. Ideal for both beginners and job seekers, it strengthens your coding logic and interview readiness with real-world examples and practice problems.

C- Declarations and Initializations

Showing 10 of 49 questions

11. What is the default value of an uninitialized local variable in C?

  • 0
  • NULL
  • Garbage value
  • 1
Show Answer Report

12. Which keyword is used to define a constant in C?

  • constant
  • define
  • const
  • fixed
Show Answer Report

13. What is the size of int data type in C?

  • 2 bytes
  • 4 bytes
  • 8 bytes
  • Compiler dependent
Show Answer Report

14. Which of the following is not a valid C identifier?

  • my_var
  • _var
  • 2ndvar
  • var2
Show Answer Report

15. What does the extern keyword do?

  • Defines a new variable
  • Declares a variable defined elsewhere
  • Makes variable constant
  • Allocates memory for variable
Show Answer Report

16. Which storage class has the longest lifetime?

  • auto
  • register
  • static
  • extern
Show Answer Report

17. What is the output of: printf("%d", sizeof(char));

  • 1
  • 2
  • 4
  • 8
Show Answer Report

18. Which of the following is a valid way to declare and initialize a string?

  • char str[] = "Hello";
  • char str = "Hello";
  • string str = "Hello";
  • char *str = 'H';
Show Answer Report

19. What is the value of an uninitialized global variable?

  • 0
  • Garbage value
  • NULL
  • Undefined
Show Answer Report

20. Which of the following is a valid floating point declaration?

  • float f = 3.14;
  • float f = 3.14f;
  • double d = 3.14;
  • All of the above
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test