Sail E0 Webinar
Question


What is te output of this program?


1.
#include
2.
using namespace std;
3.
int add(int first, int second)
4.
{
5.
return first + second + 15;
6.
}
7.
int operation(int first, int second, int
(*functocall)(int, int))
8.
{
9.
return (*functocall)(first, second);
10.
}
11.
int main()
12.
{
13.
int a;
14.
int (*plus)(int, int) = add;
15.
a = operation(15, 10, plus);
16.
cout
Options:
A .  25
B .  35
C .  40
D .  45
Answer: Option C

In this program, we are adding two numbers with 15, So we got the output as 40.
Output:
$ g++ pfu2.cpp
$ a.out
40



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers