mock_exam
mock_exam
1. What is an algorithm?
2. Write a pseudo-code to accept two numbers, add the numbers and print the
result.
5. Write a Python program to accept two numbers, find the greatest and print the
result.
6. What is recursion?
7. What is a list in Python? Give example.
10. Write the syntax for opening a file in Python for reading only.
PART – B (5×16=80 Marks)
(OR)
b) Explain with relevant diagrams and algorithm the Towers of Hanoi problem. (16)
13. a) i) Write a Python program using while loop to print the first n numbers
divisible by 5. (8)
ii) Write a Python program to compute the factorial of a given number. (8)
(OR)
b) Write Python programs for performing Linear and binary search. (16)
b) Write the Python program to sort an integer list using merge sort. (16)
15. a) Describe in detail how exceptions are handled in Python. Give relevant
examples. (16)
(OR)
b) Write a Python program to copy the contents of one file to another. (16)
———————