Rectify the error (if any) in the given statements.
>>>str = "Hello World"
>>>str[5] = ‘p’
Answers
Answered by
0
Explanation:
plz write properly can't understand
Answered by
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
Science,
4 months ago
Math,
4 months ago
Computer Science,
9 months ago
Computer Science,
9 months ago
Physics,
1 year ago
Math,
1 year ago