Online C++ Programming Test - C++ Programming Test - Random
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 functions are performed by a constructor?
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 is correct about class and structure?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
4.
Which of the following concepts means wrapping up of data and functions together?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
5.
Which of the following provides a reuse mechanism?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
6.
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;
}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>
static int Result;
class India
{
public:
void Change(int x = 10, int y = 20, int z = 30)
{
cout<< x + y + z;
}
void Display(int x = 40, float y = 50.00)
{
Result = x % x;
cout<< Result;
}
};
class Bix
{
int x, y;
public:
void Change(int x, int y = 50)
{
cout<< x + y;
}
};
class IndiaBix: public India, public Bix
{
public:
void Display(int x = 10, int xx = 100, int xxx = 1000)
{
Result = x + xx % x * x;
cout<< Result ;
}
};
int main()
{
IndiaBix objBix;
objBix.India::Display(10, 20.00);
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
8.
What will be the output of the following program?
#include<iostream.h>
class IndiaBix
{
int x, y, z;
public:
void Apply(int xx = 12, int yy = 21, int zz = 9)
{
x = xx;
y = yy += 10;
z = x -= 2;
}
void Display(void)
{
cout<< x << " " << y << endl;
}
void SetValue(int xx, int yy)
{
Apply(xx, 0, yy);
}
};
int main()
{
IndiaBix *pBix= new IndiaBix;
(*pBix).SetValue(12, 20);
pBix->Display();
delete pBix;
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
9.
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 : References
10.
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 : References
11.
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 : 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.
Which of the following also known as an instance of a 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 statements is correct when a class is inherited publicly?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Objects and Classes
15.
Which of the following statement is correct about the program given below?
#include<iostream.h>
#include<process.h>
class IndiaBix
{
static int x;
public:
IndiaBix()
{
if(x == 1)
exit(0);
else
x++;
}
void Display()
{
cout<< x << " ";
}
};
int IndiaBix::x = 0;
int main()
{
IndiaBix objBix1;
objBix1.Display();
IndiaBix objBix2;
objBix2.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.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class IndiaBix
{
int x;
float y;
public:
void Function()
{
x = 4;
y = 2.50; delete this;
}
void Display()
{
cout<< x << " " << y;
}
};
int main()
{
IndiaBix *pBix = new IndiaBix();
pBix->Function();
pBix->Function();
pBix->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.
What will be the output of the following program?
#include<iostream.h>
class BixBase
{
public:
float x;
};
class BixDerived : public BixBase
{
public:
char ch;
void Process()
{
ch = (int)((x=12.0)/3.0);
}
void Display()
{
cout<< (int)ch;
}
};
int main()
{
class BixDerived *objDev = new BixDerived;
objDev->Process();
objDev->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
18.
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
19.
What will be the output of the following program?
#include<iostream.h>
class BixBase
{
public:
BixBase()
{
cout<< "Base OK. ";
}
virtual ~BixBase()
{
cout<< "Base DEL. ";
}
};
class BixDerived: public BixBase
{
public:
BixDerived()
{
cout<< "Derived OK. ";
}
~BixDerived()
{
cout<< "Derived DEL. ";
}
};
int main()
{
BixBase *basePtr = new BixDerived();
delete basePtr;
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
20.
What will be the output of the following program?
#include<iostream.h>
class IndiaBix
{
int x;
public:
IndiaBix(int xx, float yy)
{
cout<< char(yy);
}
};
int main()
{
IndiaBix *p = new IndiaBix(35, 99.50f);
return 0;
}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