What happens when you attempt to compile and run the following code?
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main() { int i=2; switch(i) { case 1: cout<<"Hello"; case 2: cout<<"world"; case 3: cout<<"End"; } return 0; }A . It prints: HelloB . It prints: worldC . It prints: worldEndD ....
What happens when you attempt to compile and run the following code?
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main(){ int i = 1; if (--i==1) { cout << i; } else { cout << i-1; } return 0; }A . It prints: 0B . It prints: 1C . It prints:...
What happens when you attempt to compile and run the following code?
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; void fun(int*); int main() { int i=2; fun(&i); cout<<i; return 0; } void fun(int *i) { *i = *i**i; }A . It prints: 1B . It prints: 4C . It prints: 10D ....
temp.re = this?
What happens when you attempt to compile and run the following code? #include <iostream> #include <string> using namespace std; class complex{ double re, im; public: complex() : re(1),im(0.4) {} complex operator+(complex &t); void Print() { cout << re << " " << im; } }; complex complex: operator+ (complex &t){...
What happens when you attempt to compile and run the following code?
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; void fun(int); int main() { int a=0; fun(a); return 0; } void fun(int n) { if(n < 2) { fun(++n); cout << n; } }A . It prints: 21B . It prints: 012C...
What will happen when you attempt to compile and run the following code?
What will happen when you attempt to compile and run the following code? #include <iostream> using namespace std; int main() { const char *s; char str[] = "Hello "; s = str; while(*s) { cout << *++s; *s++; } return 0; }A . It will print:"el "B . The code...
What will happen when you attempt to compile and run the following code?
What will happen when you attempt to compile and run the following code? #include <iostream> using namespace std; int getValue(); int main() { const int x = getValue(); cout<<x; return 0; } int getValue() { return 5; }A . It will print 0B . The code will not compile.C ....
What happens when you attempt to compile and run the following code?
What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main() { int x=20; int *ptr; ptr = &x; cout<<*ptr; return 0; }A . It prints: 20B . It prints: 0C . It prints address of ptrD . It prints: 2View AnswerAnswer:...
What is the output of the program?
What is the output of the program? #include <iostream> #include <string> using namespace std; int main() { string s1="Hello"; string s2="World"; s1+=s2; cout << s1; return (0); }A . It prints: HelloWorldB . It prints: HelloC . It prints: WorldD . It prints: HelWorldView AnswerAnswer: A
What will the variable "age" be in class B?
What will the variable "age" be in class B? class A { int x; protected: int y; public: int age; A () {age=5;}; }; class B: public A { string name; public: B () {name="Bob";}; void Print () { cout << name << age; } };A . publicB . privateC...