Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Python questions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Unit 1: Introduction and Syntax of Python Program

1. What is Python? Explain its advantages and disadvantages.

2. Explain numeric data types in Python.

3. Differentiate between interactive mode and script mode of Python.

4. List different Object-Oriented Features supported by Python.

5. Describe the Python Interpreter.

6. What are keywords in Python? List some examples.

7. What is the difference between a compiler and an interpreter? How does Python execute code?

8. What are variables in Python? Explain variable naming rules.

9. What do you mean by a variable? Does Python allow explicit declaration of variables? Justify.

10. Define the following terms: Identifier, Literal, Keyword, Variable.

11. List different data types in Python with suitable examples.

12. Explain the concept of type conversion in Python with examples.

13. Describe the role of indentation in Python.

14. Explain the building blocks of Python.

15. List any four features of Python and explain any two.

16. What are the features and applications of Python?

17. Explain input and output statements/methods with examples.

18. What is the concept of memory management in Python?

19. Explain local and global variables with an example.

20. Define classes and objects in Python.

21. How do you write single-line and multi-line comments in Python?

22. Explain numeric data types in Python.

23. Explain the use of strings in Python. Also, explain ‘+’ and ‘*’ w.r.t. strings.

24. Explain the installation and setup process for Python.

25. Explain the significance of Python.

26. Describe the Python execution modes (Interactive vs. Script mode).

27. Explain the difference between compiled and interpreted languages.

28. Write algorithms for:


• Checking if a number is prime.

• Checking if a number is even or odd.

Unit 2: Python Operators and Control Flow Statements

1. What are the different types of operators in Python? Explain with examples.

2. Explain membership (in, not in) and identity (is, is not) operators.

3. Explain logical and bitwise operators in Python with examples.

4. Explain relational and arithmetic operators in Python with examples.

5. How does Python handle operator precedence? Provide an example.

6. Explain expressions in Python and their evaluation with examples.

7. Write a Python program to check whether a number is even or odd.

8. Write a Python program to find the largest of three numbers using if-elif-else.

9. Write a Python program to check if a number is prime.

10. Write a Python program to print the first 10 Fibonacci numbers using a loop.

11. Explain different types of loops (for, while) with examples.

12. Explain break, continue, and pass statements in Python.

13. Write the syntax of if-else and if-elif-else statements in Python.

14. State the use of the pass keyword.

15. Show the use of the elif keyword with an example.

16. Explain shorthand if-else statement in Python with an example.

17. Explain for loops in Python with an example.

18. Can we use the else keyword with loops? Justify your answer.

19. Write Python code to find the greatest among four numbers.

20. Explain the syntax of for loops with else.

21. How to swap two variables without using a third variable?

22. Explain the difference between = and == operators.

23. Explain arithmetic operators in Python with an example.

24. Explain bitwise operators with an example.

25. Write a Python program to print the factorial of a number.


26. Write a Python program to print the Fibonacci series up to n terms.

27. Explain the difference between is and == operators.

28. How do break and continue statements work in loops? Provide examples.

Unit 3: Data Structures in Python

1. What are lists in Python? Explain their properties and uses.

2. Explain list indexing and slicing with examples.

3. Differentiate between append(), extend(), and insert() methods.

4. What are tuples? How are they different from lists?

5. Can you update a tuple? Explain.

6. Differentiate between mutable and immutable data types with examples.

7. What is a dictionary? How is it different from a list?

8. Explain dictionary methods: get(), keys(), values(), and items().

9. Write a Python program to count word occurrences in a string.

10. What are sets? Explain set operations (union, intersection, difference).

11. Write a Python program to find the second largest element in a list.

12. Explain the count() and index() methods in tuples with examples.

13. Write Python code to display the pattern:

468

10 12 14 16 18

14. How do sets handle duplicate elements? Write a program to add/remove elements.

15. Define a list and provide an example.

16. Write the syntax to delete an element from a list.

17. Write a program to access the 32nd element from a list and update it.

18. Describe basic operations performed on lists with examples.

19. Explain any four built-in methods of lists in Python with examples.

20. Explain the basic operations that can be performed on tuples.


21. How to declare and access a tuple? Can tuples be updated? Justify your answer.

22. Explain built-in functions for tuples and describe any four.

23. Can we iterate through a set using a for loop? Justify your answer.

24. Explain two built-in methods of sets with examples.

25. Explain dictionary operations with examples.

26. How to declare a dictionary in Python?

27. Explain different ways and functions to remove key-value pairs from a dictionary.

28. Compare lists and dictionaries (four points).

29. Explain merging two dictionaries with an example.

30. Explain list-string mapping with an example.

31. Differentiate between discard() and remove() methods in sets.

32. How do you access values in a dictionary using keys?

33. Explain the use of del w.r.t lists.

34. Can we delete list elements? Justify your answer.

35. Write a short note on slicing lists.

36. Explain the following functions w.r.t lists:

o append()

o insert()

37. Explain different set operations with examples:

o Set Union

o Set Intersection

o Set Symmetric Difference

You might also like