Exam GPYC All QuestionsBrowse all questions from this exam
Question 20

What is the output when the following commands are typed in Python interactive mode?

    Correct Answer: C

    When running the given commands in Python interactive mode, the output will be 'ac'. The expression 'a = 5' and 'b = 10' assign integer values to the variables 'a' and 'b'. However, these assignments do not affect the concatenation operation 'd = "a" + "c"'. Here, 'a' and 'c' are string literals, and the '+' operator concatenates them, resulting in the string 'ac'. Therefore, the 'print(d)' statement will output 'ac'.

Discussion
AZIrvThoOption: C

When running this code: a = 5 b = 10 d = "a" + "c" print (d) The response is: ac