21 

, 2.

22

, 3.

25 

, 4.

27

">
MCQs > IT & Programming > Embedded C >

The following program is based on a recursive algorithm. Analyze the code and choose the correct output from the given options.

#include<stdio.h>

main( )

{ static int a,f;

a=5.2; f=1;

f = res( a ) ;

f++;

printf ( "%d", f++ ) ;

}

res ( int x )

{ static int f ;

if ( x == 1 )

return ( 1 ) ;

else

f = x/4.5 + x + res ( x – 1 ) + 2 ;

return ( f++ ) ;

}


Embedded C MCQs

The following program is based on a recursive algorithm. Analyze the code and choose the correct output from the given options.

#include<stdio.h>

main( )

{ static int a,f;

a=5.2; f=1;

f = res( a ) ;

f++;

printf ( "%d", f++ ) ;

}

res ( int x )

{ static int f ;

if ( x == 1 )

return ( 1 ) ;

else

f = x/4.5 + x + res ( x – 1 ) + 2 ;

return ( f++ ) ;

}


Answer

Correct Answer:

25 

Explanation:

Note: This Question is unanswered, help us to find answer for this one

Embedded C Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

More Embedded C MCQ Questions

search

Embedded C Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it