May 29, 2019

Srikaanth

EPAM Systems Python Interview Questions Answers

What is the output of L[2] if L = [1,2,3]?

3, Offsets start at zero.

What is the output of L[-2] if L = [1,2,3]?

 L[-1] = 3, L[-2]=2, L[-3]=1

What is the output of L[1:] if L = [1,2,3]?

2, 3, Slicing fetches sections.

How will you compare two lists?

cmp(list1, list2) − Compares elements of both lists.

How will you get the length of a list?

len(list) − Gives the total length of the list.

How will you get the max valued item of a list?

max(list) − Returns item from the list with max value.
EPAM Systems Most Frequently Asked Python Latest Interview Questions Answers
EPAM Systems Most Frequently Asked Python Latest Interview Questions Answers

How will you get the min valued item of a list?

min(list) − Returns item from the list with min value.

How will you get the index of an object in a list?

list.index(obj) − Returns the lowest index in list that obj appears.

How will you insert an object at given index in a list?

list.insert(index, obj) − Inserts object obj into list at offset index.

How do you create a Button Element in Python?

The Button Class is available in Tkinter Module. We first need to import it and then we can take in a frame label by the following command:

button1 = Button(frame1, text = “I am a Button”)
button1.grid()

button 1 is a variable to hold the Button Element and frame 1 is the name of the Frame variable onto to which we want to adjust our Button. It is mandatory to define the Frame first.

How do you print the sum of digits from 1 to 50 in Python?

print(sum(range(1,51))

This command would print in the sum of digits from 1 to 50

What is PEP 8 in Python?

PEP 8 is a set of recommendations about writing Python Code so as to make it readable and useful for other programmers. It is more of a coding convention.
45. What is a Decorator in Python?

Decorators allow you to wrap a method or a class function that executes a set of code lines before or after the execution of the original code. Decorator also allows to inject or modify code in methods or classes.

What is Django Framework in Python?

Django is a high-level Python framework which is used primarily for Web Development. This framework encourages fast and efficient development with pragmatic and clean design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source.

Is Python a Compiled or an Interpreted Programming Language?

Python programs have the extension .py. These source files are first compiled to Byte Codes (which does not contain the binary codes). These Byte Code files helps in startup speed optimization. These byte-codes are then sent to the Python Virtual Machine where lines of codes are read one after another which means that it is interpreted.

Enlist the Non-Mutable Built-in types in Python programming environment?

The Non-Mutable Built-in types in Python Programming Environment are as follows:

1. Tuples
2. Numbers
3. Strings

How can we define Scope in a Python program?

Python programming environment does not support the use of Braces for Defining Scope for a variable or a method. However, it uses Indentations to let the Python interpreter decide the scope itself. Proper indentations, if not used will normally generate an error.

Enlist various Exceptions identified by Python?

The various exceptions identified by Python Environment are as follows:
1. IOError
2. IndexError
3. KeyError
4. NameError
5. SyntaxError
6. ValueError
7. TypeError.

What Are The Rules For Local And Global Variables In Python?

In Python, variables that are only referenced inside a function are implicitly global. If a variable is assigned a new value anywhere within the function's body, it's assumed to be a local. If a variable is ever assigned a new value inside the function, the variable is implicitly local, and you need to explicitly declare it as 'global'.
Though a bit surprising at first, a moment's consideration explains this. On one hand, requiring global for assigned variables provides a bar against unintended side-effects. On the other hand, if global was required for all global references, you'd be using global all the time. You'd have to declare as global every reference to a builtin function or to a component of an imported module. This clutter would defeat the usefulness of the global declaration for identifying side-effects.

Subscribe to get more Posts :

1 comments:

Write comments
nivedita
AUTHOR
November 12, 2019 at 2:50 PM delete

A big thank you for sharing such a valuable blog, I found this blog really useful. As a contribution to your blog post, I would like to share with you another Python Interview Questions and Answer which I found as good as yours.

Reply
avatar