Question
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
char arr[20];
6.
int i;
7.
for(i = 0; i < 10; i++)
8.
*(arr + i) = 65 + i;
9.
*(arr + i) = '\0';
10.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
int main()
4.
{
5.
char arr[20];
6.
int i;
7.
for(i = 0; i < 10; i++)
8.
*(arr + i) = 65 + i;
9.
*(arr + i) = '\0';
10.
cout
Answer: Option A
Was this answer helpful ?
Each time we are assigning 65 + i. In first iteration i = 0 and 65 is assigned. So it will print from A to J.
$ g++ point1.cpp
$ a.out
ABCDEFGHIJ
Was this answer helpful ?
More Questions on This Topic :
Question 4.
Which of the following is illegal?
....
Question 5.
Choose the right option string* x, y;
....
Submit Solution