constants Questions and Answers

Take Exam

Constants are one of the most fundamental topics in C programming. This set of constants in C language questions with answers covers the use and declaration of constants, symbolic names, and constant data types. For students preparing for GATE, Infosys, or Tech Mahindra placement exams, understanding constants helps you write more reliable and readable code. These C programming MCQs are designed to strengthen your basics in data storage, syntax, and memory management. Each question includes clear explanations to help you differentiate between literals, symbolic constants, and macros effectively.

constants

Showing 10 of 30 questions

11. Which of the following is a valid way to define a constant in C?

  • const int x = 5;
  • constant int x = 5;
  • int const x = 5;
  • Both 1 and 3
Show Answer Report

12. What is the correct way to define a symbolic constant in C?

  • #define MAX 100
  • const MAX = 100;
  • constant MAX 100
  • def MAX 100
Show Answer Report

13. Which keyword is used to define constants in C?

  • constant
  • fixed
  • const
  • final
Show Answer Report

14. What will be the output of: #define PI 3.14 printf("%f", PI);

  • 3.14
  • 0
  • PI
  • Error
Show Answer Report

15. Which of the following is NOT a valid constant definition?

  • const int x = 10;
  • #define Y 20
  • const float z;
  • int const w = 30;
Show Answer Report

16. What is the value of a const variable that is not initialized?

  • 0
  • Garbage value
  • Compiler error
  • NULL
Show Answer Report

17. Which of the following is a string constant?

  • "Hello"
  • 'A'
  • 100
  • 3.14
Show Answer Report

18. What is the type of constant 100?

  • int
  • long
  • char
  • float
Show Answer Report

19. How to define a constant pointer in C?

  • int const *ptr;
  • const int *ptr;
  • int *const ptr;
  • const *int ptr;
Show Answer Report

20. Which of these is a character constant?

  • 'A'
  • "A"
  • A
  • 65
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test