Which of the following is the correct way to declare a string variable in C++?
Which of the following is not a valid method to concatenate two strings in C++?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
What is the output of the following code snippet?
string s = "Hello World";
cout << s.length() << endl;
Which of the following string functions can be used to find the first occurrence of a character in a string?
Which of the following functions can be used to convert a string to uppercase in C++?
What is the maximum length of a string that can be stored in C++?
Which of the following is the correct way to compare two strings in C++?
What is the output of the following code snippet?
string s = "Hello World";
cout << s.substr(6) << endl;
Which of the following functions can be used to convert a string to an integer in C++?
What is the output of the following code snippet?
string s = "Hello World";
s.replace(6, 5, "Everyone");
cout << s << endl;
What is the output of the following code snippet?
```cpp
string s = "Hello";
s += " World";
cout << s << endl;
```
What is the output of the following code snippet?
```cpp
string s = "Open";
string t = "AI";
string u = s + t;
cout << u.length() << endl;
```
What is the output of the following code snippet?
```cpp
string s = "OpenAI";
cout << s.at(5) << endl;
```
What is the output of the following code snippet?
```cpp
string s = "Hello World";
int index = s.find("World");
cout << index << endl;
```
What is the output of the following code snippet?
```cpp
string s = "OpenAI";
s[4] = 'B';
cout << s << endl;
```
What will be the output of the following code?
```cpp
string s = "abcdefgh";
cout << s.substr(1, 3);
```
What will be the output of the following code?
```cpp
string s = "Hello";
cout << s.erase(1, 2);
```
What will be the output of the following code?
```cpp
string s = "apple";
string t = "apple";
if (s == t)
cout << "Equal";
else
cout << "Not Equal";
```
What will be the output of the following code?
```cpp
string s = "abc";
cout << s.find_first_of("def");
```
What will be the output of the following code?
```cpp
string s = "Hello World";
cout << s.replace(6, 5, "Everyone").length();
```
70 videos|45 docs|15 tests
|
70 videos|45 docs|15 tests
|