C- Declarations and Initializations Questions and Answers

Practice Mode
Showing 10 of 49 questions
Q41
What is the return type of malloc() function?
  • A int*
  • B void*
  • C float*
  • D char*
Answer: Option B
Explanation: malloc returns void pointer which can be cast to any type.
Q42
Which operator is used to get the address of a variable?
  • A *
  • B #
  • C &
  • D %
Answer: Option C
Explanation: Ampersand gives the memory address of a variable.
Q43
What is the value of an uninitialized local variable?
  • A 0
  • B 1
  • C Garbage value
  • D NULL
Answer: Option C
Explanation: Local variables contain garbage values if not initialized.
Q44
Which is used for logical NOT operation?
  • A &
  • B |
  • C !
  • D ~
Answer: Option C
Explanation: Exclamation mark is the logical NOT operator.
Q45
What is the format specifier for double?
  • A %d
  • B %f
  • C %lf
  • D %Lf
Answer: Option C
Explanation: %lf is used for double in printf/scanf.
Q46
Which header file is needed for printf()?
  • A stdlib.h
  • B stdio.h
  • C conio.h
  • D math.h
Answer: Option B
Explanation: stdio.h contains declaration for standard I/O functions.
Q47
What is the scope of a local variable?
  • A Whole program
  • B Within the function
  • C Within the file
  • D Global scope
Answer: Option B
Explanation: Local variables are accessible only within their block.
Q48
Which is the correct way to declare a function?
  • A function name(){}
  • B int function_name();
  • C declare function();
  • D function int();
Answer: Option B
Explanation: Function declaration includes return type and parameters.
Q49
What does "auto" storage class indicate?
  • A External storage
  • B Automatic storage
  • C Static storage
  • D Register storage
Answer: Option B
Explanation: Auto is default for local variables with automatic storage.
Questions and Answers for Competitive Exams Various Entrance Test