C++ I/O Streams and String Basics

Mixed content quiz covering C++ I/O stream operations (iostream, cin, cout) and basic string manipulation concepts

6 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

The __________ class is used for manipulating the strings in C++.

  1. string
  2. Strin
  3. str
  4. character
Question 2 Multiple Choice (Single Answer)

Which of the following is correct with respect to the statements given below?
A. Strings that do not contain blank spaces can be read by cin.
B. cin only reads a character.

  1. Only A
  2. Only B
  3. A is true and B is false
  4. A is false and B is true
Question 3 Multiple Choice (Single Answer)

How many operators are available for the string objects?

  1. 9
  2. 10
  3. 11
  4. 12
Question 4 Multiple Choice (Single Answer)

What is the meaning of the following statement?
s1.insert(4,s2);
Where s1 and s2 are string variables.

  1. Insert first five character of s2 into s1 at last position
  2. Insert string s2 after 4th position in string s1
  3. Insert string s2 at 4th position in string s1
  4. Insert string s1 at 4th position in string s2
Question 5 Multiple Choice (Single Answer)

If we use ___________ data structure, there is no alternative to pointers.

  1. static
  2. dynamic
  3. linear
  4. non-linear
Question 6 Multiple Choice (Single Answer)

If there is an array Num[50] of integer type with size 50, then what is the correct way to store the address of an array Num in pointers variable p of integer type?

  1. p=&Num;
  2. p=Num;
  3. p=Num[0];
  4. p=Num[50];