Which line of code produces an error?
a. “one” + ‘two’
b. 1+2
c. “one” + “2”
d. ‘1’ + 2
Answers
Answered by
5
Answer:
I think (c)
if wrong then sorry
Answered by
2
d. '1' + 2 is the correct option.
In any programming language, there is a concept of datatypes that is the true definition of a variable defined by the user.
- In the first and third options, both are of string datatype which can be operated.
- In the second option, both are of integer datatype that too can be operated.
- But in the fourth option, one of it is of string and the other is of integer data type. It is an improper data type conversion to be operated on. So, it will give an error on execution of "unsupported operand type".
Similar questions
English,
3 months ago
Science,
3 months ago
Computer Science,
3 months ago
Math,
6 months ago
Math,
6 months ago
History,
10 months ago
Geography,
10 months ago
Political Science,
10 months ago