Data Types


  1. What is the output of this program?
    #include 
    using namespace std;
    enum test
    {
    p = 20, q, r
    };
    int main()
    {
    cout << p <<" " << q<< " " << r;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    If we not assigned any value to enum variable means, then the next number to initialized number will be allocated to the variable.


  1. What is the output of this program?
    #include 
    using namespace std;
    enum Gender {
    male, female, transgender
    };
    int main()
    {
    cout << male<< female<< transgender;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: E

    The enumerator values start from zero if it is unassigned.



  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    enum channel {hotstar, zeetv, max};
    enum symbol {anamol, hotstar};
    int k = 0;
    for (k = hotstar; k <= zeetv; k++) {
    cout << k;
    }
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    In function 'int main()':
    6:30: error: redeclaration of 'hotstar'
    5:23: note: previous declaration 'main()::channel hotstar'


  1. Choose the incorrect option











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    void fundamental type is used in the cases of a and c.



  1. Choose the correct option.
     (i) extern int k;
    (ii0 int k;











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    The keyword extern is not a definition and is not allocated storage until it is initialized.