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
21. What is the advantage of using #define over const?
- Type checking
- Memory allocation
- Scope
- No memory allocation
24. How to make a constant floating point value?
- const 3.14;
- const float pi = 3.14;
- constant 3.14;
- float const = 3.14;
25. What is the problem with: const int x; x=10;?
- No problem
- Missing semicolon
- Redeclaration
- Cannot assign to const variable
26. Which is correct for constant array?
- const int arr[5];
- int const arr[5];
- const arr[5];
- Both 1 and 2
27. What does const in function parameter mean?
- Parameter is constant
- Parameter cannot be modified
- Parameter is read-only
- All of the above
28. How to define multiple constants in one line?
- const int a,b,c=10;
- const int a=1,b=2,c=3;
- const int a;b;c;
- const int a=b=c=5;
29. What is enum constant in C?
- Integer constant with names
- Floating point constant
- String constant
- Character constant
30. Which is true about #define constants?
- Type checked
- Memory allocated
- No type checking
- Cannot be used in expressions