Strings – Yes / No Questions

1. Will the program compile successfully?

Will the program compile successfully

A. Yes
B. No

Correct Answer: B. No
Advertisement

2. For the following statements will arr[3] and ptr[3] fetch the same character?
char arr[] = “GkFeed”;
char *ptr = “GkFeed”;

A. Yes
B. No

Correct Answer: B. No
Advertisement

3. Is there any difference between the two statements?
char *ch = “GkFeed”;
char ch[] = “GkFeed”;

A. Yes
B. No

Correct Answer: A. Yes
Advertisement

Leave A Comment?