constants Questions and Answers
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
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
14. What will be the output of: #define PI 3.14 printf("%f", PI);
- 3.14
- 0
- PI
- Error
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;
16. What is the value of a const variable that is not initialized?
- 0
- Garbage value
- Compiler error
- NULL
19. How to define a constant pointer in C?
- int const *ptr;
- const int *ptr;
- int *const ptr;
- const *int ptr;