[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.

C Programming :: Functions - Discussion

Home > C Programming > Functions > MCQs Questions Discussion

5 / 53

What is the output of the following 'C' program?

#include<stdio.h>
void main(){
    int i=3,val;
    val=f(i)+ +f(i=1)+ +f(i-1);
    printf("%d",val);
}
int f(int num){
    return num*5;
}

A20

B30

C21

D31

ECompilation error

Answer: Option (Login/Signup)

Show Explanation

next i=1 then f(1) return 5

now f(1-1)=f(0) return 0

adding all : 15+5+0=20

 

Asked In :: Societe Generale

Post Your Answer Here:     

Reply    
Rate This: +0 -0
    Report


Report Error

Please Login First Click Here