CBSE Class 11 Computer Science
Question 125 of 173
Data Handling — Question 14
Back to all questions 14
Question Question 10
Consider the following code segment:
a = input("Enter the value of a:")
b = input("Enter the value of b:")
print(a + b)If the user runs the program and enters 11 for a and 9 for b then what will the above code display?
Answer
Output
Enter the value of a:11
Enter the value of b:9
119
Explanation
input() function accepts user input as string type. The data type of a and b is string not int so addition operator concatenates them to print 119 instead of 20.