CSE MCQs :: C++ - MCQs
- which keyword is used to define the macros in c++?
- What is the mandatory preprosessor directive for c++?
-
What is the output of this program?
#include < iostream >
using namespace std;
#define MIN(a,b) (((a)<(b)) ? a : b)
int main ()
{
float i, j;
i = 100.1;
j = 100.01;
cout << "The minimum is " << MIN(i, j) << endl;
return 0;
}
-
What is the output of this program?
#include < iostream >
using namespace std;
int main ()
{
cout << "Value of __LINE__ : " << __LINE__ << endl;
cout << "Value of __FILE__ : " << __FILE__ << endl;
cout << "Value of __DATE__ : " << __DATE__ << endl;
cout << "Value of __TIME__ : " << __TIME__ << endl;
return 0;
}
-
What is the output of this program?
#include < iostream >
using namespace std;
#define SquareOf(x) x * x
int main()
{
int x;
cout << SquareOf(x + 4);
return 0;
}
-
What is the output of this program?
#include < iostream >
using namespace std;
#define PR(id) cout << "The value of " #id " is "<
int main()
{
int i = 10;
PR(i);
return 0;
}
-
What is the output of this program?
#include < iostream >
using namespace std;
#define MAX 10
int main()
{
int num;
num = ++MAX;
cout << num;
return 0;
}
- What is the other name of the macro?