Govt. Exams
Entrance Exams
Only option B defines x before using it. Other options reference undefined variables, causing NameError.
int(x) converts the string '10' to integer 10. Adding 5 gives 15 (integer addition).
'a' * 3 produces 'aaa' and 'b' * 2 produces 'bb'. Concatenating gives 'aaabb'.
append() adds an element to the list. After adding 4, the list has 4 elements, so len(x) = 4.
The max() function returns the largest element in the list, which is 9.
Variable names can contain letters, digits, and underscores, but cannot start with a digit or contain hyphens or spaces.
abs(-5) = 5 and abs(3) = 3. Therefore, 5 + 3 = 8.
Empty curly braces {} create an empty dictionary, not a set. To create an empty set, use set().
x and y are separate variables. Assigning y = 10 doesn't change x, which remains 5.
The 'in' operator checks for substring presence. 'a' is in 'apple', so it returns True.