Advertisements

Search results for else

Example:[1]

            What is the output of the following program?
#include <stdio.h>
int func(unsigned int );
void main( void )
{
	unsigned int num = 5;
	int res;
	res = func(num);
	printf("The result is:%d\n", res);
}
int func(unsigned int i)
{
	if(i <= 1)
	{
		return 1;		
	}else
	{
		return i * func(i-1);
	}
}
          
Option A:

            240
            
Option B:

            60
            
Option C:

            120
            
Option D:

            10
            
Correct Answer: option C
Example:[2]

            A state machine in c can be implemented by ___________?
          
Option A:

            Using an if else statements.
            
Option B:

            Using a switch case statements.
            
Option C:

            Using function pointers.
            
Option D:

            All mentioned above.
            
Correct Answer: option D

 Search Links


 Popular C search MCQs


 Popular C search examples