Program based on loops and functions

 Here are the some programs based on loops and functions .I  am giving you some program for the practice topic wise .I am also giving you some MCQS questions based on these topics .So after solving these questions your doubts will be clear related to these topic.


Here are some sample questions  and you can download the pdf by clicking on the link

C- Program based on function:-

  • 1) Write a function to calculate factorial of a number.(Takes Something, Returns Something).

  • 2) Write a function to calculate area of a circle.(Takes Something, Returns Something)

  • 3) Write a program to print System Date.

  • 4) Write a function to calculate sum of first N natural numbers. (all four ways: TNRN, TSRN, TNRS, TSRS).


C program based on loops:-

  • 1) Write a program to print Your name 5 times on the screen.

  • 2) Write a program to print first 10 natural numbers.

  • 3) Write a program to print first 10 natural numbers in reverse order.

  • 4) Write a program to print first N natural numbers. (N is given by user)

  • 5) Write a program to print first N natural numbers in reverse order. (N is given by user).


MCQS :-

1) Choose a right C Statement.

A) Loops or Repetition block executes a group of statements repeatedly.

B) Loop is usually executed as long as a condition is met.

C) Loops usually take advantage of Loop Counter

D) All the above.

2) Loops in C Language are implemented using.?

A) While Block

B) For Block

C) Do While Block

D) All the above

3) Which loop is faster in C Language, for, while or Do While.?

A) for

B) while

C) do while

D) All work at same speed

4) Choose correct C while loop syntax.

A) 

while(condition)

{

    //statements

}

B) 

{

    //statements

}while(condition)

C) 

while(condition);

{

    //statements

}

D) 

while()

{

    if(condition)

    {

        //statements

    }

}

5) Choose a correct C for loop syntax.

A) 

for(initalization; condition; incrementoperation)

{

    //statements

}

B) 

for(declaration; condition; incrementoperation)

{

    //statements

}

C) 

for(declaration; incrementoperation; condition)

{

    //statements

}

D) 

for(initalization; condition; incrementoperation;)

{

    //statements

}

Practice question and program :–

Recommended Post:

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-

Key points:-

 MCQs:-

Leave a Reply

Your email address will not be published.