Cpp: Inline Functions 8

6.
The following C++ code results in an error. State whether this statement is true or false.

#include <iostream>
using namespace std;

void f(double b)
{
cout<<b;
}
int main()
{
inline f(100.56);
return 0;
}

a) True
b) False

7.
What will be the output of the following C++ code?

#include <iostream>
using namespace std;

inline int max(int a, int b)
{
return a > b ? a : b;
}
int main()
{
int m;
m=max(-6,-5);
cout<<m;
return(0);
}

a) -6
b) -5
c) Junk value
d) Error

8.
What will be the output of the following C code?

#include <iostream>
using namespace std;
#define inline
inline f(char a)
{
#ifdef inline
cout<<a;
#endif
}
int main()
{
f(‘a’);
return(0);
}

a) Error
b) a
c) No error but nothing will be printed as output
d) 97

9.
What will be the output of the following C++ code?

#include <iostream>
using namespace std;

inline int min(int a, int b)
{
return a < b ? a : b;
}
main()
{
int m;
m=min(3,-5);
cout<<m;
}


a) Error
b) 3
c) -5
d) Junk value