42. Which of the following is true regarding the declaration of a string in C++ using the char array?
43. Which is an instantiation of the basic_string class template?
44. What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str="Steve Jobs founded the apple";
string str2 = str.substr (6, 4);
unsigned pos = str.find("the");
string str3 = str.substr (pos);
cout << str2 << ' ' << str3 << '\n';
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str="Steve Jobs founded the apple";
string str2 = str.substr (6, 4);
unsigned pos = str.find("the");
string str3 = str.substr (pos);
cout << str2 << ' ' << str3 << '\n';
return 0;
}45. What will be the output of the following C++ code?
#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
int a = 5, b = 10, c = 15;
int arr[3] = {&a, &b, &c};
cout << *arr[*arr[1] - 8];
return 0;
}
#include <stdio.h>
#include<iostream>
using namespace std;
int main()
{
int a = 5, b = 10, c = 15;
int arr[3] = {&a, &b, &c};
cout << *arr[*arr[1] - 8];
return 0;
}46. What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("Steve jobs");
cout << str.length();
return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main ()
{
string str ("Steve jobs");
cout << str.length();
return 0;
}47. What will happen if a string is empty?
48. How many parameters can a resize method take?
49. What will be the output of the following C++ code?
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
int array[] = {10, 20, 30};
cout << -2[array];
return 0;
}
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
int array[] = {10, 20, 30};
cout << -2[array];
return 0;
}