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

Question Bank for python

The document is a comprehensive question bank divided into five units covering Python programming topics. Each unit contains questions categorized into 2 marks, 3 marks, and 5 marks, addressing various aspects of Python such as its history, data types, control flow, functions, and data structures. The questions range from basic definitions and program writing to more complex concepts and comparisons, aimed at assessing knowledge and skills 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 PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Question Bank for python

The document is a comprehensive question bank divided into five units covering Python programming topics. Each unit contains questions categorized into 2 marks, 3 marks, and 5 marks, addressing various aspects of Python such as its history, data types, control flow, functions, and data structures. The questions range from basic definitions and program writing to more complex concepts and comparisons, aimed at assessing knowledge and skills 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 PDF, TXT or read online on Scribd
You are on page 1/ 9

Question Bank

2 marks Questions
UNIT-I: INTRODUCTION
1. What is the history of Python programming language?
2. List four key features of Python.
3. Explain the purpose of quotations in Python with an example.
4. Describe the significance of indentation in Python programming.
5. Write a simple Python program to print "Hello, World!".
6. Demonstrate how to use input operations to accept a user’s name and
display it.
7. Differentiate between single-line and multi-line statements in Python.
8. Compare the use of single, double, and triple quotations in Python.
9. Assess the importance of Python’s interactive mode for beginners.
10. Design a Python program that takes two numbers as input and prints their
sum.
UNIT-II: DATA, EXPRESSIONS, STATEMENTS
11. Define the term "variable" in Python.
12. List the basic data types in Python.
13. Explain the precedence of operators in Python with an example.
14. Describe how tuple assignment works in Python.
15. Write a Python program to exchange the values of two variables.
16. Create a program to calculate the distance between two points using
coordinates.
17. Compare the use of comments and expressions in a Python program.
18. Analyze how Python’s interactive mode differs from script mode.
19. Justify the need for type conversion in Python expressions.
20. Design a program to circulate the values of three variables (e.g., a→b,
b→c, c→a).
UNIT-III: CONTROL FLOW STATEMENTS AND STRINGS
21. What is the purpose of the "break" statement in Python?
22. List three in-built string methods in Python.
23. Explain the difference between "while" and "for" loops in Python.
24. Describe how string slicing works with an example.
25. Write a Python program using an if-elif-else statement to check if a
number is positive, negative, or zero.
26. Demonstrate the use of a for loop to print the characters of a string.
27. Differentiate between the "continue" and "pass" statements with
examples.
28. Compare nested if statements and if-elif-else statements in terms of
readability.
29. Assess the effectiveness of string formatting operations in Python.
30. Design a program to reverse a string using a while loop.

UNIT-IV: FUNCTIONS AND FILES


31. Define the term "recursion" in Python.
32. List two format operators used in Python file operations.
33. Explain the difference between local and global scope in Python
functions.
34. Describe how to read data from a file in Python.
35. Write a Python function that returns the square of a number.
36. Create a program to write "Hello, File!" to a text file.
37. Compare function composition and recursion with examples.
38. Analyze the role of parameters in Python functions.
39. Evaluate the advantages of using return values in functions.
40. Design a recursive function to calculate the factorial of a number.
UNIT-V: LIST, SET, TUPLES, DICTIONARIES
41. What is the difference between a list and a tuple in Python?
42. List three dictionary methods in Python.
43. Explain the concept of mutability in Python lists.
44. Describe how tuple assignment can be used as a return value.
45. Write a Python program to append an element to a list using a list
method.
46. Create a dictionary and demonstrate how to access its values.
47. Compare the operations of sets and lists in Python.
48. Analyze the difference between aliasing and cloning in lists.
49. Assess the usefulness of NumPy over traditional Python lists for
numerical operations.
50. Design a program using Matplotlib to plot a simple line graph with given
data points.

3 marks Questions:
UNIT-I: INTRODUCTION
1. Outline the history of Python programming language with key
milestones.
2. List and briefly describe three features of Python that make it popular.
3. Explain how quotations (single, double, and triple) are used in Python
with examples.
4. Discuss the role of lines and indentation in structuring Python code.
5. Write a Python program that takes a user’s age as input and prints a
greeting message.
6. Demonstrate the use of multi-line statements in Python with a simple
example.
7. Differentiate between input and output operations in Python with
examples.
8. Compare the readability of code with proper indentation versus without
indentation.
9. Assess the significance of Python’s simplicity for beginner programmers.
10. Design a Python program that accepts two strings as input and
concatenates them with a space.

UNIT-II: DATA, EXPRESSIONS, STATEMENTS


11. Define the five basic data types in Python with one example each.
12. State the rules for operator precedence in Python expressions.
13. Explain how tuple assignment simplifies swapping variable values in
Python.
14. Describe the purpose of comments in Python with an example.
15. Write a Python program to exchange the values of two variables without
using a temporary variable.
16. Create a program to compute the Euclidean distance between two points
given their coordinates.
17. Compare the use of Python interpreter in interactive mode versus script
mode.
18. Analyse the impact of incorrect operator precedence in a mathematical
expression.
19. Justify the use of type conversion in handling mixed data types in
expressions.
20. Design a program to circulate the values of four variables in a clockwise
manner.

UNIT-III: CONTROL FLOW STATEMENTS AND STRINGS


21. Define the "continue" and "break" statements with their purposes in
loops.
22. List and briefly explain three in-built string methods in Python.
23. Explain the role of the "else" clause when used with loops in Python.
24. Discuss how string formatting operations enhance output readability.
25. Write a Python program using nested if statements to classify a number as
even/odd and positive/negative.
26. Demonstrate a for loop to count vowels in a given string.
27. Compare the functionality of "while" and "for" loops with examples.
28. Differentiate between string slicing and string methods in manipulating
strings.
29. Evaluate the efficiency of using the "pass" statement in program
development.
30. Design a program to check if a string is a palindrome using a while loop.

UNIT-IV: FUNCTIONS AND FILES


31. Define function composition and recursion in Python.
32. List three key operations involved in file handling in Python.
33. Explain the difference between local and global variables with an
example.
34. Discuss how format operators improve file output in Python.
35. Write a Python function that takes two parameters and returns their
product.
36. Create a program to read a text file and print its contents line by line.
37. Compare the use of return values versus print statements in functions.
38. Analyze the advantages of recursion over iteration in solving problems
like factorial.
39. Assess the importance of proper file path handling in file operations.
40. Design a recursive function to compute the nth Fibonacci number.

UNIT-V: LIST, SET, TUPLES, DICTIONARIES


41. Define mutability and immutability with respect to lists and tuples.
42. List three operations that can be performed on a Python dictionary.
43. Explain the concept of aliasing in lists with an example.
44. Discuss how tuples can be used as return values in functions.
45. Write a Python program to sort a list of numbers using a list method.
46. Create a dictionary to store student names and marks, then print the
highest mark.
47. Compare the use of sets and lists for storing unique elements.
48. Analyze the difference between cloning and aliasing in list operations.
49. Evaluate the role of NumPy in simplifying array-based computations
compared to lists.
50. Design a program using Matplotlib to plot a bar chart of five students’
marks.

5 marks Questions:
UNIT-I: INTRODUCTION
1. Describe the history of Python, highlighting its origin, major versions,
and contributors.
2. Enumerate and explain five key features of Python that distinguish it
from other programming languages.
3. Explain the significance of quotations in Python and illustrate their use
with examples for single, double, and triple quotes.
4. Discuss how lines and indentation affect the execution of a Python
program, with an example.
5. Write a Python program that accepts a user’s name and age as input and
prints a formatted welcome message.
6. Demonstrate the use of multi-line statements to calculate and display the
area and perimeter of a rectangle.
7. Compare input and output operations in Python, providing examples of
each and their practical uses.
8. Differentiate between Python’s script mode and interactive mode,
analyzing their advantages in coding.
9. Assess the impact of Python’s simplicity and readability on its adoption
in educational settings.
10. Design a Python program that takes three inputs (name, city, and hobby)
and generates a personalized multi-line story.

UNIT-II: DATA, EXPRESSIONS, STATEMENTS


11. List and describe the five basic data types in Python, providing an
example for each.
12. Explain the precedence of operators in Python with a table and examples
of arithmetic operations.
13. Discuss how tuple assignment works in Python and illustrate its use in
swapping values with an example.
14. Explain the role of comments and expressions in Python, highlighting
their importance in code clarity.
15. Write a Python program to exchange the values of two variables using
tuple assignment and verify the result.
16. Create a program to calculate the distance between two points using user-
input coordinates and the distance formula.
17. Compare the functionality of Python’s interactive mode versus script
mode with examples of their use cases.
18. Analyze the effect of operator precedence on the evaluation of a complex
expression like 3 + 5 * 2 / 4.
19. Evaluate the necessity of type conversion in Python when working with
mixed data types in expressions.
20. Design a Python program to circulate the values of five variables in a
circular pattern and display each step.

UNIT-III: CONTROL FLOW STATEMENTS AND STRINGS


21. Define and explain the purpose of "break," "continue," and "pass"
statements in Python loops with examples.
22. List and describe five in-built string methods in Python, including their
syntax and use.
23. Discuss the significance of the "else" clause with loops, providing an
example of its application.
24. Explain string formatting operations in Python and illustrate with two
different methods.
25. Write a Python program using if-elif-else and nested if to categorize a
number as positive/negative, even/odd.
26. Create a program using a for loop to reverse a string and print the result
with proper formatting.
27. Compare the use of "while" and "for" loops in Python, providing
examples for different scenarios.
28. Analyze the differences between string slicing and string methods in
terms of flexibility and efficiency.
29. Assess the usefulness of the "continue" statement versus "if-else" logic in
loop control.
30. Design a Python program to check if a user-input string is a palindrome,
using both loops and string slicing.

UNIT-IV: FUNCTIONS AND FILES


31. Define recursion and function composition in Python, providing an
example for each concept.
32. Explain the process of reading and writing files in Python, including the
role of format operators.
33. Discuss the difference between local and global scope in Python
functions with a detailed example.
34. Explain how filenames and paths are handled in Python file operations,
with an example.
35. Write a Python function that takes three numbers as parameters and
returns their average.
36. Create a program to write a list of student names to a file and then read
and display them.
37. Compare the use of recursion versus iteration in solving a factorial
problem, with examples.
38. Analyze the advantages and limitations of using return values in functions
compared to global variables.
39. Evaluate the importance of proper error handling in file operations in
Python.
40. Design a recursive function to compute the sum of digits in a number and
test it with user input.

UNIT-V: LIST, SET, TUPLES, DICTIONARIES


41. Define and differentiate between lists, tuples, and sets in Python with
examples.
42. List and explain five dictionary methods in Python, including their
practical applications.
43. Discuss the concept of mutability in lists and immutability in tuples, with
examples of their implications.
44. Explain how tuples can be used as return values in functions, with an
illustrative example.
45. Write a Python program to create a list, perform slicing, and append
elements, displaying the results.
46. Create a dictionary of five items (product: price) and write a program to
calculate the total price.
47. Compare the use of sets and lists for storing and manipulating data, with
examples of operations.
48. Analyze the differences between aliasing and cloning in lists,
demonstrating their effects on code.
49. Assess the advantages of using NumPy and pandas over traditional
Python lists for data analysis.
50. Design a Python program using Matplotlib to plot a line graph of
temperature data over a week.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy