71. What will happen while using pass by reference?
72. What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
namespace
{
int var = 10;
}
int main()
{
cout<<var;
}
#include <iostream>
#include <string>
using namespace std;
namespace
{
int var = 10;
}
int main()
{
cout<<var;
}
73. Which operator is used to signify the namespace?
74. which keyword is used to define the macros in c++?
75. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int operate (int a, int b)
{
return (a * b);
}
float operate (float a, float b)
{
return (a / b);
}
int main()
{
int x = 5, y = 2;
float n = 5.0, m = 2.0;
cout << operate(x, y) <<"\t";
cout << operate (n, m);
return 0;
}
#include <iostream>
using namespace std;
int operate (int a, int b)
{
return (a * b);
}
float operate (float a, float b)
{
return (a / b);
}
int main()
{
int x = 5, y = 2;
float n = 5.0, m = 2.0;
cout << operate(x, y) <<"\t";
cout << operate (n, m);
return 0;
}
76. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
#define PR(id) cout << "The value of " #id " is "<<id
int main()
{
int i = 10;
PR(i);
return 0;
}
#include <iostream>
using namespace std;
#define PR(id) cout << "The value of " #id " is "<<id
int main()
{
int i = 10;
PR(i);
return 0;
}
77. In which of the following we cannot overload the function?
78. What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int fun(int=0, int = 0);
int main()
{
cout << fun(5);
return 0;
}
int fun(int x, int y) { return (x+y); }
#include <iostream>
using namespace std;
int fun(int=0, int = 0);
int main()
{
cout << fun(5);
return 0;
}
int fun(int x, int y) { return (x+y); }
79. Which keyword is used to check exception in the block of code?
80. In which of the following cases inline functions may not word?
i. If the function has static variables.
ii. If the function has global and register variables.
iii. If the function contains loops
iv. If the function is recursive
i. If the function has static variables.
ii. If the function has global and register variables.
iii. If the function contains loops
iv. If the function is recursive
Read More Section(Functions and Procedures in C plus plus)
Each Section contains maximum 100 MCQs question on Functions and Procedures in C plus plus. To get more questions visit other sections.