Defining Symbolic Constants
Defining Symbolic Constants
○ a) include
○ b) define
○ c) const
○ d) typedef
○ Answer: b) define
2. What is the correct syntax for defining a symbolic constant PI with
the value 3.14159?
○ a) const PI = 3.14159;
○ b) define PI 3.14159;
○ c) #define PI 3.14159
○ d) #symbol PI = 3.14159
○ Answer: c) #define PI 3.14159
3. Symbolic constants are replaced by their values during:
○ a) Compilation
○ b) Linking
○ c) Preprocessing
○ d) Execution
○ Answer: c) Preprocessing
4. What is the advantage of using symbolic constants?
○ a) Improved readability
○ b) Easier maintenance
○ c) Both a and b
○ d) None of the above
○ Answer: c) Both a and b
5. Symbolic constants are also known as:
○ a) Variables
○ b) Macros
○ c) Functions
○ d) Pointers
○ Answer: b) Macros
6. Which of the following is an incorrect way to define a symbolic
constant?
7.
○ a) 5
○ b) 10
○ c) 2
○ d) 0
○ Answer: b) 10
8. Symbolic constants are typically written in:
○ a) Lowercase
○ b) Uppercase
○ c) CamelCase
○ d) snake_case
○ Answer: b) Uppercase
9. Can symbolic constants be used in expressions?
○ a) Yes
○ b) No
○ c) Only in simple expressions
○ d) Only in loops
○ Answer: a) Yes
10. What is the benefit of using symbolic constants for array sizes?