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

CSE MCQs :: C++ - MCQs

  1. Which of the following correctly declares an array?
  2. A.
    int array[10];
    B.
    int array;
    C.
    array{10};
    D.
    array array[10];

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is a array?
  4. A.
    n array is a series of elements of the same type in contiguous memory locations
    B.
    An array is a series of element
    C.
    An array is a series of elements of the same type placed in non-contiguous memory locations
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. Which of the following accesses the seventh element stored in array?
  6. A.
    array[6];
    B.
    array[7];
    C.
    array(7);
    D.
    array;

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. Which of the following gives the memory address of the first element in array?
  8. A.
    array[0];
    B.
    array[1];
    C.
    array(2);
    D.
    array;

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What is the output of this program?

    #include < stdio.h >

    using namespace std;

    int main()

    {

    char str[5] = "ABC";

    cout << str[3];

    cout << str;

    return 0;

    }

  10. A.
    ABC
    B.
    ABCD
    C.
    AB
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. What is the output of this program?

    #include < stdio.h >

    using namespace std;

    int main()

    {

    int array[] = {10, 20, 30};

    cout << -2[array];

    return 0;

    }


  12. A.
    -15
    B.
    -30
    C.
    compile time error
    D.
    garbage value

    View Answer

    Workspace

    Discuss Discuss in Forum