











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












SECTION 1: Python Basics & Syntax (Q1โ25)
1. Which symbol is used for comments in Python? A. // B. /* */ C. # D. -- Answer: C Explanation: Python uses # for single-line comments. 2. Which function outputs text to the console? A. echo() B. print() C. output() D. write() Answer: B Explanation: print() displays output in Python. 3. Which of the following is a valid variable name?
A. 2value B. my-value C. my_value D. class Answer: C Explanation: Variable names cannot start with numbers or be keywords.
4. What is the output of the following code? print(type(10)) A. int B. integer C. D. number Answer: C Explanation: Python displays data types using class notation. 5. Which data type stores text? A. int B. float C. str D. bool **Answer: C
D. float(x) Answer: B
10. Which keyword defines a function? A. func B. define C. def D. function **Answer: C SECTION 2: Conditionals (Q26โ50)
C. Error D. Nothing Answer: A
28. Which comparison checks inequality? A. == B. >= C. != D. <= **Answer: C
34. Which keyword ends a conditional block? A. end B. stop C. Indentation D. break **Answer: C
print(i) A. 1 2 3 B. 0 1 2 C. 0 1 2 3 D. Error Answer: B
53. Which keyword stops a loop immediately? A. stop B. end C. break D. exit **Answer: C
59. Which loop checks condition before execution? A. for B. while C. repeat D. do **Answer: B
C. return D. give Answer: C
83. What is printed? def add(a, b): return a + b print(add(2, 3)) A. 2 B. 3 C. 5 D. Error **Answer: C
def f(x=5): A. Error B. Required parameter C. Optional parameter D. Loop Answer: C
90. How many values can a function return? A. One B. Two C. Unlimited D. None **Answer: C SECTION 5: Data Structures (Q106โ130)
D. Set Answer: B
108. How do you access first list element? lst = [10, 20, 30] A. lst(0) B. lst[1] C. lst[0] D. lst.first() **Answer: C
115. Indexing starts at: A. 1 B. - C. 0 D. Any **Answer: C SECTION 6: Strings, Errors & Final Concepts (Q131โ150)
C. Misspelled keyword D. All of the above Answer: D
134. What is a runtime error? A. Compile issue B. Error during execution C. Syntax issue D. Comment issue **Answer: B
141 โ 150: Final Exam Logic (Rapid Review)
Python is case-sensitive โ True = assigns values โ True == compares values โ True Lists are mutable โ True Tuples are immutable โ True Dictionaries use keys โ True Indentation defines blocks โ True input() returns string โ True Functions improve reusability โ True D335 OA tests problem-solving โ True