All Questions

Python

Follow
Showing 51 - 60 out of 172 Questions
72 Views

What are local variables and global variables in Python?

Nitin Mereddy 24th Oct, 2021

Local variable : Any variable declared inside a function is known as Local variable and it’s accessibility remains inside that function only.

Global Variable : Any variable declared outside the function is known as Global variable and it can be easily accessible by any function present throughout the program.

154 Views

What are the common built-in data types in Python?

Nitin Mereddy 24th Oct, 2021

Python supports the below-mentioned built-in data types:

Immutable data types:

  • Number
  • String
  • Tuple

Mutable data types:

  • List
  • Dictionary
  • set
48 Views

What is __init__ in Python explain its significance

Nitin Mereddy 24th Oct, 2021

Equivalent to constructors in OOP terminology, __init__ is a reserved method in Python classes. The __init__ method is called automatically whenever a new object is initiated. This method allocates memory to the new object as soon as it is created. This method can also be used to initialize variables.

533 Views

What is scope resolution in python Language

Nitin Mereddy 24th Oct, 2021

A scope is a block of code where an object in Python remains relevant.Each and every object of python functions within its respective scope.As Namespaces uniquely identify all the objects inside a program but these namespaces also have a scope defined for them where you could use their objects without any prefix. It defines the accessibility and the lifetime of a variable.

Let’s have a look on scope created as the time of code execution:

  • A local scope refers to the local objects included in the current function.
  • A global scope refers to the objects that are available throughout execution of the code.
  • A module-level scope refers to the global objects that are associated with the current module in the program.
  • An outermost scope refers to all the available built-in names callable in the program.
224 Views

Explain Inheritance in Python with an example?

Nitin Mereddy 24th Oct, 2021

As Python follows an object-oriented programming paradigm, classes in Python have the ability to inherit the properties of another class. This process is known as inheritance. Inheritance provides the code reusability feature . The class that is being inherited is called a superclass or the parent class, and the class that inherits the superclass is called a derived or child class.

57 Views

What are python namespaces in python language

Nitin Mereddy 24th Oct, 2021

A Python namespace ensures that object names in a program are unique and can be used without any conflict. Python implements these namespaces as dictionaries with ‘name as key’ mapped to its respective ‘object as value’.

Let’s explore some examples of namespaces:

  • Local Namespace consists of local names inside a function. It is temporarily created for a function call and gets cleared once the function returns.
  • Global Namespace consists of names from various imported modules/packages that are being used in the ongoing project. It is created once the package is imported into the script and survives till the execution of the script.
  • Built-in Namespace consists of built-in functions of core Python and dedicated built-in names for various types of exceptions.
82 Views

What are Python Modules in python language

Nitin Mereddy 24th Oct, 2021

Files containing Python codes are referred to as python modulesThis code can either be classes,functions or variables and saves the programmer time by providing the predefined functionalities when needed.It is a file with .py extension containing an executable code.

Commonly used built modules are listed below:

  • os
  • sys
  • data time
  • math
  • random
  • JSON
174 Views

explain how is memory managed in python?

Nitin Mereddy 24th Oct, 2021
  • Memory in Python is managed by Python private heap space. All Python objects and data structures are located in a private heap. This private heap is taken care of by Python Interpreter itself, and a programmer doesn’t have access to this private heap.
  • Python memory manager takes care of the allocation of Python private heap space.
  • Memory for Python private heap space is made available by Python’s in-built garbage collector, which recycles and frees up all the unused memory.
84 Views

what is pep8 in python language

Nitin Mereddy 24th Oct, 2021

PEP in Python stands for Python Enhancement Proposal.It is a set of rules that specify how to write and design Python code for maximum readability.

258 Views

python is an interpreted language explain its interpretation

Nitin Mereddy 24th Oct, 2021

An interpreted language is any programming language which executes its statements line by line.Programs written in Python run directly from the source code, with no intermediary compilation step.

The question have been saved in answer later, you can access it from your profile anytime. Access now

Download the Careers360 App on your Android phone

Regular exam updates, QnA, Predictors, College Applications & E-books now on your Mobile

Careers360 App
150M+ Students
30,000+ Colleges
500+ Exams
1500+ E-books