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() { float x=3.5, y=1.6; int i,j=2; i = x + j + y; cout << i; return 0; }A . It prints: 7B . It prints: 6C . It prints: 7,1D...

January 14, 2024 No Comments READ MORE +

obj?

What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class A { public: void Print(){ cout<<"A"; } }; class B:public A { public: virtual void Print(){ cout<< "B"; } }; class C:public B { public: void Print(){ cout<< "C"; } }; int...

January 14, 2024 No Comments READ MORE +

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(char*); int main() { char t[4]={'0', '1', '2', '3'}; fun(&t[2]); return 0; } void fun(char *a) { cout << *a; }A . It prints: 2B . It prints: 21C . It prints:...

January 14, 2024 No Comments READ MORE +

cout << padd?

What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class Test { float i,j; }; class Add { public: int x,y; Add (int a=3, int b=3) { x=a; y=b; } int result() { return x+y;} }; int main () { Test test;...

January 14, 2024 No Comments READ MORE +

o?

What happens when you attempt to compile and run the following code? #include <iostream> 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 << *ptr; } };...

January 14, 2024 No Comments READ MORE +

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; #define FUN(arg) if(arg) cout<<"Test"; int main() { int i=1; FUN(i<3); return 0; }A . It prints: 0B . It prints: TC . It prints: T0D . It prints: TestView AnswerAnswer: D

January 14, 2024 No Comments READ MORE +

Which statement should be added in the following program to make work it correctly?

Which statement should be added in the following program to make work it correctly? using namespace std; int main (int argc, const char * argv[]) { cout<<"Hello"; }A . #include<stdio.h>B . #include<stdlib.h>C . #include <iostream>D . #include<conio.h>View AnswerAnswer: C

January 14, 2024 No Comments READ MORE +

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> #include <string> using namespace std; int f(int i, int b); int main() { int i=0; i++; for (i=0; i<=2; i++) { cout<<f(0,i); } return 0; } int f(int a, int b) { return a+b; }A ....

January 13, 2024 No Comments READ MORE +

What is the output of the program if characters 't', 'e', 's' and 't' enter are supplied as input?

What is the output of the program if characters 't', 'e', 's' and 't' enter are supplied as input? #include <iostream> #include <string> using namespace std; int main() { string s; getline( cin, s ); cout << s << " " << s.length(); return (0); }A . It prints: test...

January 12, 2024 No Comments READ MORE +

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; class complex{ double re; double im; public: complex() : re(0),im(0) {} complex(double x) { re=x,im=x;}; complex(double x,double y) { re=x,im=y;} void print() { cout << re << " " << im;} }; int...

January 12, 2024 No Comments READ MORE +