Question
1.
#include
2.
#include
3.
using namespace std;
4.
int main ()
5.
{
6.
char str1[10] = "Hello";
7.
char str2[10] = "World";
8.
char str3[10];
9.
int len ;
10.
strcpy( str3, str1);
11.
strcat( str1, str2)
12.
len = strlen(str1);
13.
cout
What is the output of this program?
1.
#include
2.
#include
3.
using namespace std;
4.
int main ()
5.
{
6.
char str1[10] = "Hello";
7.
char str2[10] = "World";
8.
char str3[10];
9.
int len ;
10.
strcpy( str3, str1);
11.
strcat( str1, str2)
12.
len = strlen(str1);
13.
cout
Answer: Option D
Was this answer helpful ?
In the program, We are concatanating the str1 and str2 and printing
it’s total length. So the length is 10.
Output:
$ g++ stri.cpp
$ a.out
10
Was this answer helpful ?
Submit Solution