Home / CSE MCQs / C++ - MCQs :: Discussion

Discussion :: C++ - MCQs

  1. What is the output of this program?

    #include < iostream >

    using namespace std;

    int main()

    {

    char *ptr;

    char Str[] = "abcdefg";

    ptr = Str;

    ptr += 5;

    cout << ptr;

    return 0;

    }


  2. A.
    fg
    B.
    cdef
    C.
    defg
    D.
    abcd

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    Pointer ptr points to string 'fg'. So it prints fg.


Be The First To Comment