0% found this document useful (0 votes)
2 views3 pages

Python Mid-2 Questions

The document lists important questions for a Python MID-2 exam, categorized into 2 marks and 6 marks questions. Topics covered include regular expressions, file handling, object-oriented programming concepts, exception handling, and function definitions. It also emphasizes the use of built-in functions and standard libraries in Python programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Python Mid-2 Questions

The document lists important questions for a Python MID-2 exam, categorized into 2 marks and 6 marks questions. Topics covered include regular expressions, file handling, object-oriented programming concepts, exception handling, and function definitions. It also emphasizes the use of built-in functions and standard libraries in Python programming.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Python MID-2 Important Questions

2 Marks Questions:

[Link] a Regular Expression?


[Link] about actual and formal arguments

[Link] any 4 Characteristics of Constructor

[Link] any two built-in exceptions in Python


[Link] between reading ('r') and appending ('a') modes in file handling
[Link] the use of any two standard libraries among math, datetime, os, and sys
7. Explain the role of built-in functions in Python programming and give two examples with their
purpose.
8. Describe the difference between default parameters and keyword arguments in function calls,
with an example of each.

9. Define what is a class and an object in Python OOP.

10. Explain the difference between instance variables and class variables with an example.
11. List the four main file opening modes in Python and briefly state what each mode does.

12. Explain why the 'with' statement is preferred over manually opening and closing files.

13. What are built-in functions in Python? Give any two examples.

[Link] is a regular expression? Mention the purpose of the re module in Python.

[Link] a simple Python program for class and object ?

[Link] is encapsulation in Python?

17What is the use of the with statement in file handling?

[Link] any two functions from the math module.?

6 Marks

1 Explain function definition and function calling in Python with syntax and examples?
Write a detailed explanation of email validation using regular expressions. Include a Python
2
program.

3 Define Runtime Polymorphism? Write a program on method overriding?

4 Define Exception handling? Write a sample program using keywords like try, except, else and finally
?

5 Write a detailed explanation of creating and importing user-defined modules in Python with
examples.

Explain file handling in Python. Discuss opening, reading, writing, and appending text files with
6
suitable examples.

7 Define the terms "default parameters," "keyword arguments," "*args," and "**kwargs" in the context
of Python functions.
8 Describe the process of defining a function, including the function body, parameters, and return
statement, and explain why functions promote code reusability.
9 Define the key concepts of Object-Oriented Programming with an example each.
Explain the following with an example each
10
a. Operator Overloading
b. Method Overriding

11 List the different file opening modes in Python ('r', 'w', 'a', 'r+', etc.) and describe what each mode
allows (reading, writing, appending, or creating).

12 List at least three key functions or classes from each of the following standard libraries: math,
datetime, os, and sys.
13 . Differentiate between *args and **kwargs in Python functions with example

Explain function definition and function calling in Python and Write a Python program to
14
demonstrate returning multiple values to a function

Write short notes on the following with examples


15 i) Class ii) Object

iii) Encapsulation iv) Polymorphism


16 Explain Exception Handling in Python. Describe the use of try, except, else, and finally blocks with a
suitable example
17 E x p l a i n t h e “ w i t h ” s t a t e m e n t u s e d i n f i l e h a n d l i n g . W i t h e x a m p l e p r o g r am
18 What is a module in Python and explain the advantages of using modules in Python

You might also like