Quiz: Strings, Streams and Formatting

Test your understanding of strings, streams and formatting.

1

What is the output of the following code?

int main() {
    char text[]{ "protocol" };
    string_view sv1{ text };
    string str1{ text };
    text[5] = 'k';
    cout << format("sv1: {}\n",  sv1);
    cout << format("str1:  {}\n",  str1);

}
A)
sv1: protokol
str1:  protokol
B)
sv1: protokol
str1:  protocol
C)
sv1: protocol
str1:  protokol
D)
sv1: protocol
str1:  protocol
Question 1 of 60 attempted

Get hands-on with 1200+ tech skills courses.