Python Fundamentals Quiz: 99 Essential Concepts

Section 1: Basics, Variables, and Data Types (Q1–Q16)

Q1 Who created Python? Yeongin Kim / Bill Gates / Justin Martin / Guido Van Rossum

Q2 What does the Garbage Collector do? Hides memory / Deletes object permanently, frees memory / Renames object / Creates new object

Q3 What type of language is Python? Compiled / Dismissed / Interpreted / Associated

Q4 A Syntax Error occurs when misusing: Keywords / Parenthesis / Punctuations / One of the above

Q5 A Logical Error results in: Unexpected output / Crash / Error message / One of the above

Q6 Which is not a data type? Expression / Integer / Boolean / String

Q7 Which character is allowed in an identifier? @ / _ / $ / .

Q8 Which data type is used for numbers, letters, and symbols? Integer / String / Boolean / Float

Q9 Which data type is best for storing a phone number? Integer / Float / String / Boolean

Q10 What is the memory location for mutable data? Variable / Constant / Value / Iteration

Q11 What symbol is used to assign a variable? == / – / + / =

Q12 Which is the correct variable declaration? name = “Peter” / name = Peter / variable_name = Peter / variable name = “Peter”

Q13 Which is the correct way to add values? int answer = a + b / answer = sum(a, b) / int answer = sum(a, b) / answer = a + b

Q14 What is the number or word assigned to a variable called? Bug / Information / Value / Text

Q15 String concatenation is a method to: Make constant / Combine two or more strings / Count characters / Reassign values

Q16 The input() function stores data as a: String / Integer / Float / All of the above

Section 2: Control Flow and Error Handling (Q17–Q25)

Q17 Converting a float to an integer rounds up? True / False

Q18 A Try Except Block is useful for: Logical decisions / Conditional evaluation / Handling user input errors / Converting data types

Q19 Conditional statements are used for: Handle input errors / Model decisions in code / Evaluate data types / Concatenate strings

Q20 if statements are used for: Add integers / Evaluate single or multi-alternative decisions / Check type / Allocate memory

Q21 Which is not a common conditional operator category? Comparison / Membership / Logical / Boolean

Q22 Which is not a logical operator? & / Equals / Or / Not

Q23 Membership operators check: Add object / Check type / Handle errors / If an object contains a specific value

Q24 elif is used for: Check multiple conditions in the same structure / Check one condition / Add multiple into one / Print operator name

Q25 Given studentGrade=71 and the grading scale: if <=55 fail; elif >55 <=65 D; elif >65 <=75 C; elif >75 <=85 B; elif >85 A → What is the output? A / B / C / D / Fail

Section 3: Collections and Loops (Q26–Q35)

Q26 Data collection is useful for: Garbage collection / Only integers / Store multiple elements in one container / Only characters

Q27 A list is immutable. False / True

Q28 A Nested list is: A list inside a list / Only integers / Only characters / End of program

Q29 while loops are: Indefinite / Definite

Q30 for loops are: Definite / Indefinite

Q31 The continue statement will: Exit loop / Reset iterator / Jump to the top, starting the next iteration / Exit program

Q32 The break statement will: Exit program / Exit the current loop / Reset iterator / Jump to the top

Q33 pass is used for: Placeholder to test logic with no code yet / Go to beginning / Check statements / Exit loop

Q34 A Nested loop is: A loop within a loop / Calls a function / End of program / Only lists

Q35 A List loop is used to: Iterate over list items / List at start / List at end / Only after a loop

Section 4: Debugging and Code Evaluation (Q36–Q55)

Q36 What kind of error is this? (Depends on the missing code; not determinable here.) Syntax / Logical

Q37 Will this cause a syntax error? (Depends on the missing code; not determinable here.) Yes / No

Q38 Will this cause a syntax error? (Depends on the missing code; not determinable here.) Yes / No

Q39 Which calls a function without a syntax error? print(“your name is input()”) / name = “Yeongin” / name = print(your name is input()) / name = “input()”

Q40 How do you check an intermediate value during execution? Use print() / Use input() / Use isdigit() / None

Q41 Which is not allowed in a variable name? _ / Number at start (e.g., 1) / quotes (” “) / All of the above

Q42 Best type for a circle radius: Integer / String / Boolean / Float

Q43 Best type for a zipcode: Integer / String / Boolean / Float

Q44 Output (user enters 10 & 8): Not determinable without the code. 10 / 8 / 18 / 80 / 108 / None

Q45 Output of code: Not determinable without the code. 0 / 1 / 2 / 3 / None

Q46 Output of code: Not determinable without the code. hun / m hu / h / hun / hu / None

Q47 Which evaluates to True? 10 < 5*2 / 3 == 3 / 7!=7 / 5>=2 / None

Q48 What will it print? Not determinable without the code. Success / Error / None

Q49 What is the LAST line printed? Not determinable without the code. Valid / Invalid / None

Q50 What will it print? Condition Met / Condition Not Met / Error / Nothing (Not determinable without code; most likely “Condition Not Met”)

Q51 What will it print? hi Raion / Medium / Low / Error (zero division) / Nothing (Not determinable without code)

Q52 What will it print? Checking… / Cannot divide by zero / … (Sequence depends on code; not determinable here)

Q53 Updated list: [0,5,10,0,15] / [10.0, 5, 10, 10.0, 15] / [10.0,5,10.0,10.0,15] / None

Q54 Inputs “N” then “Y” → Go to Reynolda! / Putter’s / Einstein! / None

Q55 The strip() method result: “Welcome to Python programming!” / Welcome… / (spaces only) / None (Correcting the output text based on standard strip behavior.)

Section 5: Functions and Object-Oriented Programming (Q56–Q64)

Q56 Method to safely retrieve attribute values: accessor / mutator / setter / class

Q57 A value-returning function: Single statement / Called to stop / Returns a value to the caller / Receives a value

Q58 Methods that change attributes: getter / setter / instances / constructors

Q59 Value of list2: Not determinable without the code. [1,2,3] / [4,5,6] / [1..6] / Invalid

Q60 To share common attributes across classes, you should write a: superclass / subclass / object / method / class attributes

Q61 Combining data and code into one object is called: modularity / instantiation / encapsulation / objectification

Q62 A subclass inherits: instances + attributes / objects + methods / methods + instances / attributes + methods

Q63 Correct inheritance syntax (in Python context): animal[dog] / dog.animal / animal(dog) / dog(animal)

Q64 Correct way to create a Worker object: def__init__(…) / class worker_joey: / worker_joey = Worker() / worker_joey.Worker

Section 6: Advanced Data Structures (Q65–Q72)

Q65 Dictionary display result: Not determinable without the full code. {‘FL’: ‘Tallahassee’} / KeyError / {…} / {…}

Q66 Values sent to a function are called: Instances / Parameter / Variables / Arguments

Q67 The key difference between a tuple and a list is: no commas / only strings / no lists inside / tuple is immutable

Q68 Dictionary lookup uses the: datum / element / item / key / value

Q69 Which statement is true about Python functions? You can return data collections / Only strings / Only numerics / None

Q70 Which does not apply to sets? Different types allowed / Unique elements / Unordered / Elements are in pairs

Q71 An advantage of a tuple is: Not limited size / One data as element / Good for static, unchanging values / Never advantageous

Q72 Result after code: Not determinable without the code. 30 / 25 / 0..20 step5 / 5,10,15

Section 7: Scope, Modules, and Advanced Topics (Q73–Q99)

Q73 The code accepts: Accepts 3 scores for each of 3 students; outputs each student’s average / 4 scores for 3 students overall average / 4 scores for 2 students overall average / 1 score for 3 students overall average

Q74 It is generally best practice to avoid using global variables / local / string / keyword

Q75 Resulting output: Not determinable without the code. 81 / 64 / 24 / 12 / None

Q76 Resulting output: 70 / 25 / 100 / 50 / Syntax error

Q77 Resulting output: Julian Smith / Smith Julian / Julian, Smith / Smith, Julian / Not determinable without the code.

Q78 Hiding unnecessary details is called: abstraction / encapsulation / inheritance / polymorphism

Q79 self refers to: Terminate / Reset class / Number of parameters / the instance being used

Q80 Extending a class requires full access to parent internals. False / True

Q81 Which is true about user-defined functions? Return required / Variables created inside are only accessible inside / Body uses brackets / Must have ≥1 parameter

Q82 Output: Hello, Taelyn followed by None / Hello, Taelyn then Hello, / Taelyn / None / Syntax Error

Q83 About the code: focus is argument / 3 vs 4 arguments error / print(score) prints local / score inside function is local; later score is global / Nothing

Q84 How to return payment & DTI: Can’t return multiples / print inside function / Return a list [payment, dti] / 2 return statements

Q85 The purpose of if __name__ == "__main__": is to: Run code only when the script is executed directly, not when imported / Ensures main() only when imported / Prevents defining main() / Required syntax

Q86 Output: Hello from C! / Hello from D! / section_c.py is being run. / Nothing

Q87 An instance of a class is an: Object / Function / Attribute / Method

Q88 Value of sum: 6 / 10 / 15 / 21 / None

Q89 Output: 1 / 3 / 5 / 0 / None

Q90 mystery(3): 6 / 9 / 8 / Error

Q91 tricky_counter(4): 2 / 4 / 5 / 3

Q92 LAST line printed: 1 / 2 / 3 / 4 / None

Q93 LAST line printed: 1 / 2 / 3 / 4 / None

Q94 LAST line printed: Model X is a Tesla car / Model X moves / Tesla car Model X drives on roads / Error / None

Q95 print(obj.show()): 15 / 20 / 25 / 30 / None

Q96 LAST line printed: Name printed / TypeError (tuple item assignment) / Runs but not updated / IndexError

Q97 customer[“membership”]: Platinum / Gold / Silver / Bronze

Q98 shift_numbers on tuple: (0,1,0) / (1,1,0) / (0,1,1) / (1,0,1) / None (TypeError; tuple is immutable)

Q99 orders dictionary after updates: {‘Alice’: {‘pizza’: 2, ‘pasta’: 0}, ‘Bob’: {‘pasta’: 1, ‘pizza’: 2}} / {‘Alice’: {‘pizza’: 2}, …}