python QB
python QB
python QB
PART-A
Unit-Is
1. Define Algorithm
2. Distinguish between algorithm and program.
3. Define recursion
4. List the different building blocks of algorithms.
5. What are flowcharts and list down their advantages?
6. Define an iterative statement.
7. Draw a flowchart to find the maximum among the three numbers.
8. What is the use of algorithm, Flowchart and Pseudocode in the perspective of
problem solving?
9. What is a Pseudocode?
10.What are the benefits of pseudocode?
Unit-II
1. List any four build in data types in python.
2. What are keywords? Give example.
3. Compare interpreter and compiler. What type of translator is used for python?
4. State the reasons to divide programs in to functions
5. What is a variables?
6. Define expression with example
7. Outline the logic to swap the content of two identifiers without using third variable.
8. Write a python script to calculate the average of three numbers.
9. Give the precedence of operators in python.
10.What is a tuple? How literals of type tuple are written? Give example.
Unit-III
1. Name the two types of interative statements supported by python
2. Differentiate while loop and for loop
3. Do loop statements have else clause? When will it be executed?
4. List the various types of operators in python.
5. What is slice? Give example.
6. Define parameter and argument.
7. Define function and list any two advantages of using the function.
8. Differentiate break and continue.
9. Write a python program to print sum of cubes of the values of n variables.
10.What are the identity operators used in python?
Unit-IV
1. What is a list? How lists differ from tuples?
2. Relate strings and lists.
3. Why list is a dynamic mutable type?
4. What is meant by cloning?
5. What is tuples? Give examples.
6. Can function return tuples? If yes give example.
7. Define dictionary? What is the main use of a dictionary?
8. Why python dictionaries are called mappings?
9. Give a function that can take a value and return the first key mapping to that value
in a dictionary.
10.Let list=[‘a’,’b’,’c’,’d’,’e’,’f’]. find the following.
(a)list [1:3] (b) t[:4] (c) t[3:]
Unit-V
1. Write the syntax for opening a file to write in binary mode.
2. What is command line arguments? How to use the command line arguments in
python?
3. What is a module? List their types and give example.
4. What are exceptions?
5. What is format operator?
6. What are packages? How to import modules from a packages?
7. How will you update the content of ome file to another file in python?
8. Write methods to rename and delete files.
9. Find the syntax error in the code given:
While true print(‘Hello world’)
10.List any five build in exception in python.
PART-B
Unit-I
1. State the Towers of Hanoi problem. Outline a solution to the Towers of Hanoi problem
with relevant diagrams.(JAN 2022)
2. i)Discuss about the building blocks of algorithms. (DEC/JAN 2019)
ii)Identify the simple strategies for developing an algorithm.(DEC/JAN 2019)
3. i)Draw a flow chart to accept three distinct numbers, find the greatest and print the result.
(JAN 2022)
ii)Draw a flow chart to find the sum of the series (JAN 2022)
1+2+3+4+5+……+100.
4. What is recursion ? Write and explain a python program to find a factorial of number using
recursion.(APRIL/MAY 2022)
5. i)What is an algorithm? Summarize the characteristics of a good algorithm.(APRIL/MAY
2019)
ii)Outline the algorithm for displaying the first n odd numbers. (APRIL/MAY 2019)
6.Explain in detail about the Notation of Algorithm.(NOV/DEC 2022)
Unit-II
1. Explain in detail about precedence of python operators and the associativity of python
operators. (NOV/DEC 2022)
2. Write and explain the python program to swap two numbers with and without temporary
variables. (APRIL/MAY 2022)
3. What is the role of an 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)
4. What are statements and expressions? How are they constructed from variable and
expressions in Python? (APRIL/MAY 2019)
5. Explain about various datatypes used in python with examples. (NOV/DEC 2021)
6. Name the types of operators supported by python and outline any two with an example.
(NOV/DEC 2022)
Unit-III
1. Write a python program to find the square root of a number without using inbuilt function
and explain the same. (NOV/DEC 2022)
2. Write a python program for linear search and binary search and explain its implementation
in detail. (NOV/DEC 2022)
3. List the three types of conditional statements and explain them. (DEC/JAN 2019)
4. i) Python strings are immutable. Justify with an example. (DEC/JAN 2019)
ii) What is difference between break and continue in python? Explain with suitable
examples. (APRIL/MAY 2022)
5. Outline about function definition and function call with an example. (APRIL/MAY 2019)
6. What is string function in python? Explain any three python string methods with an
example. (APRIL/MAY 2022)
Unit-IV
1. Demonstrate with the code various operation that can be performed on Tuples.
(APRIL/MAY2018)
2. Define python lists. How to add the elements in the list. Explain with suitable example
programs. (APRIL/MAY2022)
3. Write a python program to create a Dictionary and sort the content based on values in
reverse order. (JANUARY2022)
4.i) Discuss the different options to traverse a list.
ii) Demonstrate the working of + and *and slice operators in
Python. (DEC/JAN2019)
5. Outline the algorithm and write a python program to sort the number in ascending order
using Merge sort.(APRIL/MAY 2018).
6.Write a python script to sort N numbers using insertion sort. (NOV/DEC 2021)
Unit-V
1. Why does the python require file handling. Explain opening files in python with all modes.
(APRIL/MAY 2022)
2. Describe how exceptions are handled in python with necessary examples. (DEC/JAN 2019)
3. i) Design a python code to count the number of words in a file. (APRIL/MAY 2018)
ii) How to merge multiple files in to a new file using python. (NOV/DEC 2019)
4. i) Discuss about format operators in file processing. (DEC/JAN 2019)
ii)Write a python program to dump objects to a file using pickle. (NOV/DEC 2022)
5. Write a program to concatenate the content of two files into a single file. Get the input for
two files from the user and concatenate it. (JANUARY 2022)
6. What are modules in python.? How will you import them.? Explain the concept by
creating and importing modules in python. (NOV/DEC2019)