Question 81

Which of the structures is incorrect?
1:
struct s1{
int x;
long int li;
};
2:
struct s2{
float f;
struct s2 *s;
};
3:
struct s3{
float f;
struct s3 s;
};
  • Question 82

    What happens when you attempt to compile and run the following code?
    #include <iostream>
    #include <string>
    using namespace std;
    class B;
    class A {
    int age;
    public:
    A () { age=5; };
    friend class B;
    };
    class B {
    string name;
    public:
    B () { name="Bob"; };
    void Print(A ob) {
    cout << name << ob.age;
    }
    };
    int main () {
    A a;
    B b;
    b.Print(a);
    return 0;
    }
  • Question 83

    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;
    }
  • Question 84

    What happens when you attempt to compile and run the following code?
    #include <iostream>
    using namespace std;
    void set(struct person*);
    struct person
    {
    char name[25];
    int age;
    };
    int main()
    {
    struct person e = {"Steve", 30};
    set(&e);
    cout<< e.name << " " << e.age;
    return 0;
    }
    void set(struct person *p)
    {
    p?>age = p?>age + 1;
    }
  • Question 85

    A condition expression used by if(), while(), and do-while() must evaluate to and only to: