Welcome to the Functions in C++ MCQs Page
Dive deep into the fascinating world of Functions in C++ with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Functions in C++, a crucial aspect of Object Oriented Programming Using C++. In this section, you will encounter a diverse range of MCQs that cover various aspects of Functions in C++, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Object Oriented Programming Using C++.
Check out the MCQs below to embark on an enriching journey through Functions in C++. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Object Oriented Programming Using C++.
Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Functions in C++. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!
Functions in C++ MCQs | Page 22 of 30
Explore more Topics under Object Oriented Programming Using C++
#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;
}
#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;
}
#include<iostream.h>
int BitsTest(int x, int y);
int BitsTest(int x, int y, int z = 5);
int main()
{
cout<< BitsTest(2, 4) << endl;
return 0;
}
int BitsTest(int x, int y)
{
return x * y;
}
int BitsTest(int x, int y, int z = 5)
{
return x * y * z;
}#include<iostream.h>
class CompscibitsSample
{
public:
int a;
float b;
void BitsFunction(int a, float b, float c = 100.0f)
{
cout<< a % 20 + c * --b;
}
};
int main()
{ CompscibitsSample objBits;
objBits.BitsFunction(20, 2.000000f, 5.0f);
return 0;
}
#include<iostream.h>
void Tester(int xx, int yy = 5);
class Compscibits
{
int x;
int y;
public:
void Tester(int xx, int yy = 5)
{
x = xx;
y = yy;
cout<< ++x % --y;
}
};
int main()
{
Compscibits objBits;
objBits.Tester(5, 5);
return 0;
}
#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;
}
#include<iostream.h>
void Tester(float xx, float yy = 5.0);
class Compscibits
{
float x;
float y;
public:
void Tester(float xx, float yy = 5.0)
{
x = xx;
y = yy;
cout<< ++x % --y;
}
};
int main()
{
Compscibits objBits;
objBits.Tester(5.0, 5.0);
return 0;
}#include<iostream.h>
const double BitsConstant(const int, const int = 0);
int main()
{
const int c = 2 ;
cout<< BitsConstant(c, 10)<< " ";
cout<< BitsConstant(c, 20)<< endl;
return 0;
}
const double BitsConstant(const int x, const int y)
{
return( (y + (y * x) * x % y) * 0.2);
}
#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;
}
#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;
}
#include<iostream.h>
double BitsFunction(double, double, double = 0, double = 0, double = 0);
int main()
{
double d = 2.3;
cout<< BitsFunction(d, 7) << " ";
cout<< BitsFunction(d, 7, 6) << endl;
return 0;
}
double BitsFunction(double x, double p, double q, double r, double s)
{
return p +(q +(r + s * x)* x) * x;
}
#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;
}
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!