0% found this document useful (0 votes)
4 views

Python Questions

The document outlines a comprehensive curriculum on Python programming, divided into five units covering basics, strings and lists, dictionaries, tuples and sets, files, and object-oriented programming. Each unit includes definitions, explanations, examples, and programming exercises to reinforce learning. Key concepts such as data types, control flow, file handling, and OOP principles are thoroughly addressed.

Uploaded by

yikeveg715
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)
4 views

Python Questions

The document outlines a comprehensive curriculum on Python programming, divided into five units covering basics, strings and lists, dictionaries, tuples and sets, files, and object-oriented programming. Each unit includes definitions, explanations, examples, and programming exercises to reinforce learning. Key concepts such as data types, control flow, file handling, and OOP principles are thoroughly addressed.

Uploaded by

yikeveg715
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/ 3

Unit I: Python Basics

1. What is Python? State its advantages and applications.

2. List and explain the key features of Python.

3. Differentiate between dynamically and strongly typed languages.

4. Explain single-line and multi-line comments in Python with examples.

5. What are identifiers and keywords? Give examples.

6. Explain the role of indentation in Python.

7. What is type casting? Explain with examples.

8. Define control flow statements. Explain if, if...else, and if...elif...else with syntax and examples.

9. What is the role of the type() function and is operator in Python?

10. What is the difference between break and continue statements? Give examples.

11. Write a Python program to check if a number is even or odd using if-else.

12. Write a program to print the sum of the first 10 even numbers.

13. Write a Python program to input a number and find its factorial.

14. Write the output of:

for x in range(3, 9):

print(x)

Unit II: Strings and Lists


1. What is a string in Python? How is it created?

2. Differentiate between mutable and immutable data types using strings and lists.

3. Explain basic string operations with examples.

4. What is string slicing? Demonstrate with an example.

5. List and explain any five string methods.

6. How do you format strings in Python? Explain with examples.

Page 1|3
7. What is a list in Python? How is it different from arrays?

8. Explain list slicing and indexing with examples.

9. List and explain any five built-in list functions.

10. Write a Python program to input 5 numbers into a list and find their sum.

11. Write a program to reverse a string using slicing.

Unit III: Dictionaries, Tuples, and Sets


1. What is a dictionary in Python? How are key-value pairs stored?

2. Explain how to create, access, and update dictionary elements.

3. List any four built-in dictionary methods and explain them.

4. What is the use of the del statement in dictionaries?

5. What is a tuple? How is it different from a list?

6. Explain indexing and slicing in tuples.

7. Write a program to count the number of times an element appears in a tuple.

8. What is a set? How is it different from a list and tuple?

9. Explain any four set methods with examples.

10. What is a frozen set? Write its uses.

11. Write a program using zip() to combine two lists into a dictionary.

Unit IV: Files


1. What are files in Python? Explain types of files.

2. Explain the process of opening and closing a file.

3. Write a program to read a text file and print its content.

4. What is the difference between text and binary files?

5. Explain file methods to read and write data with examples.

6. What is the use of the pickle module in Python?

7. Write a program to read a CSV file and display its content.

8. What is the os and os.path module used for in file handling?

Page 2|3
9. What are regular expressions? Explain with examples.

10. Write a program to extract email addresses from a text using regular expressions.

Unit V: Object-Oriented Programming


1. What is Object-Oriented Programming? List its advantages.

2. Define class and object with example.

3. Explain how to create a class and an object in Python.

4. What is a constructor? Write a program to demonstrate its use.

5. What are class attributes vs instance attributes? Explain with code.

6. Explain encapsulation, inheritance, and polymorphism in Python.

7. Write a program that demonstrates single inheritance.

8. How is method overriding achieved in Python?

9. What is the difference between __init__() and a regular method?

10. Create a class Student and input name and marks, then print details using a method.

Page 3|3

You might also like