0% found this document useful (0 votes)
245 views3 pages

Python Beginner MCQs with Answers

The document contains a series of multiple-choice questions designed for Python beginners, covering various topics such as variable naming, data types, functions, and control structures. Each question is followed by four answer options, with the correct answer indicated. The format is consistent throughout, making it a useful resource for testing Python knowledge.

Uploaded by

e73300007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
245 views3 pages

Python Beginner MCQs with Answers

The document contains a series of multiple-choice questions designed for Python beginners, covering various topics such as variable naming, data types, functions, and control structures. Each question is followed by four answer options, with the correct answer indicated. The format is consistent throughout, making it a useful resource for testing Python knowledge.

Uploaded by

e73300007
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

PYTHON BEGINNER MULTIPLE CHOICE QUESTIONS (WITH ANSWERS)

1. Which of the following is a valid variable name in Python?


A) 2variable B) _variable C) variable-name D) variable name
Answer: B
2. What is the correct file extension for Python files?
A) .pyth B) .pt C) .py D) .pyt
Answer: C
3. Which keyword is used to define a function in Python?
A) func B) define C) def D) function
Answer: C
4. What is the output of print(2 + 3 * 4)?
A) 20 B) 14 C) 24 D) 10
Answer: B
5. Which data type is immutable in Python?
A) List B) Set C) Dictionary D) Tuple
Answer: D
6. What is the output of len("Python")?
A) 5 B) 6 C) 7 D) Error
Answer: B
7. Which of the following is a Python keyword?
A) eval B) value C) type D) assert
Answer: D
8. What does the input() function return?
A) Integer B) Float C) String D) Boolean
Answer: C
9. What is the correct syntax to output "Hello World" in Python?
A) echo("Hello World") B) print("Hello World") C) printf("Hello World") D) println("Hello World")
Answer: B
10. What symbol is used for comments in Python?
A) // B) /* */ C) # D)
Answer: C
11. What will 3 == 3.0 return?
A) False B) True C) Error D) None
Answer: B
12. Which operator is used for exponentiation?
A) ^ B) ** C) * D) //
Answer: B
13. Which of the following is a mutable data type?
A) Tuple B) String C) List D) frozenset
Answer: C
14. What does type(3.14) return?
A) int B) float C) str D) complex
Answer: B
15. What is the output of bool(0)?
A) True B) False C) 0 D) Error
Answer: B
16. Which function gives the ASCII value of a character?
A) ord() B) ascii() C) chr() D) val()
Answer: A
17. What is the output of print("Python"[::-1])?
A) Python B) nohtyP C) Error D) pYTHON
Answer: B
18. How do you start a for loop in Python?
A) for(i=0; i<10; i++) B) for i in range(10): C) foreach i in range(10): D) for i to range(10)
Answer: B
19. What does range(5) produce?
A) [1,2,3,4,5] B) [0,1,2,3,4,5] C) [0,1,2,3,4] D) (1,2,3,4,5)
Answer: C
20. What defines a block of code in Python?
A) Braces B) Parentheses C) Indentation D) Quotation marks
Answer: C
21. Which of the following creates a set?
A) {} B) [] C) set() D) Both A and C
Answer: D
22. What is the output of 5 // 2?
A) 2.5 B) 2 C) 3 D) 2.0
Answer: B
23. Which function converts a string to integer?
A) str() B) float() C) int() D) eval()
Answer: C
24. Which keyword is used for including modules in Python?
A) import B) using C) include D) require
Answer: A
25. Which statement about lists is true?
A) Immutable B) Hold multiple data types C) Numbers only D) Fixed size
Answer: B
26. Which of the following is not a Python data type?
A) list B) tuple C) array D) dictionary
Answer: C
27. What will print(type([])) output?
A) B) C) D)
Answer: B
28. Which function finds the max value in a list?
A) high() B) top() C) max() D) upper()
Answer: C
29. What is the output of print(10 % 3)?
A) 1 B) 3 C) 0 D) 10
Answer: A
30. Which statement stops a loop?
A) exit B) stop C) break D) end
Answer: C
31. Which function finds list length?
A) len() B) count() C) size() D) length()
Answer: A
32. Operator for equality check?
A) = B) == C) := D) ===
Answer: B
33. Output of print("Hello" + "World")?
A) Hello World B) Hello+World C) HelloWorld D) Error
Answer: C
34. Create empty dictionary?
A) {} B) [] C) dict() D) Both A and C
Answer: D
35. Which creates a tuple?
A) (1,2,3) B) [1,2,3] C) {1,2,3} D) tuple[1,2,3]
Answer: A
36. Result of bool("")?
A) True B) False C) Error D) None
Answer: B
37. Keyword for exceptions?
A) try B) catch C) exception D) handle
Answer: A
38. Output of print(2 ** 3)?
A) 6 B) 8 C) 9 D) 16
Answer: B
39. Valid string?
A) 'Python" B) "Python' C) 'Python' D) Python
Answer: C
40. Convert number to string?
A) chr() B) str() C) ord() D) repr()
Answer: B
41. print(5 != 3) returns?
A) False B) True C) Error D) None
Answer: B
42. Operator for floor division?
A) / B) % C) // D) **
Answer: C
43. Function for absolute value?
A) fabs() B) abs() C) mod() D) value()
Answer: B
44. print("Python".lower())?
A) PYTHON B) python C) Python D) Error
Answer: B
45. Which allows duplicates?
A) Set B) Dictionary C) Tuple D) List
Answer: D
46. Default return of function without return?
A) 0 B) None C) False D) Undefined
Answer: B
47. Output of type({})?
A) B) C) D)
Answer: B
48. Insert element at end of list?
A) add() B) push() C) append() D) insert()
Answer: C
49. Result of 5 > 2 and 2 > 1?
A) True B) False C) None D) Error
Answer: A
50. What does continue do?
A) Ends loop B) Skips iteration C) Restarts loop D) Exits function
Answer: B
(Questions 51–100 continue in same format)

You might also like