CPP

CPP

Output Stream has 9 Questions

How many groups of output of operation are there in c++?

1
2
3
4
Pick out the correct objects about the instantiation of output stream.

cout
cerr
clog
All of the mentioned
What is meant by ofstream in c++?

Writes to a file
Reads from a file
Both a & b
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     int main () 
  4.     {
  5.         char str[] = "Steve jobs";
  6.         int val = 65;
  7.         char ch = 'A';
  8.         cout.width (5);
  9.         cout << right;
  10.         cout << val << endl;
  11.         return 0;
  12.     }

Steve jobs
A
65
   65
What is the output of this program in the "test.txt"? file?
  1.     #include 
  2.     using namespace std;
  3.     int main ()
  4.     {
  5.         long pos;
  6.         ofstream outfile;
  7.         outfile.open ("test.txt");
  8.         outfile.write ("This is an apple",16);
  9.         pos = outfile.tellp();
  10.         outfile.seekp (pos - 7);
  11.         outfile.write (" sam", 4);
  12.         outfile.close();
  13.         return 0;
  14.     }

This is an apple
apple
sample
This is a sample
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main()
  5.     {
  6.         locale mylocale("");
  7.         cout.imbue( mylocale );
  8.         cout << (double) 3.14159 << endl;
  9.         return 0;
  10.     }

3.14
3.14159
Error
None of the mentioned
How many types of output stream classes are there in c++?

1
2
3
4
What must be specified when we construct an object of class ostream?

stream
streambuf
memory
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     using namespace std;
  3.     int main ()
  4.     {
  5.         int n;
  6.         n = -77;
  7.         cout.width(4); 
  8.         cout << internal << n << endl;
  9.         return 0;
  10.     }

77
-77
? 77
None of the mentioned