wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

C function

Total questions: 17

Worksheet time: 10mins

Name
Class
Date
1.

A function that has no return type starts with:

a)

int

b)

void

c)

Arguments

d)

Braces

2.

True or False. We can call functions inside of other functions.

a)

True

b)

False

3.

How many times will the program print "SRM"

#include<stdio.h>


int main()

{

printf("SRM");

main();

return 0;

}

a)

Zero

b)

till stack overflows

c)

Error

d)

-1

4.

What is the output of this C code?


void m()

{

printf("hi");

}

void main()

{

m();

}

a)

hi

b)

runtime error

c)

none

d)

hi hi

5.

How many values can a C Function return at a time.?

a)

1

b)

As many

c)

None

d)

Max of 3 values

6.

int show();


void main()

{

int a;

a=show();

printf("%d", a);

}


int show()

{

return 15.5;

return 35;

}

a)

35

b)

15.5

c)

15

d)

None

7.

Which of the following can never be sent by call-by-value?

a)

a) Variable

b)

b) Array

c)

Integer

d)

Float

8.

Arguments that take input by user before running a program are called?

a)

Main function arguments

b)

Main arguments

c)

Command-Line arguments

d)

Parameterized arguments

9.

What are mandatory parts in function declaration?

a)

return type,function name

b)

return type,function name,Parameters

c)

none

d)

Function name

10.

What will be the output of the  following code?                                

 void main()

      {

                      fun();

        }

void fun()

      {

                      static int x=3;

                      printf(“%d ”,x);

                      if(--x)

                       fun();

           }

a)

Error in code

b)

3 2 1

c)

3 2 1 0

d)

3 3 3

e)

Infinite loop

11.

What is the output of the below code?        

     #include <stdio.h>

int main()

{

   printf("%d", main);  

   return 0;

}

a)

Address of main function

b)

Compiler Error

c)

Runtime Error

d)

Some random address

12.

Choose correct statement about Functions in C Language.

a)

A Function is a group of c statements which can be reused any number of times.

b)

Every Function has a return type.

c)

Every Function may no may not return a value.

d)

All the above.

13.

Choose a correct statement about C Function.?

main()

{

printf("Hello");

}

a)

"main" is the name of default must and should Function.

b)

main() is same as int main()

c)

By default, return 0 is added as the last statement of a function without specific return type.

d)

All the above

14.

Self FunctionA function which calls itself is called a ___ function.

a)

Self Function

b)

Auto function

c)

Recursive function

d)

Static function

15.

What is the output of C Program with functions.?

int main() {

show();

printf("BANK ");

return 0;

}

void show()

{ printf("CURRENCY ");

}

a)

CURRENCY BANK

b)

BANK CURRENCY

c)

BANK

d)

compiler error

16.

What are types of Functions in C Language?

a)

Library

b)

user defined

c)

Both

d)

none of the above

17.

Choose a correct statement about C language arrays.

a)

An array size can not changed once it is created.

b)

Array element value can be changed any number of times

c)

To access Nth element of an array students, use students[n-1] as the starting index is 0.

d)

All the above