ADVERTISEMENT
ADVERTISEMENT

C++ cin, cout Aptitude Questions and Answers

C++ cin, cout Aptitude: This section contains C++ cin, cout aptitude questions and answers with explanations.
Submitted by Nidhi, on February 17, 2021

1) Which of the following is known as the insertion operator in C++?

  1. <<
  2. >>
  3. ~
  4. ^^

2) Which of the following is known as exertion operator in C++?

  1. <<
  2. >>
  3. ~
  4. ^^

3) There are the following statements that are below, which of them are correct about “endl” in C++?

  1. The "endl" is a manipulator in C++.
  2. The "endl" is used to print a new line on the standard output device.
  3. The "endl" is used to flush the output stream.
  4. The "endl" is a predefined structure.

Options:

  1. A and B
  2. B and C
  3. A, B, and C
  4. A, B, C, and D

4) In C++, the cin and cout are?

  1. Predefined objects
  2. Predefined pointers
  3. Operators
  4. Keywords

5) The insertion and exertion operators are overloaded in predefined "iostream" class?

  1. Yes
  2. No

6) What is the correct output of the given code snippets?

#include <iostream>

int main()
{
   std::cout<<"Hello world";
   return 0;
}

Options:

  1. Compilation error
  2. Hello world
  3. Runtime Error
  4. Linker error

7) What is the correct output of the given code snippets?

#include <iostream>

int main()
{
   cout>>"ABC" <<" " <<"XYZ";
   return 0;
}

Options:

  1. Compilation error
  2. ABC XYX
  3. Runtime Error
  4. Linker error

8) What is the correct output of the given code snippets?

#include <iostream>
using namespace std;

int main()
{
   cout<<("ABC")<<(" ")<<("XYZ");
   return 0;
}

Options:

  1. Compilation error
  2. ABC XYX
  3. Runtime Error
  4. Linker error

9) What is the correct output of the given code snippets?

#include <iostream>
using namespace std;

int main()
{
   cout<<("ABC"<<" "<<"XYZ");
   return 0;
}

Options:

  1. Compilation error
  2. Hello world
  3. Runtime Error
  4. Linker error

10) What is the correct output of the given code snippets?

#include <iostream>
using namespace std;

int main()
{
   int ret = 0;
   
   ret = cout<<"ABC";
   
   cout<<"ret: "<<ret;
   
   return 0;
}

Options:

  1. Compilation error
  2. Hello world
  3. Runtime Error
  4. Linker error

11) What is the correct output of the given code snippets?

#include <iostream>
using namespace std;

int main()
{
   cout.operator<<("hello");
   return 0;
}

Options:

  1. hello
  2. A hexadecimal address
  3. Runtime Error
  4. Linker error

12) What is the correct output of the given code snippets?

#include <iostream>
using namespace std;

int main()
{
   cout.operator<string><<("hello");
   return 0;
}

Options:

  1. hello
  2. Compiler error
  3. Runtime Error
  4. Linker error



ADVERTISEMENT



ADVERTISEMENT



Comments and Discussions


ADVERTISEMENT

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.