cpp-programming-functions Related Question Answers

1. Which of the following function / type of function cannot be overloaded?





2. Which of the following function declaration is/are incorrect?






3. Where the default value of parameter have to be specified?





4. Which of the following function / types of function cannot have default parameters?





5. What will be the output of the following program? #include<iostream.h> long BixFunction(int x, int y = 5, float z = 5) { return(++x ++y + (int)++z); } int main() { cout<< BixFunction(20, 10); return 0; }






6. What will be the output of the following program? #include<iostream.h> int BixFunction(int a, int b = 3, int c = 3) { cout<< ++a ++b --c ; return 0; } int main() { BixFunction(5, 0, 0); return 0; }





7. What will be the output of the following program? #include<iostream.h> void MyFunction(int a, int b = 40) { cout<< " a = "<< a << " b = " << b << endl; } int main() { MyFunction(20, 30); return 0; }





8. Which of the following statement is correct about the program given below? #include<iostream.h> static int b = 0; void DisplayData(int x, int y = &b) { cout<< x << " " << y; } int main() { int a = 10, b = 20 ; DisplayData(&a, &b); return 0; }





9. What will be the output of the following program? #include<iostream.h> typedef void(FunPtr)(int); int Look(int = 10, int = 20); void Note(int); int main() { FunPtr ptr = Note; (ptr)(30); return 0; } int Look(int x, int y) { return(x + y % 20); } void Note(int x) { cout<< Look(x) << endl; }






10. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiaBix { public: void Bix(int x = 15) { x = x/2; if(x > 0) Bix(); else cout<< x % 2; } }; int main() { IndiaBix objIB; objIB.Bix(); return 0; }






11. Which of the following statement is correct about the program given below? #include<iostream.h> long GetNumber(long int Number) { return --Number; } float GetNumber(int Number) { return ++Number; } int main() { int x = 20; int y = 30; cout<< GetNumber(x) << " "; cout<< GetNumber(y) ; return 0; }






12. What will be the output of the following program? #include<iostream.h> struct MyData { public: int Addition(int a, int b = 10) { return (a = b + 2); } float Addition(int a, float b); }; int main() { MyData data; cout<<data.Addition(1)<<" "; cout<<data.Addition(3, 4); return 0; }






13. Which of the following statement is correct about the program given below? #include<iostream.h> int BixTest(int x, int y); int BixTest(int x, int y, int z = 5); int main() { cout<< BixTest(2, 4) << endl; return 0; } int BixTest(int x, int y) { return x y; } int BixTest(int x, int y, int z = 5) { return x y z; }





14. What will be the output of the following program? #include<iostream.h> class IndiabixSample { public: int a; float b; void BixFunction(int a, float b, float c = 100.0f) { cout<< a % 20 + c --b; } }; int main() { IndiabixSample objBix; objBix.BixFunction(20, 2.000000f, 5.0f); return 0; }






15. Which of the following statement is correct about the program given below? #include<iostream.h> void Tester(int xx, int yy = 5); class IndiaBix { int x; int y; public: void Tester(int xx, int yy = 5) { x = xx; y = yy; cout<< ++x % --y; } }; int main() { IndiaBix objBix; objBix.Tester(5, 5); return 0; }






16. Which of the following statement is correct about the program given below? #include<iostream.h> class PowerFinder { public: void Power(int x = 1, int y = 1) { int P = 1, i = 1; while(++i <= y) { P = x; } cout<< P << endl; } }; int main() { PowerFinder FP; FP.Power(2, 6); return 0; }






17. Which of the following statement is correct about the program given below? #include<iostream.h> void Tester(float xx, float yy = 5.0); class IndiaBix { float x; float y; public: void Tester(float xx, float yy = 5.0) { x = xx; y = yy; cout<< ++x % --y; } }; int main() { IndiaBix objBix; objBix.Tester(5.0, 5.0); return 0; }






18. Which of the following statement is correct about the program given below? #include<iostream.h> const double BixConstant(const int, const int = 0); int main() { const int c = 2 ; cout<< BixConstant(c, 10)<< " "; cout<< BixConstant(c, 20)<< endl; return 0; } const double BixConstant(const int x, const int y) { return( (y + (y x) x % y) 0.2); }






19. Which of the following statement is correct about the program given below? #include<iostream.h> struct MyStructure { class MyClass { public: void Display(int x, float y = 97.50, char ch = 'a') { cout<< x << " " << y << " " << ch; } }Cls; }Struc; int main() { Struc.Cls.Display(12, 'b'); return 0; }






20. Which of the following statement is correct about the program given below? #include<iostream.h> long FactFinder(long = 5); int main() { for(int i = 0; i<= 0; i++) cout<< FactFinder() << endl; return 0; } long FactFinder(long x) { if(x < 2) return 1; long fact = 1; for(long i = 1; i <= x-1; i++) fact = fact i; return fact; }






21. What will be the output of the following program? #include<iostream.h> double BixFunction(double, double, double = 0, double = 0, double = 0); int main() { double d = 2.3; cout<< BixFunction(d, 7) << " "; cout<< BixFunction(d, 7, 6) << endl; return 0; } double BixFunction(double x, double p, double q, double r, double s) { return p +(q +(r + s x) x) x; }





22. What will be the output of the following program? #include<iostream.h> int main() { float Amount; float Calculate(float P = 5.0, int N = 2, float R = 2.0); Amount = Calculate(); cout<< Amount << endl; return 0; } float Calculate(float P, int N, float R) { int Year = 1; float Sum = 1 ; Sum = Sum (1 + P ++N R); Year = (int)(Year + Sum); return Year; }






23. What will be the output of the following program? #include<iostream.h> class Bix { int x, y; public: void show(void); void main(void); }; void Bix::show(void) { Bix b; b.x = 2; b.y = 4; cout<< x << " " << y; } void Bix::main(void) { Bix b; b.x = 6; b.y = 8; b.show(); } int main(int argc, char argv[]) { Bix run; run.main(); return 0; }






24. Which of the following statement is correct about the program given below? #include<iostream.h> class IndiabixSample { private: int AdditionOne(int x, int y = 1) { return x y; } public: int AdditionTwo(int x, int y = 1) { return x / y; } }; int main() { IndiabixSample objBix; cout<<objBix.AdditionOne(4, 8)<<" "; cout<<objBix.AdditionTwo(8, 8); return 0; }





25. What will be the output of the following program? #include<iostream.h> class IndiaBix { int K; public: void BixFunction(float, int , char); void BixFunction(float, char, char); }; int main() { IndiaBix objIB; objIB.BixFunction(15.09, 'A', char('A' + 'A')); return 0; } void IndiaBix::BixFunction(float, char y, char z) { K = int(z); K = int(y); K = y + z; cout<< "K = " << K << endl; }






Terms And Service:We do not guarantee the accuracy of available data ..We Provide Information On Public Data.. Please consult an expert before using this data for commercial or personal use | Powered By:Omega Web Solutions
© 2002-2017 Omega Education PVT LTD...Privacy | Terms And Conditions
Question ANSWER With Solution