Home / CSE MCQs / C++ - MCQs :: Input Output Streams - C++

CSE MCQs :: C++ - MCQs

  1. Where does a cin stops it extraction of data?
  2. A.
    By seeing a blankspace
    B.
    By seeing ()
    C.
    Both a & b
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  3. What is the output of this program?

    #include < iostream >

    using namespace std;

    int main ()

    {

    int i;

    cout << "Please enter an integer value: ";

    cin >> i + 4;

    return 0;

    }

  4. A.
    73
    B.
    your value + 4
    C.
    Error
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  5. What is the output of this program?

    #include < iostream >

    using namespace std;

    int main( )

    {

    char line[100];

    cin.getline( line, 100, 't' );

    cout << line;

    return 0

    }

  6. A.
    100
    B.
    t
    C.
    It will print what we give.
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  7. How many parameters are there in getline function?
  8. A.
    1
    B.
    2
    C.
    3
    D.
    4

    View Answer

    Workspace

    Discuss Discuss in Forum


  9. What can be used to input a string with blankspace?
  10. A.
    inline
    B.
    getline
    C.
    putline
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  11. When will the cin can start proceessing of input?
  12. A.
    After pressing return key
    B.
    BY pressing blankspace
    C.
    Both a & b
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  13. How many groups of output of operation are there in c++?
  14. A.
    1
    B.
    2
    C.
    3
    D.
    4

    View Answer

    Workspace

    Discuss Discuss in Forum


  15. Pick out the correct objects about the instantiation of output stream.
  16. A.
    cout
    B.
    cerr
    C.
    clog
    D.
    All of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  17. What is meant by ofstream in c++?
  18. A.
    Writes to a file
    B.
    Reads from a file
    C.
    Both a & b
    D.
    None of the mentioned

    View Answer

    Workspace

    Discuss Discuss in Forum


  19. What is the output of this program?


    #include < iostream >

    using namespace std;

    int main () 

    {

    char str[] = "Steve jobs";

    int val = 65;

    char ch = 'A';

    cout.width (5);

    cout << right;

    cout << val << endl;

    return 0;

    }

  20. A.
    Steve jobs
    B.
    A
    C.
    5
    D.
    65

    View Answer

    Workspace

    Discuss Discuss in Forum