BPLCK205B Introduction to Python Programming Solved Imp Questions

Module 1

Q1. What is the need for role of precedence? Illustrate the rules of precedence in Python with example.

Q2. What are functions? Explain Python function with parameters and return statements.

Q3. Explain the local and global scope with suitable examples. With an example explain user-defined functions.

Q4. Define Exception Handling. How are exceptions handled in Python? Write a program to solve divide by zero exception.

5. Explain the string concatenation and string replication operator with an example.

6. List and explain with syntax and example the flow control statements in Python.

7. Demonstrate with example print(), input(), and string replication function in Python.

8. Illustrate the use of break and continue with example.

9. programs

  1. Calculate the Area of a Rectangle and Triangle
  2. Check Whether a Number is Even or Odd
  3. Generate Fibonacci Sequence of Length N
  4. Check Whether the Number is Positive, Negative, or Zero

Module-2

  1. Explain the following list operations with suitable examples:
     a) Negative indexing
     b) Slicing
     c) index()
     d) append()
     e) remove()
     f) pop()
     g) insert()
     h) sort()
  2. Explain the use of in and not in operators in lists with suitable examples. Also, develop a program to find mean, variance, and standard deviation of a list of numbers.
  3. Explain the following list methods with examples:
     a) len()
     b) min()
     c) max()
    d) sum( )

  1. a) Explain the set() and setdefault() methods in dictionary with suitable examples.
    b) Develop a Python program to swap the case of a given string.
    Example:
    Input: Java
    Output: jAVA

  2. a) Explain the use of random.choice() and random.shuffle() functions with lists using suitable examples.
    b) Show that lists are mutable with an example.

  3. a) Define the tuple data type in Python.
    b) List out the differences between a tuple and a list.

  4. a) Identify and explain the following dictionary methods with examples: get(), items(), keys(), values().
    b) Differentiate between a list and a dictionary in Python.

  5. Develop a Python program to swap two numbers without using intermediate (temporary) variables. Prompt the user for input and display the output.

Module-3

  1. Explain join() and split() method with examples.
  2. Explain with examples:
    i) isalpha()
    ii) isalnum()
    iii) isspace()
    iv) isdcimal
    v) istitle
  3. Python code to determine whether the given string is a palindrome or not.
  4. Explain the concept of file handling. Also explain reading and writing access with suitable example.
  5. Explain the concept of file path. Also discuss absolute and relative file path. Write a program to accept string and display total number of alphabets.
  6. Briefly explain saving variables with shelve module.
  7. Discuss the following methods of OS module
    i) chdir()
    ii) rmdir()
    iii) walk()
    iv) list dire()
  8. Read a multi-digit number (as chars) from console. Develop a program to print the frequency of each digit with suitable example.

Module-4

  1. How to copy, move, rename, and delete files/folders using Python
  2. Benefits of compressing files and how to read zip files in Python
  3. What is the difference between shutil.copy() and shutil.copytree()?
  4. Explain assertions, raising exceptions, and any functions from the shutil module
  5. Explain the logging module in Python and its benefits
  6. Write a Python program to copy files and folders using the shutil module
  7. Explain debug control buttons and how to walk through a directory tree
  8. Write a Python program to sort the contents of a text file and store it in another file

Module – 5

  1. What is class? How do we define class? How class members are accessed? Explain with example
  2. List and explain any four object-oriented characteristics possessed by Python
  3. Explain the following with an example
  4. Write a program to explain pure function and modifier function
  5. Write short note on Prototyping and Planning
  6. Explain init() and __str() methods with examples. Discuss type-based dispatch in Python
  7. Briefly explain printing of objects and objects are mutable with example
  8. Discuss operator overloading. Mention any five operators with respective special functions to be overloaded in Python
  9. What is class? How do we define class? How class members are accessed? Explain with examples
  10. List and explain any four object-oriented characteristics possessed by Python

2 Comments

Leave a Reply

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