Posts

INTERVIEW QUESTIONS

What are the ways to write a function using call by reference? Arguments in python are passed as an assignment. This assignment creates an object that has no relationship between an argument name in source and target. The procedure to write the function using call by reference includes: The tuple result can be returned to the object which called it. The example below shows it: def function(a, b): a = 'value' b = b + 1 # a and b are local variables that are used to assign the new objects return a, b # This is the function that is used to return the value stored in b - The use of global variables allows the function to be called as reference but this is not the safe method to call any function.  - The use of mutable (they are the classes that consists of changeable objects) objects are used to pass the function by reference. def function(a): a[0] = 'string' a[1] = a[1] + 1 # The ‘a’ array give reference to the mutable list and it changes the changes that

INTERVIEW QUESTIONS

1) What is Python? What are the benefits of using Python? Python is a  programming  language with objects, modules, threads, exceptions and automatic memory management. The benefits of pythons are that it is simple and easy, portable, extensible, build-in data structure and it is an open source. 2)  What is PEP 8? PEP 8 is a coding convention, a set of recommendation, about how to write your Python code more readable. 3) What is pickling and unpickling? Pickle module accepts any Python object and converts it into a string representation and dumps it into a file by using dump function, this process is called pickling.  While the process of retrieving original Python objects from the stored string representation is called unpickling. 4) How Python is interpreted? Python language is an interpreted language. Python program runs directly from the source code. It converts the source code that is written by the programmer into an intermediate language, which is again translate