Q1. What is Python?

Answer: Python is a high-level, interpreted, object-oriented programming language. It is easy to learn and widely used for web development, data science, automation, and AI. Python uses simple syntax similar to English, making it beginner-friendly.

Q2. Who developed Python?

Answer: Python was developed by Guido van Rossum in 1991 at CWI (Netherlands). He designed Python to be easy to read and simple to use.

Q3. Why is Python called interpreted language?

Answer: Python is interpreted because its code is executed line-by-line by the Python interpreter, without compiling the entire program before execution.

Q4. What are Python features?

Answer:

  • Easy syntax
  • Interpreted
  • Object-oriented
  • Portable
  • Large libraries
  • Free and open source

Q5. What is Python syntax?

Answer: Syntax is the set of rules that define how Python code must be written. Python uses indentation instead of braces.

Q6. What is indentation?

Answer: Indentation means spaces at the beginning of a line to define code blocks. Python requires indentation to define loops and functions.

Q7. What is variable?

Answer: A variable is a container used to store data values.

Q8. How to create variable?

Answer:

x = 10
name = "Python"

Q9. What are keywords?

Answer: Keywords are reserved words in Python like if, else, while, def.

Q10. Is Python case sensitive?

Answer: Yes, Python is case sensitive. Name and name are different.

Q11. What are Python data types?

Answer: int, float, str, list, tuple, set, dictionary, bool.

Q12. What is int?

Answer: int stores integer values like 10, 100.

Q13. What is float?

Answer: float stores decimal numbers like 10.5.

Q14. What is string?

Answer: String stores text inside quotes.

Q15. What is list?

Answer: List stores multiple values and is mutable.

Q16. What is tuple?

Answer: Tuple stores multiple values but is immutable.

Q17. What is set?

Answer: Set stores unique values only.

Q18. What is dictionary?

Answer: Dictionary stores key-value pairs.

Q19. What is bool?

Answer: Bool stores True or False.

Q20. How to check type?

type(x)

Q21. What is operator?

Answer: Operator performs operations on variables.

Q22. Arithmetic operators?

Answer: +, -, *, /, %

Q23. Comparison operators?

Answer: ==, !=, >, <

Q24. Logical operators?

Answer: and, or, not

Q25. Assignment operator?

Answer: =

Q26. What is if statement?

Answer: Used to check condition.

Q27. What is else?

Answer: Executes when if condition is false.

Q28. What is elif?

Answer: Checks multiple conditions.

Q29. What is loop?

Answer: Used to repeat code.

Q30. Types of loops?

Answer: for loop and while loop.

Q31. What is function?

Answer: Function is block of reusable code.

Q32. How to create function?

def myfun():
print("Hello")

Q33. What is parameter?

Answer: Input given to function.

Q34. What is return?

Answer: Returns value from function.

Q35. What is lambda?

Answer: Small anonymous function.

Q36. What is class?

Answer: Blueprint of object.

Q37. What is object?

Answer: Instance of class.

Q38. What is constructor?

Answer: Special function called automatically.

Q39. What is inheritance?

Answer: Child class gets parent properties.

Q40. What is polymorphism?

Answer: Same function different behavior.

Q41. What is exception?

Answer: Error during execution.

Q42. What is try?

Answer: Used to test code.

Q43. What is except?

Answer: Handles error.

Q44. What is finally?

Answer: Executes always.

Q45. What is file?

Answer: File stores data permanently.

Q46. How to open file?

open("file.txt")

Q47. File modes?

Answer: r, w, a

Q48. What is module?

Answer: File containing Python code.

Q49. What is import?

Answer: Used to use module.

Q50. Example?

import math

Q51. What is iterator?

Answer: Object used to iterate elements.

Q52. What is generator?

Answer: Function that returns iterator.

Q53. What is decorator?

Answer: Function modifying another function.

Q54. What is list comprehension?

Answer: Short way to create list.

Q55. What is virtual environment?

Answer: Separate Python environment.

Q56. What is an interpreter in Python?

Answer: Interpreter is a program that executes Python code line-by-line. It converts human-readable Python code into machine-readable instructions and executes it immediately without compiling the whole program.

Q57. What is compilation in Python?

Answer: In Python, compilation converts source code into bytecode (.pyc file). This bytecode is then executed by the Python Virtual Machine (PVM).

Q58. What is Python Virtual Machine (PVM)?

Answer: PVM is the part of Python interpreter that executes bytecode and converts it into machine-level instructions.

Q59. What is dynamically typed language?

Answer: Python is dynamically typed because you do not need to declare variable type explicitly. The type is assigned automatically.

Q60. Example of dynamic typing?

x = 10
x = "Hello"

Explanation: Same variable stores different data types.

Q61. What is strongly typed language?

Answer: Python is strongly typed because it does not allow operations between incompatible data types without conversion.

Q62. What is memory management in Python?

Answer: Python automatically manages memory using garbage collection and reference counting.

Q63. What is garbage collection?

Answer: Garbage collection removes unused objects from memory to free space.

Q64. What is reference counting?

Answer: It counts how many references point to an object. If count becomes zero, memory is freed.

Q65. What is identifier?

Answer: Identifier is the name used to identify variables, functions, classes.

Q66. Rules for identifiers?

  • Cannot start with number
  • Cannot use keywords
  • Can use letters and underscore

Q67. What is comment?

Answer: Comment is used to explain code. Python ignores comments.

Q68. Types of comments?

  • Single line (# comment)
  • Multi-line (”’ comment ”’)

Q69. What is None?

Answer: None represents absence of value.

Q70. What is type conversion?

Answer: Converting one data type into another.

Q71. Example of type conversion?

x = int("10")

Q72. What is implicit conversion?

Answer: Conversion done automatically by Python.

Q73. What is explicit conversion?

Answer: Conversion done manually using functions like int(), float().

Q74. What is slicing?

Answer: Extracting part of sequence.

Q75. Example slicing?

name = "Python"
print(name[0:3])

Q76. What is mutable object?

Answer: Mutable objects can be changed after creation. Example: list.

Q77. What is immutable object?

Answer: Immutable objects cannot be changed. Example: tuple, string.

Q78. What is len() function?

Answer: Returns number of elements.

Q79. What is range() function?

Answer: Generates sequence of numbers.

Q80. Example range?

range(1,5)

Q81. What is global variable?

Answer: Variable declared outside function.

Q82. What is local variable?

Answer: Variable declared inside function.

Q83. What is scope?

Answer: Scope defines where variable can be accessed.

Q84. What is pass statement?

Answer: pass is empty statement used as placeholder.

Q85. What is break statement?

Answer: break stops loop immediately.

Q86. What is continue statement?

Answer: continue skips current iteration.

Q87. What is docstring?

Answer: Docstring is string used to document function.

Q88. Example docstring?

def fun():
"""This is docstring"""

Q89. What is pip?

Answer: pip is package manager used to install libraries.

Q90. Example pip command?

pip install numpy

Q91. What is library?

Answer: Library is collection of modules.

Q92. What is framework?

Answer: Framework provides structure to develop applications.

Q93. Example Python frameworks?

  • Django
  • Flask

Q94. What is PEP?

Answer: PEP means Python Enhancement Proposal. It defines standards.

Q95. What is indentation error?

Answer: Error caused by incorrect spacing.

Q96. What is syntax error?

Answer: Error caused by wrong syntax.

Q97. What is runtime error?

Answer: Error during program execution.

Q98. What is logical error?

Answer: Error in program logic.

Q99. What is __name__ variable?

Answer: It tells whether file is run directly or imported.

Q100. Why Python is popular?

Answer:

  • Easy to learn
  • Powerful libraries
  • Used in AI, Data Science, Web
  • High demand in jobs

📢 Join Our WhatsApp Channel

💼 Get Daily IT Job Updates, Interview Preparation Tips & Instant Alerts directly on WhatsApp.

👉 Join WhatsApp Now

📢 Join Our Telegram Channel

💼 Get Daily IT Job Updates, Interview Tips & Exclusive Alerts directly on Telegram!

👉 Join Telegram

Leave a Reply

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

Copyright © 2022 - 2025 itfreesource.com

Enable Notifications OK No thanks