Python Question Bank
Python Question Bank
QUESTION BANK
PROBLEM SOLVING AND PYTHON
Subject Name Subject Code GE8151
PROGRAMMING
Department CSE Year/Sem I/I
UNIT1:
PARTA
1. Write an algorithm to find smallest among three numbers. ( April/may 2022)
2. Write an algorithm to accept two numbers, perform the sum and print the result.( Jan 2022)
3. List the symbol used in drawing the flowchart ( April/may 2019)
4. Distinguish between algorithm and program. (DEC/JAN 2019)
5. Write an algorithm to find the minimum number in the given list of number.
6. What is an Algorithm
7. Write down the characteristics of algorithm.
8. Write an pseudo-code to two accept to numbers, add the numbers and print the result (Jan
17)
9. How will you analyze the efficiency of algorithm ? (Nov/Dec 2019)
10. What is the use of algorithm ? Flowchart and Pseudo code in the perspective of problem
12. What are the factors used to judge the quality of an algorithm ? (Nov/Dec 2020)
13. What is control flow? List and define the ways of execution of control. (Nov/Dec 2020)
30. Write down the algorithm for finding minimum number in a list. (DEC/JAN 2019)
PARTB
1. Draw flowchart to accept three distinct numbers and find the greatest, print the result
(Nov/Dec 2022)
2. Draw a flowchart to find the sum of the series 1+2+3…..+100 (Nov/Dec 2022)
3. State the Tower of Hanoi problem. Outline the solution to the Tower of Hanoi problem
with relevant diagram. (Nov/Dec 2020)
4. Explain the strategies for developing an algorithm with example. (Nov/Dec 2020)
5. Explain the process of algorithm design and analysis (Nov/Dec 2020)
6. What is a programming language ? What are its types ? Explain in detail with their
advantages and disadvantages (Nov/Dec 2019)
7. Write a function find_index, which returns index of a number in the Fibonacci sequences.
If the number is an element of the sequence and returns -1.If the number is not contained in
it, call this function using user input and display the result. (Nov/Dec 2019)
8. What is recursive function? What are the advantages and disadvantages ? Compare with
iterative function. (Nov/Dec 2019)
9. Mention the different types of iterative structure allowed in Python. Explain the use of
continue and break statement with an example. (Apr/May 2019)
10. What is an algorithm? Summarize the characteristics of a good algorithm. (Apr/May 2019)
11. Outline the algorithm to display the first n odd numbers(Apr/May 2019)
12. Discuss the building blocks of an algorithm(Nov/Dec 2019)
DEPARTMENT OF SCIENCE AND HUMANITIES
QUESTION BANK
PROBLEM SOLVING AND PYTHON
Subject Name Subject Code GE8151
PROGRAMMING
Department CSE Year/Sem I/I
13. Identify the simple strategies for developing an algorithm (Nov/Dec 2019)
14. Write an algorithm to insert a card into a list of sorted cards(Nov/Dec 2019)
15. Draw flowchart to print the first n prime numbers(Apr/May 2017)
UNIT-II:
PARTA
1. Write a snippet to display “Hello World” in python interpreter?(Nov/Dec 2022)
2. Illustrate the use * and + operators in string with example?( Nov/Dec 2022)
3. List any four data types in python?(April/May 2022)
4. How do you assign a value to a tuple in python? (April/May 2022)
5. Are comments executable statements in python program? How comments are included in
python program?(January 2023)
6. Identify the operand(s) and operator(s) in following expression: sum = a + b(January 2023)
7. What are keywords give example ?(Dec/Jan 2019)
8. State the reason to divide programs into functions?( Dec/Jan 2019)
9. Name four types of scalar objects Python has?(Jan 2018)
10. What is a tuple ? How literals of type tuple are written? Give example?( Jan 2018)
11. Outline the modes Python interpreter works?( Jan 2017)
12. State the difference between / and // operators in Python? ( Jan 2017)
13. Outline the logic to swap the contents of two identifiers without using third variable?(Apr/May
2019)
14. State about Logical operators available in python language with example?( Apr/May 2019)
15. What is the numerical literal give example?(January 2018)
16. Compare interpreter and compiler. What type of translator is used for python?
DEPARTMENT OF SCIENCE AND HUMANITIES
QUESTION BANK
PROBLEM SOLVING AND PYTHON
Subject Name Subject Code GE8151
PROGRAMMING
Department CSE Year/Sem I/I
17. How can you create complex literal in python?
18. What are escape sequence? Write any four escape sequence in python.
19. Compare interpreter mode and script mode in python.
20. What is the numerical literal give example?
21. What is variables?
22. Give example for simultaneous assignment statements.
23. List out the rules to be followed in naming variables.
24. How to create a tuple?
25. Give the precedence of operators in python.
`
PARTB
1. Outline the data types supported in Python ( Jan 2022)
2. Name the types of operators supported by Python and outline any two with example?
( Jan 2022)
3. Why do we call python as interpreted and object-oriented language? Also explain about
interactive programs?(Apr/May 2022)
4. Write and explain the python program to swap two numbers with or without temporary
variables? (Apr/May 2022)
5. What is the role of interpreter?Give a detailed note on Python interpreter and interactive
mode of operation? Explain how python works in interactive mode and script mode with
examples?(Nov/Dec 2022)
6. Explain in detail about precedence of python operators and precedence of python
operators? (Nov/Dec 2022)
7. Describe about the concept of precedence and associatively of operators with example?
(Aril/May 2019)
8. Mention the list of keywords available in python? Compare it with variable
name(April/May 2019)
9. What are Statements? How they are constructed from variable and expressions in
python? (April/May 2019)
10. Sketch the structure of interpreter and compiler Detail the difference between them?
Explain how python works in interactive mode and script mode with example?(Dec/Jan
2019)
11. Summarize the precedence of mathematical operators in python? (Dec/Jan 2019)
12. Explain the syntax and structure of user-defined function in python with examples?
DEPARTMENT OF SCIENCE AND HUMANITIES
QUESTION BANK
PROBLEM SOLVING AND PYTHON
Subject Name Subject Code GE8151
PROGRAMMING
Department CSE Year/Sem I/I
Also discuss about parameter passing in functions? (Dec/Jan 2019)
13. Write the python function to swap the values of two variables? (Dec/Jan 2019)
UNIT-3 - PARTA
1. Define recursive function (Nov/Dec 2022)
2. What is a Booleanvalue?
3. Difference between break andcontinue.
4. Write a program to find sum of nnumbers
5. Compare string and string slices.
6. Explain global and localscope.
7. Name the two types of iterative statements supported by Python. (Nov/Dec 2022)
8. Define string slicing. Give an example(Nov/Dec 2020)
Give an array of n elements, write a function to search a given element X in the array
9. (Nov/Dec 2020)
10. Do loop have else clause? When it will be executed? (Nov/Dec 2019)
11. Write a program to display a set strings using range( ) function? (Nov/Dec 2019)
12. Present the flow of execution for a while statement. (Dec/Jan 2019)
13. Define recursion with an example(Dec/Jan 2019)
Comment with an example on the use of local and global variable with same identifier name
14.
(Apr/May 2019)
Write a Python program to accept two number, multiply them and print the results (Jan
15.
2018)
Write a Python program to accept two number, find the greatest and print the results (Jan
16.
2018)
17. List out the conditional branching statement in Python (Nov/Dec 2022)
18. What is the purpose of pass statement? (Apr/May 2022)
19. What is linear search ?(Apr/May 2022)
20. Write a Python program to find the sum of cubes of n variables (Nov/Dec 2019)
21. Write the syntax of if and if-else statements.
22. What will be the output of print(str[2:5])ifstr=’hello world!’?
23. Explain the significance of for loop with else in an example.
24. Differentiate for loop and while loop.
25. Illustrate the flow chart of if-elif-else statements.
PARTB
DEPARTMENT OF SCIENCE AND HUMANITIES
QUESTION BANK
PROBLEM SOLVING AND PYTHON
Subject Name Subject Code GE8151
PROGRAMMING
Department CSE Year/Sem I/I
1. Outline the conditional branching statement in Python with an example (Nov/Dec 2022)
Name the types of operators supported by Python and outline any two with example? ( Jan
2.
2022)
3. Outline the loop, break and continue statement in Python with an example (Nov/Dec 2022)
4. Brief fruitful function and void function with example (Nov/Dec 2020)
There are two sorted array A and B of size n each. Write an algorithm to find the median of
5.
the array obtained after merging two arrays. (Nov/Dec 2020)
6. Write recursive implementation of binary search (Nov/Dec 2020)
What are immutable strings ? For the given sentence, sort words in ascending order. “
7.
Chennai Anna University”. (Nov/Dec 2020)
Explain the syntax and structure of user-defined function in python with examples? Also
8.
discuss about parameter passing in functions? (Dec/Jan 2019)
Write a python program to generate all permutations of a string using built in function
9.
(Nov/Dec 2019)
10. List three types of conditional statements and explain them (Dec/Jan 2019)
11. Python Strings are immutable. Justify with an example (Dec/Jan 2019)
What is the difference between break and continue in python? Explain it with suitable
12.
example(Apr/May2022)
What is string function in python? Explain any 3 python string method with an example
13.
(Apr/May2022)
Write the python program to find the factorial of a given number without recursion and with
14.
recursion (Jan 2018).
15. Write the python program to find the first N fibonacci numbers (Jan 2018)..
UNIT4: PARTA
1. What is a list?(Jan-2018)
2. Relate String and List? (Jan 2018)(Jan 2019)
3. How list differs from tuple. (Jan-2018)
4. How to slice a list in Python. (Jan-2018)
5. Give a function that can take a value and return the first key mapping to that value in a dictionary.(Jan
2019)
DEPARTMENT OF SCIENCE AND HUMANITIES
QUESTION BANK
PROBLEM SOLVING AND PYTHON
Subject Name Subject Code GE8151
PROGRAMMING
Department CSE Year/Sem I/I
6. How to create a list in python? Illustrate the use of negative indexing of list with example. (May 2019)
7. Demonstrate with simple code to draw the histogram in python. (May 2019)
8. How will you update list items? Give one example. (Nov / Dec 2019)
9. Can function return tuples? If yes Give examples. (Nov / Dec 2019)
10. How do you assign value to the Python(April/may 2022)
11. How python Dictionaries store data? Give Example (jan 2022)
12. In python how the values stored in a list are accessed? Should the elements of a list be of the same Data
type? (jan 2022)
13. Write a python program to swap two variables.
14. Let List = [‘a’,’b’,’c’,’d’,’e’,’f’].Find the following (Nov / Dec 2022)
a) List= [1:3]
b) t [:4]
c) t [3:]
15. Solve a).[0] * 4 and b). [1, 2, 3] * 3.
16. What is cloning list? Give example. (Nov / Dec 2020)
17. What do you mean by list aliasing?
18. What is tuple give example?
19. Define Dictionary give example?
20. Write Dictionary methods with an example?
21. Define List Comprehension?
22. What do you mean by List parameters with example?
23. Write the advantages of List comprehension?
24. Define Lambda function with example?
25. What is the use of fromkeys() in Dictionary?
26. What are immutable datatypes available in python?
PARTB
1. Name the operations that can be performed on a list and outline any four with example. (Nov / Dec
2022)
DEPARTMENT OF SCIENCE AND HUMANITIES
QUESTION BANK
PROBLEM SOLVING AND PYTHON
Subject Name Subject Code GE8151
PROGRAMMING
Department CSE Year/Sem I/I
2. Write separate python programs to illustrate create, access, concatenate and delete operation in a tuple.
(Nov / Dec 2022)
3. Write a python program to create a dictionary and sort the content based on values in reverse order.
(Nov / Dec 2022)
4. Write a function that takes a histogram and returns a list. (Nov / Dec 2020)
5. Discuss the different options to traverse a list. (Dec/Jan 19)
6. Demonstrate the working of + , * and slice operator in python. (Dec/Jan 19)
7. Compare and contrast tuples and list in python. (Dec/Jan 19)
8. Write a python script to sort n numbers using selection sort. (Dec/Jan 19)
9. What is tuple in python? How does it differ from list? (Nov / Dec 2019)
10. Write a python program to sort n numbers using merge sort. (Nov / Dec 2019)
11. Merge two dictionaries and create a new dictionary using a single expression. (Nov / Dec 2021)
12. What is list comprehension in python? Explain with example. (Dec/Jan 19)
13. Merge two dictionaries and create a new dictionary using a single expression.
14. What is list comprehension in python? Explain with example. .(Nov / Dec 2019)
15. Define Dictionary in python. Do the following operations on dictionaries.(Nov / Dec 2019)
i) Initialize two dictionaries with key and value pairs.
ii) Compare two dictionaries with master key list and print missing keys.
iii) Find keys that are in first and not in second dictionary.
iv) Find same keys in two dictionaries.
UNIT5: PARTA
1. Write the syntax for opening a file to write in binary mode. (Nov/Dec 22)
2. What are the different module in python? (Nov/Dec 22)
3. What are packages? How to import modules from a package? (Nov/Dec 20)
4. How will you update the contents of one file to another file in python? (Nov/Dec 20)
5. How to use command line arguments in python? (Nov/Dec 19)
6. Write methods to rename and delete files. (Nov/Dec 19)
7. What is a module? Give an Example? (Dec/Jan 2019)
8. Find the syntax error in the code given: while True print(‘Hello word’)
9. List any 4 file operation. (Apr/May 22)
10. Write a python program to count words in a sentence using split( ) function. (Apr/May 22)
11. What is command line argument? (Apr/May 19)
12. Write a python program to display the current date and time. (Jan 2018)
13. Write a note on modular design. (Jan 2018)
14. What is an exception? Give example. (Jan 2017)
15. Write the syntax for opening a file in python for reading only. (Jan 2018)
16. What is format operator?
17. Differentiate file and modules?
18. Write note on modular design?
19. List some of the Built-in exception in python?
20. Differentiate errors and exceptions?
21. How to handle exception in Python?
22. What is pickling in python?
23. Write program to count number of words in a string?
24. Differentiate Modules and Packages?
DEPARTMENT OF SCIENCE AND HUMANITIES
QUESTION BANK
PROBLEM SOLVING AND PYTHON
Subject Name Subject Code GE8151
PROGRAMMING
Department CSE Year/Sem I/I
25. Write down the steps to create a package?
PARTB
1. Name the different access modes for opening a file and present an outline of the same. (Nov/Dec 22)
2. Why is an exception? Elaborate exception handling in python. (Nov/Dec 22)
3. Write the program to concentrate the contents of two files into a single file. Get the input for two files
from the user and concatenate it. (Nov/Dec 22)
4. Write the program that reads a file and builds a histogram of the words in the file. (Nov/Dec 20)
5. Print all numbers present in text file and also print the number of blank spaces in that file. (Nov/Dec 20)
6. How to read or process command line arguments in python? Explain with example. (Nov/Dec 20)
7. Write a python program to count the number of words in text file. (Nov/Dec 19)
8. How to merge multiple files into a new using python. (Nov/Dec 19)
9. What are modules in python? How will you import them? Explain the concept by creating and
importing a module. (Nov/Dec 19)
10. Explain the commands used to read and write into a file with example. (Dec/Jan 19)
11. Discuss about the use of format operator in file processing. (Dec/Jan 19)
12. Appraise the use of try block and except block in python with syntax. (Jan 18)
13. Write the python program to copy the contents of one file to another. (Jan 18)
14. Explain with an example exception with arguments in python?
15. Write a python program to find most frequent words in a text read from a file?