Questions and Answers


  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    typedef int number;
    typedef char name;
    name n = "Interview Mania";
    number P = 12, Q = 25;
    number R = P + n;
    cout << R;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Error: invalid conversion from ‘const char*’ to ‘let {aka char}’.
    Compilation Error

    In function 'int main()':
    7:18: error: invalid conversion from 'const char*' to 'name {aka char}' [-fpermissive]
    8:24: warning: unused variable 'Q' [-Wunused-variable]


  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    int i;
    enum MonthName
    {
    January,February,March,April,May,June,July,August,September,October,November,December
    };
    for (i = February; i <= November; i++)
    cout << i;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    In this program, we are defined the data types as enumerator and printing its value in a order.



  1. What is the output of this program?
    #include 
    using namespace std;
    int main()
    {
    typedef int number;
    number P = 25, Q = 12;
    number R = P + Q + P - Q;
    cout << R;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    In this program, we are manipulating the numbers and printing the result using user-defined data types.


  1. What does the data type defined by union will do?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Union is used to define the data types of our choice and it will store the data type in one location make them accessible.



  1. Identify the correct statement.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    By using typedef, we can create a type of pre-existing type only not our own type of data.