CPP

CPP

Macros has 6 Questions

which keyword is used to define the macros in c++?

macro
define
#define
none of the mentioned
How many types of macros are there in c++?

1
2
3 4) 4 View Answer
Answer:b Explanation:There are two types of macros. They are object-like and function-like.

4. What is the mandatory preprosessor directive for c++? a) #define b) #include #undef

none of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     int main ()
  4.     {
  5.         cout << "Value of __LINE__ : " << __LINE__ << endl;
  6.         cout << "Value of __FILE__ : " << __FILE__ << endl;
  7.         cout << "Value of __DATE__ : " << __DATE__ << endl;
  8.         cout << "Value of __TIME__ : " << __TIME__ << endl;
  9.         return 0;
  10.     }

5
Details about your file
compile time error
none of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     #define MAX 10
  4.     int main()
  5.     {
  6.         int num;
  7.         num = ++MAX;
  8.         cout << num;
  9.         return 0;
  10.     }

11
10
compile time error
none of the mentioned
What is the other name of the macro?

scripted directive
executed directive
link directive
none of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     #define SquareOf(x) x * x
  4.     int main()
  5.     {
  6.         int x;
  7.         cout << SquareOf(x + 4);
  8.         return 0;
  9.     }

16
64
compile time error
none of the mentioned