Question 21

What happens when you attempt to compile and run the following code?
#include <iostream>
using namespace std;
int main()
{
int a=5;
cout << ((a < 5) ? 9.9 : 9);
}
  • Question 22

    What happens when you attempt to compile and run the following code?
    #include <iostream>
    using namespace std;
    int fun(int x) {
    return x<<2;
    }
    int main(){
    int i;
    i = fun(1) / 2;
    cout << i;
    return 0;
    }
  • Question 23

    What happens when you attempt to compile and run the following code?
    #include <iostream>
    using namespace std;
    class A {
    public:
    int x;
    A() { x=0;}
    };
    class B : protected A {
    public:
    int y;
    using A::x;
    B(int y) {this?>y = y;}
    void Print() { cout << x << y; }
    };
    int main () {
    B b(5);
    b.Print();
    return 0;
    }
  • Question 24

    Analyze the code below. If it contains an error, indicate its place in the program.
  • Question 25

    Which of the following statements are correct about an array?
    int tab[10];