304 Final Questions and Correct Answers/
Latest Update / Already Graded
Are Python 2 and Python 3 interchangeable?
Ans: No, things that work in Python 2 will not work in Python 3.
What types of objects does Python have?
Ans: None (null), numeric types (int, bool, float, complex),
sequences (str, list, tuple, byte/bytearray), sets, mappings
(dict).
Are most objects in Python mutable or immutable?
Ans: Most objects are immutable and can't be changed once
they're set.
What types of loops does Python support?
Ans: While loops and for loops (for <valname> in <list>:).
What are the characteristics of lists in Python?
Ans: Lists are ordered, accessed by index, mutable, can hold
objects of arbitrary types, and are dynamically sized.
All rights reserved © 2025/ 2026 |
, Page |2
What are the characteristics of tuples in Python?
Ans: Tuples are immutable, support sequence packing and
unpacking, and are accessed by attribute.
How does Python support multiple assignment?
Ans: Through multiple assignment and sequence packing and
unpacking.
How do you define a function in Python?
Ans: Using the syntax: def <func_name>(parameter).
What is the difference between class variables and instance variables?
Ans: Class variables have the same value across all instances,
while instance variables are specific to each instance.
What is a deep copy in Python?
Ans: A deep copy constructs a new compound object and
recursively inserts copies of the objects found in the original.
All rights reserved © 2025/ 2026 |
, Page |3
What is a shallow copy in Python?
Ans: A shallow copy constructs a new compound object and
inserts references into it.
What is the syntax for inheritance in Python?
Ans: class Subclass(SuperClass1, SuperClass2, ...):
What is the 'deadly diamond of death' in multiple inheritance?
Ans: Ambiguity arising when two classes inherit from a
common superclass.
What is dynamic typing in Python?
Ans: Variable types are determined at runtime.
What is dynamic binding in Python?
Ans: Implementation is looked up at runtime.
What is a list comprehension?
Ans: A tool for turning an iterable into another iterable.
All rights reserved © 2025/ 2026 |