Skip to content
Related Articles

Related Articles

Algorithms Quiz | Sudo Placement [1.5] | Question 12

View Discussion
Improve Article
Save Article
  • Last Updated : 16 Aug, 2018

What will be the output of following code :




#include <iostream>
using namespace std;
  
#define x 5/2.0
#define y 3/2.0
  
  
// Function 1
int add(float a, float b){
    cout << "Function 1";
    return a + b;
}
  
// Function 2
int add(double a, double b){
    cout << "Function 2";
    return a + b;
}
  
// Function 3
int add(int a, int b){
    cout << "Function 3";
    return a + b;
}
  
// Driver Function
int main() {
      
    cout << add(x, y) << endl;
      
    return 0;
}


(A) Function 2 4
(B) Function 3 4
(C) Function 1 4
(D) None of these


Answer: (A)

Explanation:

Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!