Online C++ Programming Test - C++ Programming Test 1
Instruction:
- This is a FREE online test. Beware of scammers who ask for money to attend this test.
- Total number of questions: 20.
- Time allotted: 30 minutes.
- Each question carries 1 mark; there are no negative marks.
- DO NOT refresh the page.
- All the best!
Marks : 2/20
Total number of questions
20
Number of answered questions
0
Number of unanswered questions
20
Test Review : View answers and explanation for this test.
1.
Which of the following statement is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
2.
Which of the following concepts means adding new components to a program as it runs?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
3.
Which of the following statement is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
4.
Which of the following statement is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
5.
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;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
6.
What will be the output of the following program?
#include<iostream.h>
class AreaFinder
{
float l, b, h;
float result;
public:
AreaFinder(float hh = 0, float ll = 0, float bb = 0)
{
l = ll;
b = bb;
h = hh;
}
void Display(int ll)
{
if(l = 0)
result = 3.14f * h * h;
else
result = l * b;
cout<< result;
}
};
int main()
{
AreaFinder objAF(10, 10, 20);
objAF.Display(0);
return 0;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
7.
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;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
8.
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);
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
9.
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;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
10.
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;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
11.
Which of the following statements is correct?
- We can return a global variable by reference.
- We cannot return a local variable by reference.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : References
12.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class IndiaBix
{
int x, y;
public:
IndiaBix(int &xx, int &yy)
{
x = xx;
y = yy;
Display();
}
void Display()
{
cout<< x << " " << y;
}
};
int main()
{
int x1 = 10;
int &p = x1;
int y1 = 20;
int &q = y1;
IndiaBix objBix(p, q);
return 0;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : References
13.
How many objects can be created from an abstract class?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
14.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class IndiaBix
{
static int x;
public:
static void SetData(int xx)
{
x = xx;
}
static void Display()
{
cout<< x ;
}
};
int IndiaBix::x = 0;
int main()
{
IndiaBix::SetData(44);
IndiaBix::Display();
return 0;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
15.
What will be the output of the following program?
#include<iostream.h>
class BixTeam
{
int x, y;
public:
BixTeam(int xx)
{
x = ++xx;
}
void Display()
{
cout<< --x << " ";
}
};
int main()
{
BixTeam objBT(45);
objBT.Display();
int *p = (int*)&objBT;
*p = 23;
objBT.Display();
return 0;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
16.
What will be the output of the following program?
#include<iostream.h>
class Point
{
int x, y;
public:
Point(int xx = 10, int yy = 20)
{
x = xx;
y = yy;
}
Point operator + (Point objPoint)
{
Point objTmp;
objTmp.x = objPoint.x + this->x;
objTmp.y = objPoint.y + this->y;
return objTmp;
}
void Display(void)
{
cout<< x << " " << y;
}
};
int main()
{
Point objP1;
Point objP2(1, 2);
Point objP3 = objP1 + objP2;
objP3.Display();
return 0;
}
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
17.
Which of the following statement is correct?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
18.
Which of the following implicitly creates a default constructor when the programmer does not explicitly define at least one constructor for a class?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
19.
For automatic objects, constructors and destructors are called each time the objects
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
20.
Copy constructor must receive its arguments by __________ .
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
*** END OF THE TEST ***
Time Left: 00:29:56
Post your test result / feedback here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers