{"id":137,"date":"2019-03-18T06:57:14","date_gmt":"2019-03-18T06:57:14","guid":{"rendered":"https:\/\/nearlearn.com\/blog\/?p=137"},"modified":"2019-12-06T11:20:17","modified_gmt":"2019-12-06T11:20:17","slug":"top-10-frequently-asked-interview-questions","status":"publish","type":"post","link":"https:\/\/nearlearn.com\/blog\/top-10-frequently-asked-interview-questions\/","title":{"rendered":"Top 10 Frequently Asked Interview Questions: Python Basics"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Top 10 Frequently Asked Interview Questions: Python Basics<\/h1>\n\n\n\n<p>Python has progressed toward becoming a significant famous language for endeavors and the improvement of value extends as of late.The language is versatile and is used for application development, writing scripts for desktop programs and in the configuration of servers to name a few. With so much of  use,  language has generated numerous job opportunities. Freshers looking to face the Python interviews need to have a clear understanding of Python basics. To help learners with that, we are listing the most frequently asked interview questions in Python Basics. <\/p>\n\n\n\n<p><a href=\"https:\/\/nearlearn.com\/courses\/ai-and-machine-learning\/python-for-data-science\">Python Certification<\/a> is the most looked for after expertise in programming space. In this Python Interview Questions blog, I will acquaint you with the most much of the time made inquiries in Python interviews. This blog is the ideal guide for you to get familiar with every one of the ideas required to clear a Python meet. Our Python Interview Questions is the one-prevent asset from where you can help your meeting readiness.<\/p>\n\n\n\n<p>Python Interview Questions<\/p>\n\n\n\n<p><strong>1. What\nis Python?<\/strong><\/p>\n\n\n\n<p>Python is an interpreted language\nwhich means we don\u2019t need to compile Python codes before it is run. PHP and\nRuby are some of the other interpreted languages.<\/p>\n\n\n\n<p>Few features of Python are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Python is dynamically typed, we don\u2019t need to specify\n     the types of variables while declaring them. For\n     instance,&nbsp;x=111&nbsp;and then&nbsp;x=\u201dI\u2019m a string\u201d&nbsp;runs in\n     Python without error.<\/li><li>Python is well suited to OOP and allows the definition\n     of classes, composition, and inheritance. Python does not use access\n     specifiers.<\/li><li>In Python, functions and class objects are first-class\n     objects.<\/li><li>Python is quick and allows C based extensions like\n     the&nbsp;numpy making it efficient.<\/li><li>Python is used in web applications, automation,\n     scientific modelling, big data applications etc.<\/li><li>Python facilitates easy overriding of algorithms and\n     structures.<\/li><\/ul>\n\n\n\n<p><strong>2. What\nis the scope of multi-threading in Python?<\/strong><\/p>\n\n\n\n<p>Python doesn\u2019t allow a complete\nmulti-threading solution. Python\u2019s construct Global Interpreter Lock (GIL)\nmakes sure that only one thread is executed at any point in time. Threading\nlibrary in Python doesn\u2019t allow the use of any extra CPU cores. Though\nmulti-threading can be done by the OS or external tools like Spark or Hadoop.<\/p>\n\n\n\n<p><strong>3. What\nis monkey patching?<\/strong><\/p>\n\n\n\n<p>Monkey patching is changing the\nbehaviour of a function or object after it has already been defined. <\/p>\n\n\n\n<p><strong>4. What\ndo&nbsp;<\/strong>*args<strong>&nbsp;and&nbsp;<\/strong>**kwargs<strong>&nbsp;mean?<\/strong><\/p>\n\n\n\n<p>These are identifiers and the\nterms&nbsp;*args&nbsp;and&nbsp;**kwargs&nbsp;are a convention.<\/p>\n\n\n\n<p>We use&nbsp;*args&nbsp;when we\naren\u2019t sure of the number of arguments will be passed to a function, or on the\noff chance that we need to pass a&nbsp; stored\nlist or tuple of arguments to a function.<\/p>\n\n\n\n<p>**kwargs&nbsp;is used in cases where\nwe are not sure about the number of keyword arguments will be passed to a\nfunction, or it very well may be utilized to pass the values of a dictionary as\nkeyword arguments.<\/p>\n\n\n\n<p><strong>5. What are&nbsp;<\/strong>@classmethod<strong>,&nbsp;<\/strong>@staticmethod<strong>,&nbsp;<\/strong>@property<strong>?<\/strong><\/p>\n\n\n\n<p>These are decorators.<\/p>\n\n\n\n<p>Decorators are a special kind of\nfunction that either takes\/returns a function or a class. These are used on\nfunctions defined within classes. The @ symbol makes it easy to read.<\/p>\n\n\n\n<p><strong>6. How\ndoes Python garbage collection mechanism work?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Python maintains a count of the number of references to\n     each object in memory. If the reference count goes to 0, the associated\n     object is no longer live and the memory allocated to that object is\n     available for something else.<\/li><li>The garbage collector also periodically looks for \u201creference\n     cycles\u201d and cleans them up.<\/li><li>Python uses some heuristics for speedy garbage\n     collection. When an object is created, garbage collector assigns them to\n     generations. Each object gets one generation, and younger generations are\n     dealt with first.<\/li><\/ul>\n\n\n\n<p><strong>7. What\nare the built-in data-types in Python?<\/strong><\/p>\n\n\n\n<p>Built-in datatypes in Python are of\ntwo types.<\/p>\n\n\n\n<p><strong>Immutable<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Numbers<\/li><li>Strings<\/li><li>Tuples<\/li><\/ul>\n\n\n\n<p><strong>Mutable<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>List<\/li><li>Sets<\/li><li>Dictionary<\/li><\/ul>\n\n\n\n<p><strong>8. What\ndo you understand by Python Package?<\/strong><\/p>\n\n\n\n<p>Python package is the collection of\nmodules that are used to structure the module. It uses a dotted module\nnomenclature.<\/p>\n\n\n\n<p><strong>9.\nWhat\u2019s the difference between lists and tuples?<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"\"><tbody><tr><td>\n  <strong>Tuples<\/strong>\n  <\/td><td>\n  <strong>Lists<\/strong>\n  <\/td><\/tr><tr><td>\n  Tuples are Immutable just\n  requiring less memory\n  <\/td><td>\n  Lists are Mutable and thus\n  requires more memory\n  <\/td><\/tr><tr><td>\n  Tuples are faster compared to\n  Lists&nbsp;\n  <\/td><td>\n  Lists are slower that tuples&nbsp;\n  <\/td><\/tr><tr><td>\n  Tuples are heterogeneous data\n  structures&nbsp;\n  <\/td><td>\n  Lists are homogenous\n  sequences&nbsp;\n  <\/td><\/tr><tr><td>\n  Tuples have structure\n  <\/td><td>\n  Lists have order\n  <\/td><\/tr><tr><td>\n  We use parenthesis () to construct\n  tuples\n  <\/td><td>\n  We use parenthesis we use square\n  brackets&nbsp;[\n  ]&nbsp;to get a new list\n  <\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>10: Why And\nWhen Do You Use Generators In Python? <\/p>\n\n\n\n<p>A generator in\nPython is a capacity which restores an iterable article. We can iterate&nbsp; on the generator object utilizing the yield\nkeyword. In any case, we can just do that once in light of the fact that their\nqualities don&#8217;t continue in memory, they get the qualities on the fly. <\/p>\n\n\n\n<p>Generators\nenable us to hold the execution of a capacity or a stage as long as we need to\nkeep it. Be that as it may, here are a couple of precedents where it is gainful\nto utilize generators. <\/p>\n\n\n\n<p>\uf0a7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We can supplant circles with generators\nfor productively figuring outcomes including expansive informational indexes. <\/p>\n\n\n\n<p>\uf0a7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Generators are helpful when we don&#8217;t need\nevery one of the outcomes and wish to keep down for quite a while. <\/p>\n\n\n\n<p>\uf0a7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Instead of utilizing a callback work, we\ncan supplant it with a generator. We can compose&nbsp; a loop inside the function doing likewise as\nthe callback and transforms it into a generator.<\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>These <a href=\"https:\/\/nearlearn.com\/blog\/top-5-python-training-institute-in-bangalore\/\">Python<\/a> interview questions are internationally limited to basics and are targeted towards freshers. Answers are more of explanatory so that learners get to understand the basics in a detailed manner. In technical interviews, learners are supposed to showcase their understanding while keeping the answers to the point and these questions are supposed to cater to that. <a href=\"https:\/\/nearlearn.com\">NearLearn <\/a>wishes very good luck for your interviews.<\/p>\n\n\n\n<p class=\"has-text-align-left\">Visit more for <br><a href=\"https:\/\/nearlearn.com\/python-classroom-training-institute-bangalore\">Python  training in bangalore<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/nearlearn.com\/courses\/blockchain\/blockchain-certification-training\">Blockchain training in bangalore<\/a><br> <a href=\"https:\/\/nearlearn.com\/machine-learning-certification-training-course-bangalore-india\">machine learning training in bangalore<\/a><br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Top 10 Frequently Asked Interview Questions: Python Basics Python has progressed toward becoming a significant famous language for endeavors and the improvement of value extends as of late.The language is versatile and is used for application development, writing scripts for desktop programs and in the configuration of servers to name a few. With so much [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":140,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[23,22,27],"class_list":["post-137","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python-training","tag-blockchain-training-in-bangalore","tag-machine-learning-training-in-bangalore","tag-python-training-in-bangalore"],"_links":{"self":[{"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/posts\/137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/comments?post=137"}],"version-history":[{"count":0,"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/posts\/137\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/media\/140"}],"wp:attachment":[{"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/media?parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/categories?post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nearlearn.com\/blog\/wp-json\/wp\/v2\/tags?post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}