C++ Programming :: Objects and Classes
-
What will be the output of the following program?
#include class Bix { public: int x; }; int main() { Bix *p = new Bix(); (*p).x = 10; cout" " x " " ; p->x = 20; cout" " x ; return 0; } -
Which of the following statement is correct about the program given below?
#include class Freshergate { static int x; public: static void SetData(int xx) { x = xx; } void Display() {cout }int Freshergate::x = 0; int main() { Freshergate::SetData(33); Freshergate::Display(); return 0; } -
Which of the following statement is correct about the program given below?
#include class Freshergate { static int x; public: static void SetData(int xx) { x = xx; } static void Display() {cout } }; int Freshergate::x = 0;int main() { Freshergate::SetData(44); Freshergate::Display(); return 0; } -
What will be the output of the following program?
#include class BixTeam { int x, y; public: BixTeam(int xx) { x = ++xx; } void Display() { cout" "; } }; int main() { BixTeam objBT(45); objBT.Display(); int *p = (int*)&objBT; *p = 23; objBT.Display(); return 0; } -
Which of the following statement is correct about the program given below?
#include class Freshergate { static int x; public: static void SetData(int xx) { this->x = xx; } static void Display() { cout } int Freshergate::x = 0; int main() { Freshergate:SetData(22); Freshergate::Display(); return 0; } -
What will be the output of the following program?
#include #include class Freshergate { int val; public: void SetValue(char *str1, char *str2) { val = strcspn(str1, str2); } void ShowValue() { coutint main() };int main()}Freshergate objgate; objgate.SetValue((char*)"Fresher", (char*)"Gate"); objgate.ShowValue(); return 0; } -
Which of the following statement is correct about the program given below?
#include<iostream.h> #include<string.h> class IndiaBix { public: void GetData(char *s, int x, int y ) { int i = 0; for (i = x-1; y>0; i++) { cout<< s[i]; y--; } } }; int main() { IndiaBix objBix; objBix.GetData((char*)"Welcome!", 1, 3); return 0; } -
Which of the following statement is correct about the program given below?
#include class GateData { int x, y, z; public: GateData(int xx, int yy, int zz) { x = ++xx; y = ++yy; z = ++zz; } void Show() { cout} }; int main(){ GateData objData(1, 2, 3); objData.Show(); return 0; } -
Which of the following statement is correct about the program given below?
#include class Freshergate { int x; float y; public: void Function() { x = 4; y = 2.50; delete this; } void Display() { cout" " int main() { Freshergate *pgate =newFreshergate(); pBix->Function(); pBix->Function(); pBix->Display(); return 0; } -
What will be the output of the following program?
#include class Freshergate { static int count; public: static void First(void) { count = 10; } static void Second(int x) { count = count + x; } static void Display(void) { cout } ]; int Freshergate::count = 0; int main() { Freshergate :: First(); Freshergate :: Second(5); Freshergate :: Display(); return 0; }

Whatsapp
Facebook