What is the output of this C++ program?
#include <iostream>
#include <cstring>
using namespace std;
int main ()
{
char str1[10] = "Hello";
char str2[10] = "World";
char str3[10];
int len ;
strcpy( str3, str1);
strcat( str1, str2);
len = strlen(str1);
cout << len << endl;
return 0;
}
What is the output of this C++ program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("microsoft");
string::reverse_iterator r;
for (r = str.rbegin() ; r < str.rend(); r++ )
cout << *r;
return 0;
}
What is the output of this C++ program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("nobody does like this");
string key ("nobody");
size_t f;
f = str.rfind(key);
if (f != string::npos)
str.replace (f, key.length(), "everybody");
cout << str << endl;
return 0;
}
What is the output of this C++ program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("steve jobs is legend");
string::iterator it;
str.erase (str.begin()+ 5, str.end()-7);
cout << str << endl;
return 0;
}
What is the output of this C++ program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("Microsoft");
for (size_t i = 0; i < str.length();)
{
cout << str.at(i-1);
}
return 0;
}
What is the output of this C++ program?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("Ubuntu");
cout << str.capacity();
cout << str.max_size();
return 0;
}
How many types of representation are in string in C++?
Which function is used to return the number of characters in a string in C++?
What is the output of this C++ program?
#include <iostream>
using namespace std;
int main()
{
char str[5] = "ABC";
cout << str[3];
cout << str;
return 0;
}
What will be the output of the following C program?
#include<stdio.h>
int main()
{
char str1[ ] = "abcd";
char str2[ ] = "abcd";
if(str1==str2)
printf("Equal");
else
printf("Unequal");
}
If the two strings are equal, then the C function strcmp() returns the value?
In C/C++ which inbuilt function is used to find the last occurrence of a character in a given string?
What will be the output of this C program ?
#include<stdio.h>
#include<string.h>
int main()
{
char str1[20] = "Hello", str2[20] = "World";
printf("%s", strcpy(str2, strcat(str1, str2)));
}
What will be the output of this C program ?
#include<stdio.h>
int main()
{
printf(5+"Good Morning\n");
}
What will be the output of this C program ?
#include<stdio.h>
int main()
{
char str[ ] = "Hello\0World";
printf("%s", str);
}
What is the output of this C code?
#include <stdio.h>
int main()
{
char *s= "hello";
char *p = s;
printf("%c %c", 1[p], s[1]);
}
What is the output of this C code?
#include <stdio.h>
int main()
{
char *s = "hello";
char *n = "cjn";
char *p = s + n;
printf("%c %c", *p, s[1]);
}
What is the output of this C code?
#include <stdio.h>
#include<string.h>
int main()
{
char *str = "hello, world\n";
char *strc = "good morning\n";
strcpy(strc, str);
printf("%s\n", strc);
return 0;
}
What is the output of this C code if an integer pointer value takes 4 bytes and a character takes 1 byte?
#include <stdio.h>
int main()
{
char *str = "hello world";
char strary[ ] = "hello world";
printf("%d %d\n", sizeof(str), sizeof(strary));
return 0;
}
What is the output of this C code?
#include <stdio.h>
void fun(char *k)
{
k++;
k[2] = 'm';
printf("%c\n", *k);
}
int main()
{
char s[ ] = "hello";
fun(s);
}