Completed
Data Types & Operators
Questions From This Challenge
Q1mcq1 mark
Which of the following is a mutable data type in Python?
list ✓
int
float
str
Q2mcq1 mark
Which of the following is immutable in Python?
String ✓
List
Dictionary
A list of numbers
Q3mcq1 mark
Consider `a = [1, 2, 3]` followed by `a.append(4)`. Why is this allowed even though `a` was already created?
Because lists are mutable, so their contents can be changed in place ✓
Because lists are immutable, so a new list is always created
Because append() converts the list into a dictionary
Because integers inside the list are mutable
Q4mcq1 mark
If `s = "cat"` and a student tries `s[0] = "b"`, what is the result?
It raises a TypeError because strings are immutable ✓
It successfully changes s to "bat"
It creates a new variable named s[0]
It silently does nothing and s stays "cat"
Q5mcq1 mark
Which operator in Python performs floor (integer) division?
// ✓
/
%
**
Q6mcq1 mark
What does the % operator compute in Python?
The remainder after division ✓
The floor division result
The exponent (power)
The exact quotient with decimals
Q7mcq1 mark
Which operator is used for exponentiation in Python?
** ✓
^
//
%%
Q8mcq1 mark
Which operator checks whether two values are NOT equal in Python?
!= ✓
<>
!==
~=
Q9mcq1 mark
Which of these is correct when comparing an integer 5 with a float 5.0 using `5 == 5.0`?
True, because Python compares values regardless of int/float type ✓
False, because int and float are always considered different data types
It raises a TypeError since types differ
It compares them as strings
Q10mcq1 mark
Which logical operator returns True only if both operands are True?
and ✓
or
not
xor
Q11mcq1 mark
What does the `not` operator do to a Boolean value?
It reverses True to False and False to True ✓
It combines two Boolean values with AND logic
It combines two Boolean values with OR logic
It always returns True regardless of the input
Q12mcq1 mark
In the expression `(5 > 3) and (10 < 2)`, what is the result?
False ✓
True
Error
None
Q13output1 mark
What is the output of the following code?
a = 17 b = 5 print(a // b, a % b, a ** 2)
Correct output:
3 2 289Q14output1 mark
What is the output of the following code?
x = 7 y = 3 print(x > y and y > 0)
Correct output:
TrueQ15output1 mark
What is the output of the following code?
p = 10 q = 4 print(p / q) print(p // q)
Correct output:
2.5
2