Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (2 votes)
303 views

Python Question Bank

This document contains short answer questions, long answer questions, and multiple choice questions related to Python programming. It covers topics such as Python features, data types, operators, functions, classes, inheritance, exceptions, files, databases, and regular expressions. The questions range from basic to advanced level and test understanding of Python concepts, syntax, and applications.

Uploaded by

Megha Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
303 views

Python Question Bank

This document contains short answer questions, long answer questions, and multiple choice questions related to Python programming. It covers topics such as Python features, data types, operators, functions, classes, inheritance, exceptions, files, databases, and regular expressions. The questions range from basic to advanced level and test understanding of Python concepts, syntax, and applications.

Uploaded by

Megha Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Short Answer Question (1 Marks)

1. What is Python?
2. Name some of the features of Python.
3. Is python a case sensitive language?
4. Why we use python?
5. List down the basic data types in Python.
6. Define variable in python?
7. Write a short note on python keywords.
8. Which function is used in python to get the type of variable.
9. What are the two modes of operation in python?
10. What is the full form of IDLE?
11. What is the purpose of break statement in Python?
12. What is the use of pass statement in Python?
13. What is local variable?
14. Define the use of global keyword.
15. Define the term: Encapsulation.
16. Define the term: abstraction.
17. What is the use of this keyword?
18. What is slicing?
19. What is the difference between list and tuple in python?
20. Which keyword is used to delete an element from a list.
21. What are tuples in Python?
22. What is dictionary? How it is different from list?
23. What is the use of eval () function?
24. Are Arguments in Python Passed by Value or by Reference?
25. What Does the // Operator Do?
26. What is the difference between append() and extend() methods of list class.
27. Which utility is used to install python package?
28. List all file opening modes supported by Python?
29. State the use of parameter “self” in python class.
30. Why we use Regular Expressions?
31. Write a Regular Expression to validate email address.
32. Which module in Python supports regular expressions?

Short Answer Question (2 Marks)

1. What is the difference between scripting language and programming language?


2. What are features of python?
3. What are the different data types available in Python?
4. What are the two modes of operation in python? Analyse the differences between them.
5. What is identifier? Write down the rules for defining identifier in python.
6. Explain input and output function of python with example.
7. Explain the significance of the range() function in for loop with the help of a suitable example.
8. What is indentation and why we use indentation in python?
9. What is the difference between scripting language and programming language?
10. What is slicing and on which objects can you apply slicing?
11. Analyse the difference between local and global variables.
12. Explain Lambda function with a suitable example.
13. What is set? What is its use case? How it is different from list?
14. Define class? How to create a class and its object in python.
15. What is the difference between remove() and pop() method in a list.
16. Explain Destructor in python.
17. Explain constructor function in python class with example.

Long Answer Question (16 Marks)

1. What is operator? Explain all types of operators with example.


2. What is flow control? What are the different statements that are used and manage flow
control in python.
3. Describe string along with its properties. Discuss all the methods which are present in string
class with example.
4. Discuss List data structure along with its properties and methods with suitable example.
5. What is dictionary? How it is different from list? Explain all its properties and methods with
suitable example.
6. What is set? What is its use case? How it is different from list? Discuss all its properties and
methods with suitable example.
7. Explain function and its uses. What are the different types of arguments that are supported
by python function.
8. Illustrate the different file opening modes available in Python to open the file with a suitable
example.
9. Explain in detail about Python Files, its types, functions and operations that can be
performed on files with examples.
10. What is exception and what do you mean by exception handling? List all the keywords that
are used in exception handling along with their usage.
11. Explain exception and exception handling. How we can create user defined exception in
python explain with suitable example.
12. Discuss Exception and Assertions in Python. How to handle exception with try-except-finally?
Explain any 5 built-in Exceptions with suitable example.
13. Describe in details how exceptions are handled in python. Give relevant example.
14. Describe the relationship between a class and object? Write a program that shows how to
define a class. How to access member functions and how to create and access
15. What does inheritance mean? What are different forms of inheritance? Give an example of
each.
16. What are the different types of inheritance supported by the Python? Explain each one with
suitable example.
17. Write a short note on following:
a. Encapsulation
b. Abstraction
c. Polymorphism
d. Abstract class
18. What is regular expression? Explain various metacharacters used in regular expression. Write
a program to validate email and phone input by user using RegEx.
19. Why we use regular expression? Discuss any five methods of re module with suitable
example.
20. What is a Thread? What is Multithreading? Explain the advantages of Multithreading in
Python and when to use Multithreading in Python?
21. Explain multithreading, its uses, and how to achieve multithreading in Python. Write the
steps to follow to implement the threading module in Python.
22. Write a python program to create a database employee with insert and retrieve details of an
employee from a database table. Following are the details of database schema.
Database name: EMS
Username: root
Password: root
Table name: Employees
Columns: Eid int(6) Name varchar(2) Email varchar(20) Address varchar(100)
Final output needs to be displayed in tabular format.
23. Explain the importance of SQLite database. Write a python code to establish a database
connection to ‘EmpDB’ and store the employee details in it and display the total gross salary
paid to the employees working in the ‘Quality Control’ department. The fields of employee
table are: (EmpID, EmpName, DeptName, GrossSalary).
24. Write a python program to create a database student and perform the following task.
1. Insert student record.
2. Update student record.
3. Delete student Record.
4. Display all student records.
Following are the details of database schema.
Database name: studentDB
Username: root
Password: root
Table name: studentInfo
Columns: stu_id int, stu_name varchar(30), stu_email varchar(20) , Address varchar(100)

25.

You might also like