Difficulty: Easy
Correct Answer: Error
Explanation:
Introduction / Context:
This item checks type correctness in C. The code attempts to assign a string literal (type char) to one element of a char array (type char). That is a type mismatch at compile time.
Given Data / Assumptions:
Concept / Approach:
In C, assignment requires compatible types. A char cannot receive a pointer value. Additionally, str[6] is beyond the current string's terminator (indexing 0..4 for "India", index 5 is '\0'), but even aside from bounds, the type mismatch alone is a compile-time error.
Step-by-Step Solution:
Parse the assignment: str[6] (char) = "CURIOUSTAB" (char*).The types are incompatible → diagnostic issued by the compiler.The program does not compile successfully in standard C or Turbo C.
Verification / Alternative check:
To copy text into the array, use strcpy(&str[6], "CURIOUSTAB") provided there is enough space in str (which there is not here). Or assign a single character, e.g., str[6] = 'X'.
Why Other Options Are Wrong:
(a), (b), (c) imply successful compilation and runtime behavior. Given the type error, no such output occurs. (e) presumes runtime but compilation fails first.
Common Pitfalls:
Confusing characters with strings; forgetting that string literals denote pointers to char (array-to-pointer decay).
Final Answer:
Error
Discussion & Comments