Explore topic-wise MCQs in Engineering.

This section includes 226 Mcqs, each offering curated multiple-choice questions to sharpen your Engineering knowledge and support exam preparation. Choose a topic below to get started.

1.

Which of the following statement is correct about the program given below?

#include<iostream.h> long FactFinder(long = 5); int main()
{ for(int i = 0; i<= 0; i++) cout<< FactFinder() << endl; return 0;
}
long FactFinder(long x)
{ if(x < 2) return 1; long fact = 1; for(long i = 1; i <= x-1; i++) fact = fact * i; return fact; }

A. The program will print the output 1.
B. The program will print the output 24.
C. The program will print the output 120.
D. The program will print the output garbage value.
E. The program will report compile time error.
Answer» C. The program will print the output 120.
2.

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; }

A. The program will print the output 0.
B. The program will print the output 10.
C. The program will print the output 30.
D. The program will print the output 40.
E. The program will report compile time error.
Answer» B. The program will print the output 10.
3.

Which of the following statement is correct about the program given below?

#include<iostream.h> class IndiaBix
{ int x; float y; public: void BixFunction(int = 0, float = 0.00f, char = 'A'); void BixFunction(float, int = 10.00, char = 'Z'); void BixFunction(char, char, char);
};
int main()
{ IndiaBix objBix; objBix.BixFunction(10 * 1.0, int(56.0)); return 0;
}
void IndiaBix::BixFunction(int xx, float yy, char zz)
{ x = xx + int(yy); cout<< "x = " << x << endl;
}
void IndiaBix::BixFunction(float xx, int yy, char zz)
{ x = zz + zz; y = xx + yy; cout<< " x = " << x << endl;
}
void IndiaBix::BixFunction(char xx, char yy, char zz)
{ x = xx + yy + zz; y = float(xx * 2); cout<< " x = " << x << endl;
}

A. The program will print the output x = 65.
B. The program will print the output x = 66.
C. The program will print the output x = 130.
D. The program will print the output x = 180.
E. The program will not compile successfully.
Answer» E. The program will not compile successfully.
4.

What will be the output of the following program?

#include<iostream.h> class Base
{ public: int S, A, M; Base(int x, int y) { S = y - y; A = x + x; M = x * x; } Base(int, int y = 'A', int z = 'B') { S = y; A = y + 1 - 1; M = z - 1; } void Display(void) { cout<< S << " " << A << " " << M << endl; }
};
class Derived : public Base
{ int x, y, z; public: Derived(int xx = 65, int yy = 66, int zz = 67): Base(x) { x = xx; y = yy; z = zz; } void Display(int n) { if(n) Base::Display(); else cout<< x << " " << y << " " << z << endl; }
};
int main()
{ Derived objDev; objDev.Display(-1); return 0;
}

A. 65 65 65
B. 65 66 67
C. A A A
D. A B C
E. The program will report compile time error.
Answer» B. 65 66 67
5.

What will be the output of the following program?

#include<iostream.h> class Base
{ public: char S, A, M; Base(char x, char y) { S = y - y; A = x + x; M = x * x; } Base(char, char y = 'A', char z = 'B') { S = y; A = y + 1 - 1; M = z - 1; } void Display(void) { cout<< S << " " << A << " " << M << endl; }
};
class Derived : public Base
{ char x, y, z; public: Derived(char xx = 65, char yy = 66, char zz = 65): Base(x) { x = xx; y = yy; z = zz; } void Display(int n) { if(n) Base::Display(); else cout<< x << " " << y << " " << z << endl; }
};
int main()
{ Derived objDev; objDev.Display(0-1); return 0;
}

A. A A A
B. A B A
C. A B C
D. Garbage Garbage Garbage
E. The program will report compile time error.
Answer» B. A B A
6.

Which of the following statement is correct about the program given below?

#include<iostream.h> static double gDouble; static float gFloat; static double gChar; static double gSum = 0; class BaseOne
{ public: void Display(double x = 0.0, float y = 0.0, char z = 'A') { gDouble = x; gFloat = y; gChar = int(z); gSum = gDouble + gFloat + gChar; cout << gSum; }
};
class BaseTwo
{ public: void Display(int x = 1, float y = 0.0, char z = 'A') { gDouble = x; gFloat = y; gChar = int(z); gSum = gDouble + gFloat + gChar; cout << gSum; }
};
class Derived : public BaseOne, BaseTwo
{ void Show() { cout << gSum; } }; int main()
{ Derived objDev; objDev.BaseTwo::Display(10, 20, 'Z'); return 0; }

A. The program will print the output 0.
B. The program will print the output 120.
C. The program will report run-time error.
D. The program will report compile-time error.
E. The program will print the output garbage value.
Answer» E. The program will print the output garbage value.
7.

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;
}

A. 7 20
B. 7 19.8
C. 7 Garbage
D. 7 20.8
Answer» E.
8.

What will be the output of the following program?

#include<iostream.h> int main()
{ float Amount; float Calculate(float P = 5.0, int N = 2, float R = 2.0); Amount = Calculate(); cout<< Amount << endl; return 0;
} float Calculate(float P, int N, float R)
{ int Year = 1; float Sum = 1 ; Sum = Sum * (1 + P * ++N * R); Year = (int)(Year + Sum); return Year; }

A. 21
B. 22
C. 31
D. 32
E. None of these
Answer» E. None of these
9.

Which of the following statement is correct about the program given below?

#include<iostream.h> class IndiabixSample
{ private: int AdditionOne(int x, int y = 1) { return x * y; } public: int AdditionTwo(int x, int y = 1) { return x / y; } }; int main()
{ IndiabixSample objBix; cout<<objBix.AdditionOne(4, 8)<<" "; cout<<objBix.AdditionTwo(8, 8); return 0;
}

A. The program will print the output 32 0.
B. The program will print the output 32 garbage-value.
C. The program will print the output 32 1.
D. The program will report compile time error.
Answer» E.
10.

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;
}

A. 0
B. 100
C. 200
D. 400
E. The program will report compile time error.
Answer» D. 400
11.

What will be the out of the following program?

#include<iostream.h> class BixBase
{ public: int x, y; public: BixBase(int xx = 0, int yy = 0) { x = xx; y = yy; } };
class BixDerived : public BixBase
{ private: BixBase objBase; public: BixDerived(int xx, int yy) : BixBase(xx), objBase(yy) { cout << this->x << " " << this->y << " " << objBase.x << " " << objBase.y << " "; } ~BixDerived() { }
};
int main()
{ BixDerived objDev(11, 22); return 0;
}

A. 11 22 0 0
B. 11 0 0 22
C. 11 0 22 0
D. 11 22 11 22
E. The program will report compile time error.
Answer» D. 11 22 11 22
12.

What will be the out of the following program?

#include<iostream.h> class BixBase
{ public: int x, y; public: BixBase(int xx = 0, int yy = 0) { x = xx; y = yy; } };
class BixDerived : public BixBase
{ private: BixBase objBase; public: BixDerived(int xx, int yy) : BixBase(xx), objBase(yy) { cout << x << " " << this->x << " " << BixBase::x << " " << this->objBase.x ; } ~BixDerived() { }
};
int main()
{ BixDerived objDev(11, 22); return 0;
}

A. 11 22 0 0
B. 11 11 0 22
C. 11 11 11 0
D. 11 11 11 22
E. The program will report compile time error.
Answer» E. The program will report compile time error.
13.

Which of the following statement is correct about the program given below?

#include<iostream.h>
void Tester(int xx, int yy = 5);
class IndiaBix
{ int x; int y; public: void Tester(int xx, int yy = 5) { x = xx; y = yy; cout<< ++x % --y; }
};
int main()
{ IndiaBix objBix; objBix.Tester(5, 5); return 0; }

A. The program will print the output 0.
B. The program will print the output 1.
C. The program will print the output 2.
D. The program will print the output garbage value.
E. The program will report compile time error.
Answer» D. The program will print the output garbage value.
14.

Which of the following statement is correct about the program given below?

#include<iostream.h> class PowerFinder
{ public: void Power(int x = 1, int y = 1) { int P = 1, i = 1; while(++i <= y) { P *= x; } cout<< P << endl; } };
int main()
{ PowerFinder FP; FP.Power(2, 6); return 0;
}

A. The program will print the output 12.
B. The program will print the output 16.
C. The program will print the output 32.
D. The program will print the output 36.
E. The program will execute infinite time.
Answer» D. The program will print the output 36.
15.

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; }

A. The program will print the output 19 31.
B. The program will print the output 20 30.
C. The program will print the output 21 31.
D. The program will print the output 21 29.
E. Program will report compile time error.
Answer» D. The program will print the output 21 29.
16.

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; }

A. The program will print the output 5.
B. The program will print the output 8.
C. The program will print the output 40.
D. The program will report compile time error.
Answer» E.
17.

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; }

A. The program will print the output 12 97.50 b.
B. The program will print the output 12 97.50 a.
C. The program will print the output 12 98 a.
D. The program will print the output 12 Garbage b.
E. The program will print the output 12 Garbage a.
Answer» D. The program will print the output 12 Garbage b.
18.

What will be the output of the following program?

#include<iostream.h> class IndiaBix
{ int Num; public: IndiaBix(int x) { Num = x; } int BixFunction(void);
};
int IndiaBix::BixFunction(void)
{ static int Sum = 0; int Dec; Dec = Num % 10; Num = Num / 10; if((Num / 100)) BixFunction(); Sum = Sum * 10 + Dec; return Sum;
}
int main()
{ IndiaBix objBix(12345); cout<< objBix.BixFunction(); return 0; }

A. 123
B. 321
C. 345
D. 12345
E. 54321
Answer» D. 12345
19.

What is correct about the following program?

#include<iostream.h> class Addition
{ int x; public: Addition() { x = 0; } Addition(int xx) { x = xx; } Addition operator + (int xx = 0) { Addition objTemp; objTemp.x = x + xx; return(objTemp); } void Display(void) { cout<< x << endl; }
};
int main()
{ Addition objA(15), objB; objB = objA + 5; objB.Display(); return 0; }

A. The program will print the output 20.
B. The program will report run time error.
C. The program will print the garbage value.
D. Compilation fails due to 'operator +' cannot have default arguments.
Answer» E.
20.

What will be the output of the following program?

#include<iostream.h> class TestDrive
{ int x; public: TestDrive(int xx) { x = xx; } int DriveIt(void);
};
int TestDrive::DriveIt(void)
{ static int value = 0; int m; m = x % 2; x = x / 2; if((x / 2)) DriveIt(); value = value + m * 10; return value;
}
int main()
{ TestDrive TD(1234); cout<< TD.DriveIt() * 10 << endl; return 0; }

A. 300
B. 200
C. Garbage value
D. 400
Answer» E.
21.

What will be the output of the following program?

#include<iostream.h>
#include<string.h> class BixString
{ char x[50]; char y[50]; char z[50]; public: BixString() { } BixString(char* xx) { strcpy(x, xx); strcpy(y, xx); } BixString(char *xx, char *yy = " C++", char *zz = " Programming!") { strcpy(z, xx); strcat(z, yy); strcat(z, zz); } void Display(void) { cout<< z << endl; } }; int main()
{ BixString objStr("Learn", " Java"); objStr.Display(); return 0; }

A. Java Programming!
B. C++ Programming!
C. Learn C++ Programming!
D. Learn Java Programming!
E. Learn Java C++ Programming!
Answer» E. Learn Java C++ Programming!
22.

What will be the output of the following program?

#include<iostream.h> class BaseCounter
{ protected: long int count; public: void CountIt(int x, int y = 10, int z = 20) { count = 0; cout<< x << " " << y << " " << z << endl; } BaseCounter() { count = 0; } BaseCounter(int x) { count = x ; } }; class DerivedCounter: public BaseCounter
{ public: DerivedCounter() { } DerivedCounter(int x): BaseCounter(x) { }
};
int main()
{ DerivedCounter objDC(30); objDC.CountIt(40, 50); return 0; }

A. 30 10 20
B. Garbage 10 20
C. 40 50 20
D. 20 40 50
E. 40 Garbage Garbage
Answer» D. 20 40 50
23.

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; }

A. 130
B. A0
C. B0
D. 90
Answer» C. B0
24.

What will be the output of the following program?

#include<iostream.h> class IndiaBix
{ public: int x, y; IndiaBix(int xx = 10, int yy = 20) { x = xx; y = yy; } void Exchange(int *, int *);
};
int main()
{ IndiaBix objA(30, 40); IndiaBix objB(50); objA.Exchange(&objA.x, &objB.y); cout<< objA.x << " " << objB.y << endl; return 0;
}
void IndiaBix::Exchange(int *x, int *y)
{ int t; t = *x; *x = *y; *y = t ; }

A. 20 10
B. 30 20
C. 20 30
D. 30 40
E. 50 30
Answer» D. 30 40
25.

Which of the following statement is correct about the program given below?

#include<iostream.h> class BixArray
{ int Matrix[3][3]; public: BixArray() { for(int i = 0; i<3; i++) for(int j = 0; j < 3; j++) Matrix[j][i] = i + j; } void Display(void) { for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) cout<< Matrix[j][i] << " "; } }; int main()
{ BixArray objBix; objBix.Display(); return 0; }

A. The program will display the output 4 3 2 3 2 1 2 1 0.
B. The program will display the output 0 1 2 1 2 3 2 3 4.
C. The program will display the output 9 garbage values.
D. The program will report error on compilation.
Answer» C. The program will display the output 9 garbage values.
26.

Which of the following statement is correct about the program given below?

#include<iostream.h>
#include<string.h>
#include<malloc.h>
class BixString
{ char txtName[20]; public: BixString(char *txtTemp = NULL) { if(txtTemp != NULL) strcpy(txtName, txtTemp); } void Display(void) { cout<<txtName; }
};
int main()
{ char *txtName = (char*)malloc(10); strcpy(txtName, "IndiaBIX"); *txtName = 48; BixString objTemp(txtName); cout<< sizeof(txtName); return 0; }

A. Above program will display IndiaBIX 8.
B. Above program will display IndiaBIX 9.
C. Above program will display size of integer.
D. Above program will display IndiaBIX and size of integer.
E. Above program will display 1.
Answer» C. Above program will display size of integer.
27.

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; }

A. 10 10
B. 12 10
C. 12 21
D. 12 31
E. The program will report compilation error.
Answer» B. 12 10
28.

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;
}

A. 6
B. 8
C. 9
D. 15
E. 16
Answer» B. 8
29.

What will be the output of the following program?

#include<iostream.h> class Base
{ int x, y; public: Base() { x = y = 0; } Base(int xx) { x = xx; } Base(int p, int q = 10) { x = p + q; y = q; } void Display(void) { cout<< x << " " << y << endl; } }objDefault(1, 1); class Derived: public Base
{ Base obj; public: Derived(int xx, int yy): Base(xx, xx + 1) { } Derived(Base objB = objDefault) { } }; int main()
{ Derived objD(5, 3); Derived *ptrD = new Derived(objD); ptrD->Display(); delete ptrD; return 0; }

A. 3 2
B. 8 3
C. 11 6
D. 11 10
E. The program will not compile successfully.
Answer» D. 11 10
30.

Which of the following statement is correct about the program given below?

#include<iostream.h>
class IndiaBix
{ int x, y, z; public: IndiaBix(int x = 100, int y = 30, int z = 0) { this->x = x; this->y = y; this->z = z; Display(); } void Display() { cout<< x << " " << y << " " << z; }
};
int main()
{ int a = 0, b = 1, c = 2; int &x = ++a; int &y = --b; int z = c + b - -c; IndiaBix objBix(x, y, z); return 0; }

A. The program will print the output 1 0 3.
B. The program will print the output 1 0 4.
C. The program will print the output 1 1 3.
D. The program will print the output 1 1 4.
E. The program will report compile time error.
Answer» C. The program will print the output 1 1 3.
31.

Which of the following statement is correct about the program given below?

#include<iostream.h> class BixArray
{ int array[3][3]; public: BixArray(int arr[3][3] = NULL) { if(arr != NULL) for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) array[i][j] = i+j; } void Display(void) { for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) cout<< array[i][j] << " "; }
};
int main()
{ BixArray objBA; objBA.Display(); return 0; }

A. The program will report error on compilation.
B. The program will display 9 garbage values.
C. The program will display NULL 9 times.
D. The program will display 0 1 2 1 2 3 2 3 4.
Answer» C. The program will display NULL 9 times.
32.

Which of the following statement is correct about the program given below?

#include<iostream.h> class IndiaBix
{ int x; float y; public: IndiaBix(int x) { x = x; } IndiaBix(int p = 0, int q = 10) { x = p += 2; y = q * 1.0f; } void SetValue(int &y, float z) { x = y; y = (int)z; } void Display(void) { cout<< x; }
};
int main()
{ int val = 12; IndiaBix objBix(val); IndiaBix objTmp(); objBix.SetValue(val, 3.14f); objBix.Display(); return 0; }

A. The program will print the output 2.
B. The program will print the output 12.
C. The program will report run time error.
D. The program will not compile successfully.
Answer» E.
33.

What will be the output of the following program?

#include<iostream.h> struct BixArray
{ int arr[5]; public: void BixFunction(); void Display();
};
void BixArray::BixFunction()
{ static int i = 0, j = 4; i++; j--; if(j > 0) BixFunction(); int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; i--; j++;
}
void BixArray::Display()
{ for(int i = 0; i < 5; i++) cout<< arr[i] << " ";
} int main()
{ BixArray objArr = {{5, 6, 3, 9, 0}}; objArr.BixFunction(); objArr.Display(); return 0; }

A. 5 6 3 9 0
B. 0 9 3 6 5
C. 0 5 6 3 9
D. 0 6 3 9 5
E. None of these
Answer» E. None of these
34.

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; }

A. 99
B. ASCII value of 99
C. Garbage value
D. 99.50
Answer» C. Garbage value
35.

Which of the following statement is correct about the program given below?

#include<iostream.h> class Bix
{ int x; public: Bix(); ~Bix(); void Show() const;
};
Bix::Bix()
{ x = 25;
}
void Bix::Show() const
{ cout<< x;
}
int main()
{ Bix objB; objB.Show(); return 0; }

A. The program will print the output 25.
B. The program will print the output Garbage-value.
C. The program will report compile time error.
D. The program will report runtime error.
Answer» D. The program will report runtime error.
36.

What will be the output of the following program?

#include<iostream.h>
long BixFunction(int x, int y = 5, float z = 5)
{ return(++x * ++y + (int)++z);
}
int main()
{ cout<< BixFunction(20, 10); return 0;
}

A. 237
B. 242
C. 240
D. 35
E. The program will report error on compilation.
Answer» B. 242
37.

What will be the output of the following program?

#include<iostream.h>
int BixFunction(int a, int b = 3, int c = 3)
{ cout<< ++a * ++b * --c ; return 0;
}
int main()
{ BixFunction(5, 0, 0); return 0;
}

A. 8
B. 6
C. -6
D. -8
Answer» D. -8
38.

What will be the output of the following program?

#include<iostream.h> void MyFunction(int a, int b = 40)
{ cout<< " a = "<< a << " b = " << b << endl;
}
int main()
{ MyFunction(20, 30); return 0; }

A. a = 20 b = 40
B. a = 20 b = 30
C. a = 20 b = Garbage
D. a = Garbage b = 40
Answer» C. a = 20 b = Garbage
39.

Which of the following statement is correct about the program given below?

#include<iostream.h> static int b = 0; void DisplayData(int *x, int *y = &b)
{ cout<< *x << " " << *y;
}
int main()
{ int a = 10, b = 20 ; DisplayData(&a, &b); return 0; }

A. The program will print the output 10 20.
B. The program will print the output 10 0.
C. The program will print the output 10 garbage.
D. The program will report compile time error.
Answer» B. The program will print the output 10 0.
40.

What will be the output of the following program?

#include<iostream.h> typedef void(*FunPtr)(int);
int Look(int = 10, int = 20);
void Note(int); int main()
{ FunPtr ptr = Note; (*ptr)(30); return 0;
}
int Look(int x, int y)
{ return(x + y % 20);
}
void Note(int x)
{ cout<< Look(x) << endl;
}

A. 10
B. 20
C. 30
D. 40
E. Compilation fails.
Answer» D. 40
41.

Which of the following can access private data members or member functions of a class?

A. Any function in the program.
B. All global functions in the program.
C. Any member function of that class.
D. Only public member functions of that class.
Answer» D. Only public member functions of that class.
42.

Constructor is executed when _____.

A. an object is created
B. an object is used
C. a class is declared
D. an object goes out of scope.
Answer» B. an object is used
43.

Which of the following also known as an instance of a class?

A. Friend Functions
B. Object
C. Member Functions
D. Member Variables
Answer» C. Member Functions
44.

Which of the following type of data member can be shared by all instances of its class?

A. Public
B. Inherited
C. Static
D. Friend
Answer» D. Friend
45.

Which of the following statements about virtual base classes is correct?

A. It is used to provide multiple inheritance.
B. It is used to avoid multiple copies of base class in derived class.
C. It is used to allow multiple copies of base class in a derived class.
D. It allows private members of the base class to be inherited in the derived class.
Answer» C. It is used to allow multiple copies of base class in a derived class.
46.

Which of the following statements is correct when a class is inherited publicly?

A. Public members of the base class become protected members of derived class.
B. Public members of the base class become private members of derived class.
C. Private members of the base class become protected members of derived class.
D. Public members of the base class become public members of derived class.
Answer» E.
47.

Which of the following access specifies is used in a class definition by default?

A. Protected
B. Public
C. Private
D. Friend
Answer» D. Friend
48.

Which of the following statements is correct about the constructors and destructors?

A. Destructors can take arguments but constructors cannot.
B. Constructors can take arguments but destructors cannot.
C. Destructors can be overloaded but constructors cannot be overloaded.
D. Constructors and destructors can both return a value.
Answer» C. Destructors can be overloaded but constructors cannot be overloaded.
49.

What will be the output of the following program?

#include<iostream.h> struct IndiaBix
{ int arr[5]; public: void BixFunction(void); void Display(void);
};
void IndiaBix::Display(void)
{ for(int i = 0; i < 5; i++) cout<< arr[i] << " " ;
}
void IndiaBix::BixFunction(void)
{ static int i = 0, j = 4; int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp ; i++; j--; if(j != i) BixFunction();
}
int main()
{ IndiaBix objBix = {{ 5, 6, 3, 9, 0 }}; objBix.BixFunction(); objBix.Display(); return 0; }

A. 0 9 3 6 5
B. 9 3 6 5 0
C. 5 6 3 9 0
D. 5 9 3 6 0
Answer» B. 9 3 6 5 0
50.

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; } void Display() { cout<< x ; }
};
int IndiaBix::x = 0; int main()
{ IndiaBix::SetData(33); IndiaBix::Display(); return 0; }

A. The program will print the output 0.
B. The program will print the output 33.
C. The program will print the output Garbage.
D. The program will report compile time error.
Answer» E.