viewuser/2813/tichaona garaidenga

View question



Consider the C functions foo and bar given below: -gate computer science 2017

int foo(int val)
{
    int x = 0;
    while (val > 0)
    {
        x = x + foo(val--);
    }
    return val;
}

int bar(int val)
{
    int x = 0;
    while (val > 0)
    {
        x = x + bar(val-1);
    }
    return val;
}

Invocations of foo(3) and bar(3) will result in:

A) Return of 6 and 6 respectively
B) Infinite loop and abnormal termination respectively
C) Abnomal termination and infinite loop respectively
D) Both terminating abnormally


By:satyashiromani

Taged users:
|satyashiromani|vaishnavi-Deshpande|vivek25|milanyoyoyogmailcom|Umang|Raaghav-singhal|ThreeRed|Msshikhil|deepuckraj|Aparna-Dasgupta|Manisha12|Johnny|thegdx|leo||Naman-Nath|aksingh1818|Jessika-K|13priya|milan-ransingh|Amogh|Divyanshu-Changkakoti|Ashwath-Shetty|Aaditi|madachod|tichaona-garaidenga|ronald|akialwayz|jinsnjjose|dillu550

Likes:
|deepuckraj

Dislikes:
Be first to dislike this questionDelete|Like|Dislike|

Comments


Type your comment here



Join eduladder!