Skip to main content

Important Introduction to Programming Short Questions

Chapter: 9
Question 1:
What is the purpose of a function header?
Answer: A function header in C specifies the return type, function name, and argument list, serving as the declaration of the function.
Chapter: 9
Question 2:
What is the significance of the 'return' keyword in a function?
Answer: The 'return' keyword in a function returns a value to the calling program and exits the function.
Chapter: 9
Question 3:
What does the return type 'void' signify in a function?
Answer: The return type 'void' indicates that the function does not return any value to the calling program.
Chapter: 9
Question 4:
What rules apply to naming a function in C?
Answer: Function names in C should follow the same naming conventions as variables and should be self-explanatory to describe the function’s purpose.
Chapter: 9
Question 5:
What is an argument list in a function?
Answer: An argument list contains the parameters passed to a function, which are required for the function to perform its task.
Chapter: 9
Question 6:
What does 'call by value' mean in function calling?
Answer: 'Call by value' means that a copy of the actual parameters is passed to the function, and changes made to parameters inside the function do not affect the original values.
Chapter: 9
Question 7:
What does 'call by reference' mean in function calling?
Answer: 'Call by reference' means that the function can modify the actual variables passed to it, as it receives the memory address of the arguments.
Chapter: 9
Question 8:
What is the difference between declaration and definition of a function?
Answer: Declaration specifies the function's prototype, including return type and arguments, while definition includes the actual code that executes the function's task.
Chapter: 9
Question 9:
Why is it important to declare a function before using it?
Answer: A function must be declared before use so that the compiler knows its return type and arguments, otherwise, it will result in a compilation error.
Chapter: 9
Question 10:
What is a function prototype?
Answer: A function prototype is a declaration of a function that includes its return type, name, and parameters, used to inform the compiler about the function before its actual definition.