C- Declarations and Initializations Questions and Answers

Practice Mode
Showing 10 of 49 questions
Q21
What does the volatile keyword indicate?
  • A Variable cannot be changed
  • B Variable may change unexpectedly
  • C Variable is constant
  • D Variable is stored in register
Answer: Option B
Explanation: volatile tells compiler that variable may change unexpectedly.
Q22
Which of the following is not a primitive data type in C?
  • A int
  • B float
  • C char
  • D array
Answer: Option D
Explanation: Array is a derived data type, not primitive.
Q23
What is the maximum length of a variable name in C?
  • A 31 characters
  • B 63 characters
  • C 255 characters
  • D No fixed limit
Answer: Option A
Explanation: C standard specifies minimum requirements for identifier length.
Q24
Which of the following is a valid constant declaration?
  • A const int x = 5;
  • B #define x 5
  • C int const x = 5;
  • D All of the above
Answer: Option D
Explanation: Constants can be defined using const keyword or #define.
Q25
What is the scope of a local variable?
  • A Entire program
  • B Within the function
  • C Within the file
  • D Global scope
Answer: Option B
Explanation: Local variables are accessible only within their block.
Q26
Which operator is used to get the address of a variable?
  • A *
  • B &
  • C @
  • D #
Answer: Option B
Explanation: & operator returns the memory address of a variable.
Q27
What is the output of: int x = 5; printf("%d", x++);
  • A 5
  • B 6
  • C 0
  • D Undefined
Answer: Option A
Explanation: Post-increment returns original value then increments.
Q28
Which of the following is a valid array declaration?
  • A int arr[];
  • B int arr[5];
  • C int arr[] = {1,2,3};
  • D Both B and C
Answer: Option D
Explanation: Array declarations require size or initialization.
Q29
What does the register keyword suggest to the compiler?
  • A Store in heap
  • B Store in register
  • C Make variable constant
  • D Make variable global
Answer: Option B
Explanation: register suggests storing variable in CPU register for faster access.
Q30
Which of the following is not a valid C variable name?
  • A 1number
  • B number1
  • C _number
  • D Number
Answer: Option A
Explanation: Variable names cannot start with a digit in C.
Questions and Answers for Competitive Exams Various Entrance Test