C++ Programming - Functions
Exercise : Functions - Programs
- Functions - General Questions
- Functions - Programs
6.
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;
}
7.
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;
}
8.
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;
}
9.
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;
}
10.
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;
}
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers