View Mode
Q: 11
What happens when you attempt to compile and run the following code? C++ Institute CPA 21 02 question
Options
Q: 12
What will be the output of the program? #include #include using namespace std; int fun(int); int main() { float k=3; k = fun(k); cout<<k; return 0; } int fun(int i) { i++; return i; }
Options
Q: 13
What happens when you attempt to compile and run the following code? #include using namespace std; class A { public: virtual void Print(){ cout<<"A";} }; class B:public A { public: virtual void Print(){ cout<Print(); B ob2; obj = &ob2; obj?>Print(); }
Options
Q: 14
What happens when you attempt to compile and run the following code? #include #include using namespace std; class complex{ double re; double im; public: complex() : re(1),im(0.4) {} bool operator==(complex &t); }; bool complex::operator == (complex &t){ if((this?>re == t.re) && (this?>im == t.im)) return true; else return false; } int main(){ complex c1,c2; if (c1==c2) cout << "OK"; else { cout << "ERROR"; } }
Options
Q: 15
Which code line inserted instead of the comment below will fix the program so that it produces the expected output and does not cause any memory leak? C++ Institute CPA 21 02 question
Options
Q: 16
What will happen if the memory cannot be allocated? C++ Institute CPA 21 02 question
Options
Q: 17
Which line of code inserted instead of the comment will make the following code run properly without causing memory leaks? C++ Institute CPA 21 02 question
Options
Q: 18
What happens if characters 'w', 'o', 'r', 'l' and 'd' are entered as input? #include #include using namespace std; int main() { string s1 = "Hello"; string s2; getline( cin, s2 ); cout << s1 + s2; return( 0 ); }
Options
Q: 19
Which of the following structures are correct? 1: struct s1{ int x; char c; }; 2: struct s2{ float f; struct s2 *s; }; 3: struct s3{ float f; in i; }
Options
Q: 20
What happens when you attempt to compile and run the following code? #include using namespace std; void print(char *c); int main (int argc, const char * argv[]) { print("Test"); return 0; } void print(char *c) { cout<<c; }
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