21. What is the purpose of the modulo operator (%) in Python? A. Finding the exponent B. Multiplying numbers C. Calculating the square root D. Calculating the remainder Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D Solution: The % operator calculates the remainder of division.
22. What is the result of round(3.75) ? A. 3 B. 3.75 C. 4 D. 3.5 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C Solution: The round() function rounds a floating-point number to the nearest integer.
23. What is the output of this expression, 3*1**3? A. 27 B. 9 C. 3 D. 1 Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option C No explanation is given for this question Let's Discuss on Board
24. What is the purpose of the == operator in Python? A. Assignment B. Comparison for equality C. Exponentiation D. Concatenation Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: The == operator is used to compare if two values are equal.
25. Which of the following is invalid? A. _a = 1 B. __a = 1 C. __str__ = 1 D. none of the mentioned Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D No explanation is given for this question Let's Discuss on Board
26. What is the result of not (5 > 3) ? A. True B. False C. None D. Error Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B Solution: The not operator returns the opposite of its operand's boolean value.
27. Which of the following is a valid way to comment a single line in Python? A. \ comment B. / comment C. <!-- comment --> D. # comment Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option D Solution: The # symbol is used to comment a single line in Python.
28. Which one of the following has the same precedence level? A. Addition and Subtraction B. Multiplication, Division and Addition C. Multiplication, Division, Addition and Subtraction D. Addition and Multiplication Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A No explanation is given for this question Let's Discuss on Board
29. Which of the following is an invalid variable? A. my_string_1 B. 1st_string C. foo D. _ Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option B No explanation is given for this question Let's Discuss on Board
30. What is the result of "hello" * 3 ? A. "hellohellohello" B. "hello3" C. "3hello" D. "hhheeellllllooo" Answer & Solution Discuss in Board Save for Later Answer & Solution Answer: Option A Solution: The * operator repeats a string a specified number of times.