C++ Input Output

This quiz tests your knowledge of input and output operations in C++. It contains 10 questions.

Last Updated :
Discuss
Comments

Question 1

Which of the following is the scope resolution operator?

  • .

  • *

  • ::

  • ~

Question 2

Which of the following symbol is used to declare the preprocessor directives in C++?

  •  $

  •  ^

  •  *

  • #

Question 3

How many indicators are available in c++?

  • 4

  • 3

  • 2

  • 1

Question 4

How many types of output stream classes are there in c++?

  • 1

  • 2

  • 3

  • 4

Question 5

What will be the output of the following C++ code?

   #include <iostream>
   using namespace std;
   int main()
   {
       char c = 74;
       cout << c;
       return 0;
   }
  • I

  • A

  • J

  • N

Question 6

What will be the output of the following C++ code?

#include<iostream>
using namespace std;
int main ()
{
  int cin;
  cin >> cin;
  cout << "cin: " << cin;
  return 0;
}
  •  Segmentation fault

  • cin: 0 

  • Error
     

  • Nothing is printed

Question 7

What is meant by ofstream in c++?

  • Writes to a file 

  • Reads from a file

  • Writes to a file & Reads from a file
     

  • delete a file

Question 8

What can be used to input a string with blank space?

  •  inline

  • getline

  • putline

  •  setline

Question 9

Which of the following escape sequences represents carriage return?

  • \r

  •  \n

  •  \n\r

  • \c

Question 10

What will be the output of the following C++ code?

#include<iostream>
using namespace std;
int x[67];
int main()
{
    cout << x[62] << endl;
}
 
  • Garbage value

  • 67

  • 62

  • 0

Tags:

There are 10 questions to complete.

Take a part in the ongoing discussion