Functions in C

This quiz will test your understanding of functions in C programming. This quiz covers various questions related to functions in C and their working.

Last Updated :
Discuss
Comments

Question 1

What is a function in C?


  • A keyword

  • A type of variable

  • A block of code that performs a specific task.

  • A preproccessor directive

Question 2

Which of the following is the correct way to declare a function in C?


  • func int ();

  • int function();

  • int = function();

  • function int ();

Question 3

In C, what is the meaning of following function prototype with empty parameter list.

C
void fun();
  • Function can only be defined without any parameter.


  • Function can be defined with any number of parameters of any types.


  • Function can be defined with any number of integer parameters.


  • Function can be defined with one integer parameter.


Question 4

What keyword is used to return a value from a function?


  • break

  • return

  • switch

  • continue

Question 5

What is the purpose of function prototypes in C?

  • To define functions


  • To declare functions before use


  • To remove functions

  • To call functions


Question 6

Which of the following statements about function arguments is FALSE?


  • Arguments are passed by value by default in C


  • You can pass arrays to functions


  • C allows passing functions as arguments


  • Arguments can be modified directly in the caller


Question 7

What happens if a function is called before it is defined and declared?


  • The program will run normally


  • A runtime error will occur

  • A compiler error will occur

  • The function will be skipped

Question 8

Which of the following can be used to achieve "pass by reference" in C?


  • Arrays

  • Global Variables

  • Pointers

  • Strucctures

Question 9

Which function is always called when a C program starts execution?

  • start()

  • init()

  • main()

  • begin()

Question 10

Identify the correct statement about the void return type.


  • void means the function returns an int

  • void means the function can return anything

  • void means the function does not return any value

  • void is used to skip a function call

Tags:

There are 22 questions to complete.

Take a part in the ongoing discussion