Computer Science, asked by qjebqkcy7497, 9 months ago

Rectify the error (if any) in the given statements.
>>>str = "Hello World"
>>>str[5] = ‘p’

Answers

Answered by rehmatsara
0

Explanation:

plz write properly can't understand

Answered by mariospartan
2

Answer:

Explanation:

Considering the code snippet, we have to assume few things:

Assumption 1: str is a character array

The program will not give any error. But if the program is from c, c++ or java definitely it would give error, because, the statement has to be terminated with ";"

Assumption 2: str is a string

str[5] : This statement will give fatal error, because "str" is declared as string and it is accessed like an array.

Assumption 3: If this is any other language and it allows statement to be end without ";" and str is character array.

Then, no error will appear and if you try to print str, then the output will be "HellopWorld". P will be entered in the 6th position of the given string

Similar questions