II B.Tech II Semester Supplementary Examinations, January 2023 PYTHON PROGRAMMING (Civil Engineering) Time: 3 Hours Max. Marks: 70 Note: Answer one question from each unit. All questions carry equal marks. 5 × 14 = 70M UNIT-I 1. a) What are the different loop control statements available in Python? Explain with suitable examples. (8M) b) List and Explain about keywords used in Python. (6M) (OR) 2. a) Explain the need for continue and break statements in Python. Explain with examples. (7M) b) Write a python program to find the sum of all the primes below hundred. (7M) UNIT-II 3. a) Define recursive function. Write a program to compute factorial of a given number using recursive function. (7M) b) Discuss the string handling methods in python with examples. (7M) (OR) 4. a) What are modules? How do you use them in your programs? (7M) b) Write a python program that accepts a string from user and re-displays the same after removing vowels from it. (7M) UNIT-III 5. a) Write short notes on the following dictionary methods. (7M) (i) keys() (ii) values() (iii) get(key) (iv) clear() b) How to access list elements, explain with example program. (7M) (OR) 6. a) Explain the different list methods with an example. (7M) b) Write a Python program that creates a list of numbers 1–100 that are divisible by 5. (7M) UNIT-IV 7. a) Write a Python Program to count and display the number of characters, words and lines in a file. (7M) b) How to handle multiple exceptions in a single Python program? (7M) (OR) 8. a) Define an Exception. List and explain predefined exceptions in Python. (6M) b) Define file. List various file opening modes and explain how to open and close files in Python. (8M) UNIT-V 9. a) Differentiate between class variables and instance variables. (7M) b) Briefly explain about Method Overriding in Python. (7M) (OR) 10. a) Briefly explain encapsulation with an example. (7M) b) Write a Python Program to create a class that stores the name and marks of students using classes. (use list to store marks in 3 subjects). (7M)