View Mode
Q: 11
What will happen when you attempt to compile and run the following code? #include #include using namespace std; int fun(int); int main() { int *x = new int; *x=10; cout << fun(*x); return 0; } int fun(int i) { return i*i; }
Options
Q: 12
Which definitions are correct?
Options
Q: 13
What happens when you attempt to compile and run the following code? #include #include using namespace std; class A { public: A() { cout << "A0 ";} A(string s) { cout << "A1";} }; class B : public A { public: B() { cout << "B0 ";} B(string s) { cout << "B1 ";} }; class C : private B { public: C() { cout << "C0 ";} C(string s) { cout << "C1 ";} }; int main () { B b1; C c1; return 0; }
Options
Q: 14
What happens when you attempt to compile and run the following code? #include using namespace std; int main() { long int x,y=10; double d; d = 3.99; x=(int) d; cout << x <<", "; d=float (y); cout << d; return 0; }
Options
Q: 15
What is the output of the program given below? #include using namespace std; int main (int argc, const char * argv[]) { enum state { ok, error, warning}; enum state s1, s2, s3, s4; s1 = ok; s2 = warning; s3 = error; s4 = ok; cout << s1<< s2<< s3<< s4; return 0; }
Options
Q: 16
Which code, inserted at line 14, generates the output "3.14 10"? #include using namespace std; namespace myNamespace1 { int x = 5; int y = 10; } namespace myNamespace2 { float x = 3.14; float y = 1.5; } int main () { //insert code here cout << x << " " << y; return 0; }
Options
Q: 17
What happens when you attempt to compile and run the following code? #include using namespace std; int min(int a, int b); int main() { int b=10; b = min(5,20); cout << b; return 0; } int min(int a, int b) { if (a<b) return(a); else return(b); }
Options
Q: 18
What is the output of the program if characters 'h', 'e', 'l', 'l' , 'o' and enter are supplied as input? #include #include using namespace std; void f(); int main() { f(); return 0; } void f() { char c; c = cin.get(); cout << c; if(c != '\n') f(); }
Options
Q: 19
Which code, inserted at line 19, generates the output "23"? #include #include using namespace std; class A { int x; protected: int y; public: int z; A() { x=1; y=2; z=3; } }; class B : public A { string z; public: int y; void set() { y = 4; z = "John"; } void Print() { //insert code here } }; int main () { B b; b.set(); b.Print(); return 0; }
Options
Q: 20
What happens when you attempt to compile and run the following code? #include using namespace std; class BaseC { int *ptr; public: BaseC() { ptr = new int(10);} BaseC(int i) { ptr = new int(i); } ~BaseC() { delete ptr; } void Print() { cout <Print(); }
Options
Question 11 of 20 · Page 2 / 2

Premium Access Includes

  • Quiz Simulator
  • Exam Mode
  • Progress Tracking
  • Question Saving
  • Flash Cards
  • Drag & Drops
  • 3 Months Access
  • PDF Downloads
Get Premium Access
Scroll to Top

FLASH OFFER

Days
Hours
Minutes
Seconds

avail 10% DISCOUNT on YOUR PURCHASE