Skip to main content

Introduction to Programming MCQs with Answers

Practice important Introduction to Programming MCQs with answers and explanations.

Multiple Choice Questions

Q141: How can you modify a function to handle negative values for an argument in C?
  • A: Use an if statement inside the function
  • B: Change the argument type to float
  • C: Initialize the argument to zero
  • D: None of the above
View Answer
A

Q142: What is the default return type of a function in C if no return type is specified?
  • A: int
  • B: void
  • C: float
  • D: char
View Answer
A

Q143: What does the following function declaration signify: double raiseToPow(double x, int power);?
  • A: Function to raise x to power
  • B: Function to calculate power of x
  • C: Function to return the square of x
  • D: Function to convert x to power
View Answer
A

Q144: What does the void return type signify in a function?
  • A: Function does not return a value
  • B: Function always returns void
  • C: Function returns a double
  • D: Function returns an integer
View Answer
A

Q145: What does the term call by value mean in C?
  • A: Passing the actual value to the function
  • B: Passing a reference to the function
  • C: Passing the address of the variable
  • D: Passing a copy of the value to the function
View Answer
D

Q146: What is the output of square(3) + square(4) if the square function returns the square of a number?
  • A: 25
  • B: 49
  • C: 16
  • D: 41
View Answer
D

Q147: In which scenario would you use the return keyword in a function?
  • A: To end the function execution and return a value
  • B: To start a new function
  • C: To define local variables in a function
  • D: To continue execution after a function
View Answer
A

Q148: What is the primary purpose of using header files in C?
  • A: To define the main function
  • B: To include all function prototypes and constants
  • C: To store local variables
  • D: To manage dynamic memory
View Answer
B

Q149: What directive is used to include a header file in a C program?
  • A: #include
  • B: #define
  • C: #import
  • D: #use
View Answer
A

Q150: What does the #define directive do?
  • A: Creates a variable
  • B: Defines a constant or macro
  • C: Declares a function
  • D: Includes a library
View Answer
B

Test Your Knowledge

Take a timed quiz on Introduction to Programming

🚀 Start Quiz Now