Python Interview Questions | Crack With CodeWindow | Codewindow.in

1. What are the features of Python Programming?

Python Language is one of the easiest to work with since its Open-Source.
Python is a Object – Oriented  Programming
Free and Open Source
Integrated and Portable Language
GUI Programming Language

2. Limitation of Python Programming.

Speed and Performance is one of the limitation. Its slow in comparison to other high level languages
Too many Dependencies on Third-Party Libraries
Mobile Development 
Capabilities are very Limited

3. Application of Python programming.

Data Science and Visualization
Web Development – Backend Development using Flask etc.
Machine Learning
Web Scraping Applicaions
Application in Business Fields
Desktop GUI Applications

4. What is Built-in format()?

It is a method that formats the given string within the curly braces {} as desired
Example:

print(“My name is {fname}, i’am {age}”.format(fname = “John”, age = 36))

5. how to define string in Python?

str is the keyword for defining String in python (Python takes input as string by default )

C QA

Mostly Asked

DS QA

Mostly Asked

DBMS QA

Mostly Asked

ML QA

Mostly Asked

6. Is multiple assignment possible in Python?

Yes possible.
a,b,c = 14,15,16
Here,
a stores 14
b stores 15
c stores 16

7. What are comments in Python?

Comments in python are the information provided by the one who wrote the code.
‘#’ is used to initiate a single line comment whereas,
Multi-Line comment is between three consecutive inverted commas
”’
all comments are here
”’

8. Reserved words in Python?

Using of String slicing


a=input()

a=a[::-1]
print(a)

9. Operators in Python?

Operators in python used to perform operations on variables and values.
Some operators are:

  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Logical operators
  • Identity operators
  • Membership operators
  • Bitwise operators

10. Difference between List, Set, Tuple, Dictionary?

list and dictionary are mutable objects but on the other hand tuple objects is immutable, hence cannot be deleted or added
Set is unordered whereas list, tuple and dictionary are ordered
Dictionary is hash table which has a key:value pair but, list tuple and set.
Duplicate elements are not allowed in set, but are allowed in others.
list, tuple are indexed but dictionary are not indexed

11. Type conversion in Python?

Sometimes there in need of changing the data types from one to another with or without user intervention.
There are two types of Type Conversion in Python:

  1. Implicit Type Conversion  Python interpreter automatically converts one data type to another without any user involvement

  2. Explicit Type Conversion – The data type is manually changed by the user as per their requirement

     

12. Difference between python 2.x and Python 3.x?

Print function – python 3.x requires round brackets where’s python 2.x doesn’t need them

python 2.x – print “hello world”
python 3.x – print(“hello world”)

Division operator –  lets see with an example
python 2.x – print 7/5
output: 1
python 3.x – print(7/5)
output: 1.4

13. Decision Control Statements in Python?

Some Decision Control Statements are:

  • Simple if.

  • if-else.

  • nested if.

  • if-elif-else.

14. Loops in Python?

For Loops and While loop

For Loop:
sequence = [“code”, “window”]
for iterator_var in sequence:
    print(iterator_var)

While Loop:
count=0
while (count < 4):
    count = count + 1
    print(“Welcome to CodeWindow”)

15. Difference between Counter-controlled loop and Condition Controlled loop?

Condition controlled loop check the condition before the start of the iteration which determines if the loop should begin or not.
whereas,
A counter-controlled loop is when sequential numbers are being processed until a known value or limit

Recent Posts

Leave a Comment

Your email address will not be published. Required fields are marked *