0% found this document useful (0 votes)
7 views2 pages

Python PYQ

The document outlines an introductory course on Python programming, covering key topics such as features of Python, control statements, data structures, exception handling, file handling, object-oriented programming, libraries, and SQL database access. Each unit includes explanations, comparisons, examples, and programming exercises to reinforce learning. The course aims to provide a comprehensive understanding of Python for beginners.

Uploaded by

Kanishka Sinha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Python PYQ

The document outlines an introductory course on Python programming, covering key topics such as features of Python, control statements, data structures, exception handling, file handling, object-oriented programming, libraries, and SQL database access. Each unit includes explanations, comparisons, examples, and programming exercises to reinforce learning. The course aims to provide a comprehensive understanding of Python for beginners.

Uploaded by

Kanishka Sinha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Unit 1: Introduction to Python Programming

•What are the main features of Python? Explain with examples.


• Compare Python with C. List at least five differences.
• What are identifiers and keywords? State the rules for naming identifiers. Give examples of
valid and invalid identifiers.
• What are literals? Explain different types of literals in Python with examples.
• Explain different types of operators in Python (arithmetic, relational, logical, assignment,
bitwise, membership, identity) with examples.
• How do you take user input in Python? Give a program example.
• How can you format output in Python? Explain with examples using format(), f-string, %, sep,
and end.
• Write a program to print “Hello, World!” in Python.

Unit 2: Control Statements and Functions

•Explain branching and looping in Python with examples (if, for, while).
• Differentiate between break, continue, and pass statements with examples.
• What is a function in Python? How do you define and call a function? Give an example.
• What are default arguments in Python functions? Give an example.
•What is a lambda function? How is it different from a normal function? Provide an example.
•Write a program to find the factorial of a number using a function.

Unit 3: Python Data Structures

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


• How do you create and access elements in a dictionary? Give examples.
• What is a set? How is it different from a list? Provide examples.
• Write a program to count the frequency of elements in a list using a dictionary.

Unit 4: Exception Handling

•What is the difference between an error and an exception in Python?


• How do you handle exceptions using try-except block? Give an example.
• How do you handle multiple exceptions in Python?
• pWrite a program to handle division by zero exception.
• How do you create your own exception class in Python?

Unit 5: File Handling

•Explain the difference between read(), readline(), and readlines() functions.


• How do you write data to a file in Python? Give an example.
•Write a program to read the contents of a file and display it.
•What are config files and log files? How can you handle them in Python?

Unit 6: OOP in Python

•How do you create a class and object in Python? Give an example.


• Explain inheritance with an example.
• What is polymorphism? How is it implemented in Python?
• Write a program to create a class for Student and display its details.
• How do you create custom exception classes in Python?

Unit 7: Introduction to Libraries in Python

•What is NumPy? List its main uses.


• What is Matplotlib? How is it useful for data visualization?
• What is Tkinter? How is it used for GUI programming?
• Write a simple program using NumPy to create an array.
• Write a simple program to plot a line graph using Matplotlib.

Unit 8: Python SQL Database Access

•How do you connect Python with a SQL database?


• Explain the steps for performing INSERT, READ, UPDATE, DELETE operations in Python.
• What is the use of commit() and rollback() in database operations?
• Write a Python program to insert a record into a database table.
• Write a program to fetch and display records from a database.

You might also like