C++ Programming :: Input/Output

NA
SHSTTON
6
Solv. Corr.
4
Solv. In. Corr.
10
Attempted
0 M:0 S
Avg. Time

1 / 9

Choose the correct option.

If you use same variable for two getline statements


ABoth the inputs are stored in that variable

BThe second input overwrites the first one

CThe second input attempt fails since the variable already got its value

DYou can not use same variable for two getline statements

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
4
Solv. Corr.
7
Solv. In. Corr.
11
Attempted
0 M:0 S
Avg. Time

2 / 9

Choose the correct option.

Regarding stringstream identify the invalid statement


Astringstream is defined in the header file

BIt allows string based objects treated as stream

CIt is especially useful to convert strings to numerical values and vice versa.

DNone of above

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
8
Solv. Corr.
3
Solv. In. Corr.
11
Attempted
0 M:25 S
Avg. Time

3 / 9

Choose the correct option.

Observe the following statements and decide what do they do.string mystring;getline(cin, mystring);


Areads a line of string from cin into mystring

Breads a line of string from mystring into cin

Ccin can't be used this way

Dnone of above

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
7
Solv. Corr.
4
Solv. In. Corr.
11
Attempted
0 M:0 S
Avg. Time

4 / 9

Choose the correct option.

Which is used to get the input during runtime?


Acout

Bcin

Ccoi

DNone of the mentioned

Answer: Option B

Explanation:

cin is mainly used to get the input during the runtime.

Workspace

NA
SHSTTON
3
Solv. Corr.
6
Solv. In. Corr.
9
Attempted
0 M:0 S
Avg. Time

5 / 9

Choose the correct option.

The ____________ objects have values that can be tested for various error conditions.


Aosstream

Bofstream

Cstream

Difstream

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
4
Solv. In. Corr.
4
Attempted
0 M:0 S
Avg. Time

6 / 9

Choose the correct option.

Which of the header file must be included to use stringstream?


A

B

C

D

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
0
Solv. Corr.
2
Solv. In. Corr.
2
Attempted
0 M:0 S
Avg. Time

7 / 9

Choose the correct option.

Which of the following header file does not exist?


A

B

C

D

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
3
Solv. Corr.
5
Solv. In. Corr.
8
Attempted
0 M:0 S
Avg. Time

8 / 9

Choose the correct option.

Which function return the current position of the get or put pointer in bytes.


Atellg( )

Btellp( )

Ctell( )

DBoth A and B

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace

NA
SHSTTON
6
Solv. Corr.
4
Solv. In. Corr.
10
Attempted
0 M:0 S
Avg. Time

9 / 9

Choose the correct option.

Where does a cin stops it extraction of data?


ABy seeing a blankspace

BBy seeing ()

CBoth a & b

DNone of these

Answer: Option A

Explanation:

cin will stop its extraction when it encounters a blank space.

Workspace