array-and-strings
1).Which of the following is the correct syntax to declare an array in C++?
2).What is the index of the first element of an array in C++?
3).What will be the output of the following code?
#include <iostream>
using namespace std;
int main() {
int arr[] = {10, 20, 30, 40};
cout << arr[1];
return 0;
}
4).Which function is used to find the length of a string in C++?
5).Which of the following is the correct way to initialize a string in C++?
6).Which of the following functions is used to copy one string to another in C++?
7).What will be the output of the following code?
#include <iostream>
#include <cstring>
using namespace std;
int main() {
char str1[] = "Hello";
char str2[] = "Hello";
cout << (strcmp(str1, str2) == 0 ? "Equal" : "Not Equal");
return 0;
}