Python Programming Question Bank

 

Python Programming Question Bank

  1. What is a class in Python?
    Create a class called Employee and calculate the net salary of an employee.

  2. What do the break, continue, pass, and else statements do in Python?
    Provide examples to explain the function of each.

  3. What are decision-making statements in Python?
    Describe conditional statements in Python with an example.

  4. How does the range() function work in Python?
    Explain its usage and how it can be combined with loops. Provide an example.

  5. What is operator overloading in Python?
    Provide an example of how arithmetic operators can be overloaded.

  6. What is inheritance in Python?
    Discuss single, multiple, and multilevel inheritance with examples.

  7. What is the purpose of the __init__() and __del__() methods in Python?
    Explain the constructor and destructor with examples.

  8. What are some commonly used libraries and packages in Python?
    Provide examples and explain their usage.

  9. What is an anonymous function in Python?
    Explain with an example.

  10. Demonstrate the usage of pass, continue, break, and else in loop manipulation with a Python program.

  11. Write a Python program that calculates the factorial of a number using recursion.
    The number should be provided by the user.

  12. How do the read(), readline(), and readlines() methods function in Python file handling?
    Explain with examples.

  13. Define a function in Python.
    Provide an example to explain how functions are implemented in Python.

  14. Demonstrate the usage of the write() and append() methods in Python file handling.
    Provide examples for each method. 

  15. What is the difference between a list and a tuple in Python? 

  16. Provide examples to explain the distinctions in terms of mutability, usage, and performance. 

  17. How can you handle exceptions in Python? 

  18. Explain with an example using try, except, else, and finally blocks. 

  19. What is a lambda function in Python? 

  20. Explain its syntax and provide an example where it is used for a small function. 

  21. What is the difference between shallow copy and deep copy in Python?

  • Provide examples to explain both and demonstrate how to create each type of copy.

  • 1. What is range() method in Python. How range() is used with loop? Explain with example

    2. Explain break statement, continue statement, pass statement and else statement in Python with an example

    3. Write short note on type conversion in Python

    4. Mr. Kunal started IT firm by taking a loan from the bank of 1Cr at a rate of interest of 8.5 for 10 years. Mr. Mahesh has selected a place to run his IT firm on a rent of 25000/-. Per month He has hired 2 Engineers for his firm with a monthly salary of 30000/- per engineer.  Mahesh has other monthly expenses of 10000. Per year he gets 3-5 projects of 2 lakhs per project. Calculate simple interest on the Loan he has taken Calculate all monthly expenses including EMI Calculate yearly profit and loss

    5. What are conditional statements/decision-making statements in Python? Explain with example

    6. What are branching statements in Python? Explain with example

    7. What is loop? Explain loop structure in Python?

    8. What are iterative statements in Python? Explain with example

    9. What is function? Explain function in Python

    10. Explain function parameters in Python

    11. Write short note on return statement in Python

    12. What is lambda function in Python? Explain it with example

    13. What is anonymous function in Python. Explain with example

    14. Demonstrate recursive function in Python. calculate factorial of user input using recursion

    15. Explain commonly used packages and libraries with an example

    16. Explain user defined modules and packages with example.

    17. Recursion is a process that calls itself. Explain this statement with syntax and an example

    18. What is string? Explain strings with different methods

    19. 2.     What is list data structure in Python? Explain methods of list with example

    20. 3.     What is tuple data structure in Python? Explain all methods of tuple data structure

    21. 4.     What is set data structure? Explain all methods with example

    22. What is dictionary data structure? Explain dictionary with methods

    23. Create dictionary Result_Analysis with 5 key value pairs. Perform the following,

    Keys are – Python, C++, ADBMS, PHP, Soft Computing

    Values are- 67, 58, 69, 66, 28 respectively

    Calculate total marks, Calculate percentage, Display results in four grades,

     If the percentage is greater than 80 print ‘Outstanding Performance’

    if the percentage is greater than 70 and less than 80 print ‘Excellent Performance’

    if the percentage is greater than 60 and less than 70 First Class’

    if the percentage is greater than 40 and less than 60 print ‘Student is just passed in Examination’

    otherwise print ‘student is failed in Examination’

    24. What are Built in data structures in Python? Explain with example 

    25. What is file? Explain operation on file in Python

    26. Write short note on open , read and close operation of file in Python

    27. Explain read(), readline() and readlines() method in file handling

    28. What is class? Create class employee and calculate employee net salary

    29. Demonstrate write and append methods in Python with example

    30. Explain rename() and remove() method with syntax and example

    31. What is use of exception handling in Python? Explain with syntax and example

    32. What is inheritance in Python? Explain single, multiple, multilevel inheritance with example

    33. What is inheritance? Explain types of Inheritance with example

    34. What is operator overloading? Explain arithmetic operator overloading with example

    35. Explain __init__() method and __del__() method in Python with example

    36. Explain constructor and destructor in Python


    1.     

    टिप्पणी पोस्ट करा

    0 टिप्पण्या