
Mott MacDonald


Mott MacDonald Python Software Developer Interview Questions and Answers
Q1. Difference between static and instance methods in python? Explain what decorator to use for defining static methods?
Static methods are bound to the class itself, while instance methods are bound to instances of the class. Use @staticmethod decorator for static methods.
Static methods do not have access to class or instance attributes, while instance methods do.
Instance methods can modify instance state, while static methods cannot.
To define a static method in Python, use the @staticmethod decorator before the method definition.
Example: ```python class MyClass: @staticmethod def static_metho...read more
Q2. What is inheritence? How many types of inheritence are there in python?
Inheritance is a mechanism in which a new class inherits attributes and methods from an existing class.
Inheritance allows a class to reuse code from another class.
Python supports single, multiple, and multilevel inheritance.
Example: class ChildClass(ParentClass):
Q3. What are access specifiers in Python, how are they set-up?
Access specifiers in Python control the accessibility of class attributes and methods.
Access specifiers are not explicitly defined in Python like in other languages such as Java or C++.
By convention, attributes and methods starting with a single underscore (_) are considered 'protected' and should not be accessed directly.
Attributes and methods starting with double underscores (__) are considered 'private' and are name-mangled to prevent direct access.
Q4. Difference between Shallow copy and Deep copy?
Shallow copy creates a new object but does not duplicate nested objects, while deep copy creates a new object with all nested objects duplicated.
Shallow copy only copies the references of nested objects, not the objects themselves.
Deep copy creates new copies of all nested objects, ensuring complete independence.
In Python, shallow copy can be achieved using the copy() method, while deep copy can be achieved using the deepcopy() method from the copy module.
Q5. What is MVT architecture?
MVT architecture stands for Model-View-Template architecture, commonly used in web development with Django framework.
MVT separates the logic of an application into three components: Model, View, and Template.
Model represents the data structure, View handles the user interface and business logic, and Template manages the presentation layer.
MVT is similar to MVC (Model-View-Controller) architecture but with a different naming convention.
Example: In Django, models.py defines the...read more
Q6. What are decorators in Python?
Decorators in Python are functions that modify the behavior of other functions or methods.
Decorators are denoted by the @ symbol followed by the decorator name.
They allow you to wrap another function in order to extend or modify its behavior.
Decorators are commonly used for logging, authentication, and memoization.
Example: @staticmethod decorator in Python is used to define a method that is not bound to an instance of a class.
Q7. Difference between Lists and Tuples?
Lists are mutable, ordered collections of items while tuples are immutable, ordered collections of items.
Lists are defined using square brackets [] while tuples are defined using parentheses ().
Lists can be modified (add, remove, change elements) while tuples cannot be modified once created.
Lists are typically used for collections of similar items that may need to be modified, while tuples are used for fixed collections of items.
Example: list_example = [1, 2, 3] and tuple_exa...read more
Interview Process at Mott MacDonald Python Software Developer

Top Python Software Developer Interview Questions from Similar Companies




Reviews
Interviews
Salaries
Users/Month

