0% found this document useful (0 votes)
8 views

Interview Python Questionare

The document discusses key concepts in object-oriented programming including objects, classes, inheritance, abstraction, polymorphism, and encapsulation. It also provides details on Python being a dynamically typed language and describes common Python data types, scopes, and special methods like __init__() and __str__().

Uploaded by

msedits91
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Interview Python Questionare

The document discusses key concepts in object-oriented programming including objects, classes, inheritance, abstraction, polymorphism, and encapsulation. It also provides details on Python being a dynamically typed language and describes common Python data types, scopes, and special methods like __init__() and __str__().

Uploaded by

msedits91
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

lamda function => A lambda function can take any number of arguments, but can

only have one expression.

Memory management in python?

Benifits of python?

What is MVC? : design pattern commonly used in software development to organize the
structure of an application,

What is global and local variables

What is oope

-----------------------------------------------------------------------------------
-

An object-oriented programming (OOP) language is a programming language that uses


objects and classes in program design. Some key characteristics of object-oriented
programming languages include:

Objects - Objects represent real-world entities and consist of both data


(attributes) and behaviors (methods).

Classes - Classes are templates or blueprints for creating programmatic objects.


They define the attributes and behaviors an object of that type supports.

Inheritance - Inheritance allows a new class to reuse code from an existing class.
The new child class inherits attributes and behaviors from the parent class

Abstraction - Abstraction in object-oriented programming refers to the concept of


exposing only essential details and hiding complexity and background
implementations from users of a class or system.

Polymorphism - Polymorphism allows objects of different types to be treated as if


they are the same type if they share certain common attributes and behaviors. This
provides flexibility.

Encapsulation - Encapsulation hides the internal representation of an object from


the outside and only exposes a public interface. This facilitates change without
breaking other dependencies.

Abstraction focuses on essentials. Encapsulation focuses on access control. That's


the key difference.

Python is a high-level, interpreted, general-purpose programming language.

dynamically typed language : Variable types are automatically detected at runtime


instead of needing to be explicitly defined.

1. interperted pro language => source code wont be converted to mechine language
therefore no compilation and direct execution
2. Static - Data Types are checked before execution.
Dynamic - Data Types are checked during execution.
Python is an interpreted language, executes each statement line by line and thus
type-checking is done on the fly, during execution. Hence, Python is a Dynamically
Typed Language.

3.In Python, a scope determines the visibility and accessibility of variables.

4. Lists and Tuple are sequece type in python , list is mutable and tuple is
immutable and lists are represented in squire brackets and tuple is represented in
parnthasis

5.DATATYPES

Int
float
str
bool
list
tuple
dict
set
None
complex

6. global variables are declared outside class and function , so its scope is
throughout the program , there for it can be accessed from anywhere in the program

protected attributs is meant to be used within the class and its subclass but it
can be accessed outside the class , it is represented with a leading underscore

private is strictly used inside the class and it is repreesented with double
leading underscore

7. Self is used to represent the instance of the class. With this keyword, you can
access the attributes and methods of the class in python.

8. __init__ is a contructor method in Python and is automatically called to


allocate memory when a new object/instance is created.

3.INIT => Use the __init__() function to assign values to object properties, or
other operations that are necessary to do when the object is being created

4. The __str__() function controls what should be returned when the class object
is represented as a string.
5. The self parameter is a reference to the current instance of the class

You might also like