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 concepts means determining at runtime what method to invoke?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
2.
Which one of the following is correct about the statements given below?
- All function calls are resolved at compile-time in Procedure Oriented Programming.
- All function calls are resolved at compile-time in OOPS.
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
3.
How many types of polymorphisms are supported by C++?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Explanation:
The two main types of polymorphism are run-time (implemented as inheritance and virtual functions), and compile-time (implemented as templates).
Discuss about this problem : Discuss in Forum
Learn more problems on : OOPS Concepts
4.
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
5.
Which of the following is not a type of inheritance?
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?
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 function / type of function cannot be overloaded?
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 Number
{
int Num;
public:
Number(int x = 0)
{
Num = x;
}
void Display(void)
{
cout<< Num;
}
void Modify();
};
void Number::Modify()
{
int Dec;
Dec = Num % 13;
Num = Num / 13;
if(Num > 0 ) Modify() ;
if(Dec == 10) cout<< "A" ;
else if(Dec == 11) cout<< "B" ;
else if(Dec == 12) cout<< "C" ;
else if(Dec == 13) cout<< "D" ;
else cout<< Dec ;
}
int main()
{
Number objNum(130);
objNum.Modify();
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 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
10.
What will be the output of the following program?
#include<iostream.h>
#include<string.h>
class IndiaBix
{
char txtMsg[50];
public:
IndiaBix(char *str = NULL)
{
if(str != NULL)
strcpy(txtMsg, str);
}
int BixFunction(char ch);
};
int IndiaBix::BixFunction(char ch)
{
static int i = 0;
if(txtMsg[i++] == ch)
return strlen((txtMsg + i)) - i;
else
return BixFunction(ch);
}
int main()
{
IndiaBix objBix("Welcome to IndiaBix.com!");
cout<< objBix.BixFunction('t');
return 0;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
11.
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;
}Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Functions
12.
What will be the output of the following program?
#include<iostream.h>
class BixTest
{
public:
BixTest(int &x, int &y)
{
x++;
y++;
}
};
int main()
{
int a = 10, b = 20;
BixTest objBT(a, b);
cout<< a << " " << b;
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 means "The use of an object of one class in definition of another 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 never requires any arguments?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
15.
What happens when a class with parameterized constructors and having no default constructor is used in a program and we create an object that needs a zero-argument constructor?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
16.
Can a class have virtual destructor?
Your Answer: Option
(Not Answered)
Correct Answer: Option
Discuss about this problem : Discuss in Forum
Learn more problems on : Constructors and Destructors
17.
If the programmer does not explicitly provide a destructor, then which of the following creates an empty destructor?
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 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 out of the following program?
#include<iostream.h>
class BixBase
{
protected:
int x, y;
public:
BixBase(int xx = 0, int yy = 0)
{
x = xx;
y = yy;
}
void Show()
{
cout<< x * this->y << endl;
}
};
class BixDerived
{
private:
BixBase objBase;
public:
BixDerived(int xx, int yy) : objBase(xx, yy)
{
objBase.Show();
}
~BixDerived()
{ }
};
int main()
{
BixDerived objDev(10, 20);
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.
Which of the following statement is correct about the program given below?
#include<iostream.h>
class IndiaBix
{
int *p;
public:
IndiaBix(int xx, char ch)
{
p = new int();
*p = xx + int(ch);
cout<< *p;
}
~IndiaBix()
{
delete p;
}
};
int main()
{
IndiaBix objBix(10, 'B');
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