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

Python Interview Questions

Interview questions

Uploaded by

shubham patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
31 views

Python Interview Questions

Interview questions

Uploaded by

shubham patel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 8
Khat is python ? thon was created by Guido van Rossum . and in 1991 + Web applications are made by python with the help of servers. - Python handles huge. amount of data 3 perform oathermatics . ~ Python works on different platforro like Mac, Linux, Windows . Raspberry Pi etc). + Python is a object oriented programming Scanned with CamScanner Is the python case sensitive language . Yes, Python is a case sensitive language . Because it differentiates the lower case & pper case identifiers What is Lambda function in python? Lambda function in python having ne name. Lambda forms are utilized to construct anonymous Fuctions. A normal functions gre defined by def keyword but unnamed functions defined by lambda lkeyword. example :— adder = lambda %, y: % ry print Cadder (4 8)) @curvious —. programmer. hat are the advantages of Python & _ Python ig very flexible © extensible langue ge | - Python is object oriented programming lanquage . In_python there are Tuple, list and dictionar eare useful datq structure is present in the angquandge - Python Uns of various platform like Mac, windows, Linux, caspherr i_ete. Python is free and open Source Scanned with CamScanner Sj What is PEP 8? =| In python PEP 8 has appears as the style guide that most projects held to it: - it provides Co very, weadable andl ey en pleasin coding style. A_full Form of PEP js Py thon Enhancement Proposal . : PEP B_ recommends use 4 spaces to +e show indentation and tabs showd only be used to / maintain Consistency in the program . 6 het is self in python t @uurious—- pregrammer —]: By using self - word we can Access the tribute @ methads of class in python. - The self keyword is Used to represent the instance ofr the class. ~The self variable in the Init method refer to the newly created object while in other methods. - Self {is also used to refer to a variable field within te class. @ curious programmer What is Init Function in python? sinit_ is one of the reserved method in on. The init. method can be called when an Taetuis created from the class. Scanned with CamScanner Page: [> AM classes have oj function called _jnit_ | which js -ausans executed when the Ae is being initiated. - Use the -init. ©) function te assian values to object properties. + The —~init method doesn't create the object atts) bub say initialize the object's attributes. What is pass in Sythent ~The pass Key Wor wepresents a oul operatio io python. It is generally used for the purpose of Filling Mp erp Fy block of code which roary execaite during runtime. + The pass statement is generally used as a placeholder. Maine: pass Statement fs useful when Nou dont write ienplementat? of Function. @curious—-p Whot is slice... furection~in python.” - Python slice (9 Function is used to qet a slice of elements From collection of dements. + Slice Function used with string, list. tuple set bytes or range objects . slice (start stop. step) Scanned with CamScanner How iS Memory managed io Python 2 > Mem fnanagement in python javelves a privaly heap containing all python ebjects 3 data structure. The python memory manager is deals with ¢ aspechs, like sharing. seqmentation and caching. - The cove APL gives access to Some _ tools for programmer to code. In python there is also garbage collection is present. It recycles oll the unused memory and so it makes free space io memory. storage Managemen) @ cuvrieus —. programmer What is tuple ip Python 7 A tuple is a built in data type. We can stores a value in tuple: A tuple in Python is similar to a list. Tuples are immutable so we cannot change ts values. muel ike strings. iets ete a What is an operator in Python ? | 12] is). Operator a symbol which is ysed on | | vatues to produce output omits lf nl ee Se Scanned with CamScanner + Avithmetic Operators are used to performin mathematical epercttions like addition, subtract _mutiplication 8 division. Ls os Comparison operator compares. the voJues and ___weturns true or false values on condition. Logical operator perform Logical AND, Logi oR and Logical Not operations. It is used to combine conditional statements. Bitwise operator act on bit 4 perform bi f ~by — bit operatioNs. + Assignment operators used to assigning values to the variables. @curious— programmer the python interpreted language + A Pythen is an interpreted anguage - Python language program runs directly from the code? »_ Python converts the source code into lan e code. And it is again translated jato machine language. AN interpre ted fan is an | language that isn't sear 10 Mdachine cod ior to runtime. progra Scanned with CamScanner Python iterators. > iterators are objects which be tranwersed travesecl though or ihevated upon . —— Iterator contains countable number of values. Python iterators used to iterate object like list, tuple, and sets. _ The iterator object inttialized using iter O method. Curious —-p Is identation required io Python? Indentation is mest important For python - it specifies blocte of code. All code with in loops classes functions ete. It is usually done je using Four space character. IF your code is not intended necessaril IE will mot execute accurately and will through erroy as well. What is namespace in Python 2 +] A namespace is Namin system used to make Sure that names are unique to Scanned with CamScanner hat are toca! and global variable in Python? -Theve erve two types of variables Jocal and global variables. Loca variables:— . Lecal variables can only be wreached within their scope. ~~ Any variable declared inside a function is kRown as a toca! variable . This variable ig present in the lecol and not in the glsbal pace. Global vVariables'— A_glebal variable can be used anywhere {no the program a6 its scope is entire programm. + Variable declared outside a Function of in global _gpace cre called global variables. These variables can be accessed by an Function in the program. @ curious. programmer Scanned with CamScanner

You might also like