With each visit of this Programming in C++ online Quiz / Practice Test, the list of MCQs / Objective Questions presented will be different, offering you a diverse set of practice opportunities. This variability encourages you to practice extensively, refining the accuracy of your answers and your overall grasp of the content. By utilizing this resource, you can hone your skills and become more adept at managing time constraints during actual exams.
Test Instructions Question type Randomized MCQs.Changes every time you visit the test Total Number of Questions 30 Time Limit 20 Minutes Points 1 Point for each Question
Remaining Time: 0 MINUTES
0 of 30 questions completed
Questions:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Information
You have already completed the test before. Hence you can not start it again.
0 of 30 questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 points, (0 )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
Question 1 of 30
Q-1.If the variable count exceeds 100, a single statement that prints “Too many” is
Your Answer:Correct
Your Answer:Incorrect
Question 2 of 30
Q-2.Function templates can accept
Your Answer:Correct
Your Answer:Incorrect
Question 3 of 30
Q-3.Consider the following statements: int x = 22,y=15;
x = (x>y) ? (x+y) : (x-y);
What will be the value of x after executing these statements?
Your Answer:Correct
Your Answer:Incorrect
Question 4 of 30
Q-4.What would be the output of the following program? int main()
{
int x,y=10,z=10;
x = (y = =z);
cout<<
Your Answer:Correct
Your Answer:Incorrect
Question 5 of 30
Q-5.Exception handling is targeted at
Your Answer:Correct
Your Answer:Incorrect
Question 6 of 30
Q-6.What will be the values of x, m and n after the execution of the following statements?
int x, m, n;
m = 10;
n = 15;
x = ++m + n++;
Your Answer:Correct
Your Answer:Incorrect
Question 7 of 30
Q-7.What is the error in the following code? class t
{
virtual void print();
}
Your Answer:Correct
Your Answer:Incorrect
Question 8 of 30
Q-8.What will be the output of the following program? #include iostream.h
void main()
{
float x=5,y=2;
int result;
result=x % y;
cout result;
}
Your Answer:Correct
Your Answer:Incorrect
Question 9 of 30
Q-9.Overloading the function operator
Your Answer:Correct
Your Answer:Incorrect
Question 10 of 30
Your Answer:Correct
Your Answer:Incorrect
Question 11 of 30
Q-11.In multiple inheritance
Your Answer:Correct
Your Answer:Incorrect
Question 12 of 30
Q-12.A property which is not true for classes is that they
Your Answer:Correct
Your Answer:Incorrect
Question 13 of 30
Q-13.Given a class named Book, which of the following is not a valid constructor?
Your Answer:Correct
Your Answer:Incorrect
Question 14 of 30
Q-14.Usually a pure virtual function
Your Answer:Correct
Your Answer:Incorrect
Question 15 of 30
Q-15.In access control in a protected derivation, visibility modes will change as follows:
Your Answer:Correct
Your Answer:Incorrect
Question 16 of 30
Q-16.Which statement gets affected when i++ is changed to ++i?
Your Answer:Correct
Your Answer:Incorrect
Question 17 of 30
Q-17.If we create a file by ‘ifstream’, then the default mode of the file is _________
Your Answer:Correct
Your Answer:Incorrect
Question 18 of 30
Q-18.A class defined within another class is:
Your Answer:Correct
Your Answer:Incorrect
Question 19 of 30
Q-19.Which of the following is the valid class declaration header for the derived class d with base
classes b1 and b2?
Your Answer:Correct
Your Answer:Incorrect
Question 20 of 30
Q-20.If we store the address of a derived class object into a variable whose type is a pointer to the
base class, then the object, when accessed using this pointer.
Your Answer:Correct
Your Answer:Incorrect
Question 21 of 30
Your Answer:Correct
Your Answer:Incorrect
Question 22 of 30
Q-22.If you wanted to sort many large objects or structures, it would be most efficient to
Your Answer:Correct
Your Answer:Incorrect
Question 23 of 30
Q-23.A friend function to a class, C cannot access
Your Answer:Correct
Your Answer:Incorrect
Question 24 of 30
Q-24.The statement f1.write((char*)&obj1, sizeof(obj1));
Your Answer:Correct
Your Answer:Incorrect
Question 25 of 30
Q-25.To convert from a user defined class to a basic type, you would most likely use.
Your Answer:Correct
Your Answer:Incorrect
Question 26 of 30
Q-26.It is possible to declare as a friend
Your Answer:Correct
Your Answer:Incorrect
Question 27 of 30
Q-27.Maximum number of template arguments in a function template is
Your Answer:Correct
Your Answer:Incorrect
Question 28 of 30
Q-28.Consider the following statements char *ptr;
ptr = “hello”;
cout << *ptr; What will be printed?
Your Answer:Correct
Your Answer:Incorrect
Question 29 of 30
Q-29.To access the public function fbase() in the base class, a statement in a derived class function
fder() uses the statement.fbase();
Your Answer:Correct
Your Answer:Incorrect
Question 30 of 30
Q-30.We can output text to an object of class ostream using the insertion operator << because
Your Answer:Correct
Your Answer:Incorrect