Constant in C Programming MCQ Questions and Answers
1. In C, a constant that represents a single character is known as a
A) String constant
B) Character constant
C) Integer constant
D) Symbolic constant
Answer: B
2. Which of the following is a valid integer constant in C?
A) 07AB
B) 0x
C) 0x2A
D) 2H
Answer: C
3. The constant ‘A’ in C has a data type of
A) int
B) char
C) int (character constant is of type int)
D) unsigned char
Answer: C
4. A constant defined as #define PI 3.14 is evaluated
A) At runtime
B) At compile time
C) During linking
D) During execution
Answer: B
5. The string constant “C Programming” ends with
A) newline character
B) null character ‘\0’
C) carriage return
D) space character
Answer: B
6. Which of the following is a floating-point constant?
A) 25
B) 2.5E2
C) 0x1F
D) ‘2.5’
Answer: B
7. The suffix L or l after a numeric constant in C indicates
A) Long integer constant
B) Float constant
C) Double constant
D) Character constant
Answer: A
8. The constant 0xA represents
A) Decimal 8
B) Decimal 10
C) Decimal 12
D) Decimal 15
Answer: B
9. Which of the following is a valid octal constant in C?
A) 89
B) 9O
C) 071
D) 0x71
Answer: C
10. A symbolic constant in C is defined using
A) const keyword
B) #define directive
C) typedef
D) enum
Answer: B
11. Which keyword is used to declare a variable as constant in C?
A) define
B) const
C) static
D) register
Answer: B
12. In C, which of the following constants cannot be modified during program execution?
A) Variable declared without const
B) Macro
C) Constant declared with const keyword
D) Variable declared inside main
Answer: C
13. A hexadecimal constant in C must begin with
A) 0b or 0B
B) 0
C) 0x or 0X
D) #x
Answer: C
14. The constant ‘A’ has ASCII value
A) 64
B) 65
C) 66
D) 67
Answer: B
15. Which of the following represents a valid string constant?
A) ‘C Programming’
B) “C Programming
C) “C Programming”
D) C Programming
Answer: C
16. Constants like 3.14 are by default treated as
A) float
B) double
C) long double
D) real
Answer: B
17. What is the value of constant expression 10 / 3 in C?
A) 3.333
B) 3
C) 4
D) 0
Answer: B
18. A constant enclosed within single quotes is called
A) String constant
B) Character constant
C) Numeric constant
D) Literal constant
Answer: B
19. What type of constant is ‘5’?
A) Integer constant
B) Character constant
C) String constant
D) Floating constant
Answer: B
20. The escape sequence \n represents
A) tab
B) backspace
C) newline
D) null
Answer: C
21. Which of the following is an invalid character constant?
A) ‘AB’
B) ‘A’
C) ‘\n’
D) ‘9’
Answer: A
22. Which of the following is not a valid constant in C?
A) 0.25
B) ‘B’
C) “Hello”
D) 05.6.7
Answer: D
23. The suffix U or u denotes
A) short integer
B) unsigned integer
C) long integer
D) double precision
Answer: B
24. The escape sequence \t stands for
A) newline
B) horizontal tab
C) vertical tab
D) space
Answer: B
25. The constant expression 5 % 2 evaluates to
A) 2.5
B) 1
C) 3
D) 0
Answer: B
26. What is the value of ‘A’ + 1?
A) ‘A1’
B) 66
C) 65
D) ‘B’
Answer: B
27. Which is not a type of constant in C?
A) Integer
B) Floating-point
C) Variable constant
D) Character
Answer: C
28. A constant value used directly in the program without a variable is called
A) symbolic constant
B) literal constant
C) runtime constant
D) static constant
Answer: B
29. Which of the following escape sequences is valid?
A) \y
B) \c
C) \n
D) \rts
Answer: C
30. The constant ‘0’ has an integer value of
A) 0
B) 48
C) 49
D) 1
Answer: B
31. A constant defined using #define is replaced by
A) the preprocessor
B) compiler
C) linker
D) loader
Answer: A
32. Constants defined with const are
A) preprocessor constants
B) typed constants
C) macros
D) literals
Answer: B
33. A constant representing 5 kilometers written as #define KM 5 is
A) typed constant
B) untyped constant
C) runtime constant
D) enum constant
Answer: B
34. Which of the following defines a floating constant explicitly as float type?
A) 2.3
B) 3.4e2
C) 2.3F
D) 3.5D
Answer: C
35. The character constant ‘\0’ represents
A) zero integer
B) null character
C) newline
D) space
Answer: B
36. The keyword const can be used with
A) only integers
B) any data type
C) only floats
D) only characters
Answer: B
37. Which constant represents true in C language?
A) 0
B) NULL
C) 1
D) -1
Answer: C
38. Which of the following constants is of type long double?
A) 2.5
B) 3.5F
C) 3.5L
D) 2.5D
Answer: C
39. A string constant “Hi” actually contains how many characters?
A) 2
B) 3
C) 1
D) 4
Answer: B
40. Which of the following defines a constant in a more readable way?
A) const int = 5;
B) const = 5;
C) const int MAX = 5;
D) define MAX 5;
Answer: C
41. Which of the following is an invalid numeric constant in C?
A) 0.0
B) 07
C) 08
D) 0x10
Answer: C
42. The octal constant 012 in decimal equals
A) 10
B) 10
C) 11
D) 12
Answer: B
43. The prefix 0 in a numeric constant represents
A) Octal number system
B) Hexadecimal number system
C) Decimal number system
D) Binary number system
Answer: A
44. Which of the following is a valid binary constant in C (C99 or later)?
A) 0x10
B) 010
C) 0b1010
D) b1010
Answer: C
45. Which of the following defines a constant correctly?
A) define int MAX = 10;
B) const MAX = 10;
C) #define MAX 10
D) #const MAX 10
Answer: C
46. Which of the following is NOT an escape sequence?
A) \n
B) \t
C) \r
D) \c
Answer: D
47. Which of the following constants is equivalent to 2.0e3?
A) 0.002
B) 200.0
C) 2000.0
D) 20.0
Answer: C
48. What is the type of constant 10U?
A) int
B) unsigned int
C) long int
D) float
Answer: B
49. The constant expression sizeof(‘A’) returns
A) 1
B) 4
C) 2
D) depends on platform
Answer: B
50. Which escape sequence is used for backslash?
A) \
B) \b
C) \r
D) \\
Answer: D
51. Which of the following constant declarations is invalid?
A) const int a = 10;
B) const float b = 3.14;
C) const char c = ‘A’;
D) const int 3a = 10;
Answer: D
52. The constant ‘A’ and “A” differ in that
A) Both are same
B) Both are integers
C) One is character, other is string
D) Both are characters
Answer: C
53. Which constant represents backspace?
A) \r
B) \b
C) \t
D) \a
Answer: B
54. The constant “Hello” occupies
A) 4 bytes
B) 6 bytes
C) 5 bytes
D) 7 bytes
Answer: B
55. The suffix f or F after a constant represents
A) float constant
B) double constant
C) long double constant
D) int constant
Answer: A
56. The macro constant #define VALUE 100 can be replaced by
A) a variable
B) runtime constant
C) literal 100 during preprocessing
D) const variable
Answer: C
57. Which of the following constants is stored in read-only memory?
A) int variable
B) pointer
C) string constant
D) array variable
Answer: C
58. The character constant ‘\t’ occupies
A) 1 byte
B) 2 bytes
C) 4 bytes
D) variable
Answer: A
59. The constant 0xF equals
A) 12
B) 14
C) 15
D) 16
Answer: C
60. Which of these constants is valid?
A) 0b12
B) 0xG
C) 00A
D) 0x1A
Answer: D
61. Which of these constants represents scientific notation?
A) 5.67
B) 5.67E2
C) 567
D) 0x5.67
Answer: B
62. Which of the following is true for a string constant in C?
A) It is mutable
B) It is a single character
C) It is an array of characters ending with ‘\0’
D) It does not require quotes
Answer: C
63. Which of the following constants is equivalent to ASCII bell?
A) \b
B) \a
C) \n
D) \r
Answer: B
64. The keyword const ensures that
A) Variable is static
B) Value cannot be modified
C) Memory is dynamically allocated
D) Variable is global
Answer: B
65. Which of the following is invalid?
A) const int a = 5;
B) #define 2MAX 10
C) #define VALUE 20
D) const char c = ‘B’;
Answer: B
66. The numeric constant 0xFF equals decimal
A) 254
B) 255
C) 256
D) 127
Answer: B
67. What is the value of constant expression 3 + 5 * 2?
A) 16
B) 13
C) 10
D) 11
Answer: B
68. What is the data type of 0.0f?
A) double
B) float
C) long double
D) int
Answer: B
69. What is the meaning of the constant ‘A’ + 2?
A) ASCII value of C
B) 67
C) 65
D) ‘C’
Answer: B
70. The constant #define MAX 10+5 when used in int x = MAX * 2; gives
A) 20
B) 25
C) 30
D) 15
Answer: A
71. The constant expression sizeof(“ABC”) returns
A) 3
B) 4
C) 5
D) 6
Answer: B
72. Which of the following is not a valid symbolic constant name?
A) MAX_VALUE
B) 2MAX
C) _LIMIT
D) PI_VALUE
Answer: B
73. Which constant represents carriage return?
A) \t
B) \n
C) \r
D) \b
Answer: C
74. The value of ‘B’ – ‘A’ is
A) 0
B) 1
C) 2
D) 66
Answer: B
75. Which type of constant can hold exponential values?
A) integer
B) character
C) floating-point
D) string
Answer: C
76. Which of the following is not allowed for const variables?
A) declaration
B) initialization
C) reassignment
D) definition
Answer: C
77. The constant ‘\\’ is used to represent
A) double quote
B) slash
C) backslash
D) null
Answer: C
78. The constant ‘A’ stored in memory takes
A) 2 bytes
B) 1 byte
C) 4 bytes
D) 8 bytes
Answer: B
79. The constant ‘\n’ is interpreted as
A) character n
B) newline
C) space
D) tab
Answer: B
80. The constant “A” occupies how many bytes?
A) 1
B) 2
C) 3
D) 4
Answer: B
81. Which of these constants is a long integer constant?
A) 25
B) 25.0
C) 25L
D) 25.0F
Answer: C
82. Which constant would be most appropriate for defining mathematical π?
A) const int PI = 3.14;
B) const float PI = 3.14f;
C) #define PI “3.14”
D) float const PI = “3.14”;
Answer: B
83. Which escape sequence produces a single quote in output?
A) ‘’
B) ”
C) ‘
D) \q
Answer: C
84. Which of the following constants indicates hexadecimal format?
A) 045
B) 1010
C) 0x45
D) 45H
Answer: C
85. What is the value of ‘a’ – ‘A’?
A) 25
B) 32
C) 26
D) 30
Answer: B
86. The null pointer constant is
A) 1
B) 0x1
C) 0
D) NULL pointer
Answer: C
87. The escape sequence \\n prints
A) new line
B) backslash followed by n
C) null
D) two lines
Answer: B
88. A constant declared as const int x = 10; is stored in
A) stack memory
B) read-only section
C) heap
D) global variable section
Answer: B
89. The constant “Hello\n” contains
A) 5 characters
B) 6 characters
C) 7 characters
D) 8 characters
Answer: C
90. What is the meaning of #define SIZE 10?
A) Variable declaration
B) Function definition
C) Macro constant definition
D) Storage class specifier
Answer: C
91. Which of the following constants is invalid?
A) 1.23E+5
B) 1.2E2.3
C) 0x1F
D) 012
Answer: B
92. Which constant represents double quotation mark?
A) \d
B) ‘
C) ”
D) \q
Answer: C
93. Which constant type cannot be declared using const keyword?
A) integer
B) float
C) char
D) macro
Answer: D
94. Which escape sequence represents vertical tab?
A) \t
B) \v
C) \n
D) \r
Answer: B
95. A constant defined by #define has
A) storage in memory
B) type checking
C) no data type
D) address
Answer: C
96. What is the value of constant ‘\0’ == 0?
A) false
B) true
C) undefined
D) compilation error
Answer: B
97. The constant “AB” is of type
A) char
B) int
C) array of char
D) pointer
Answer: C
98. The constant ‘%’ represents
A) character with ASCII 37
B) integer 5
C) division
D) symbol
Answer: A
99. Which constant represents audible alert (beep)?
A) \n
B) \r
C) \a
D) \t
Answer: C
100. Which constant type does 0x1.1p+3 represent (C99)?
A) integer
B) hexadecimal floating constant
C) octal constant
D) binary constant
Answer: B
