Question Paper Code : 30198
B.E./B.Tech. DEGREE EXAMINATIONS, APRIL/MAY 2023.
First Semester
Civil Engineering
GE 3151 — PROBLEM SOLVING AND PYTHON PROGRAMMING
(Common to : All Branches)
(Regulations 2021)
Answer ALL questions.
PART A — (10 × 2 = 20 marks)
- 1.
State the qualities of a good algorithm.
- 2.
Enumerate the strategies involved in developing algorithm.
- 3.
What are the rules for writing an identifier?
- 4.
Mention the types of arguments in python.
- 5.
Compare return value and composition.
- 6.
Define string immutability.
- 7.
Define cloning in list.
- 8.
What is the benefit of using tuple assignment in python?
- 9.
How do you delete a file in Python?
- 10.
How do you use command line arguments to give input to the program?
PART B — (5 × 16 = 80 marks)
- 11.(a)
- (i)Briefly describe iteration and recursion. Illustrate with an example.(8)
- (ii)Write an algorithm and give the flowchart to find the net salary of an employee.(8)
- Or
- (b)
- (i)Compare machine language, assembly language and high-level language.(8)
- (ii)Write the pseudocode for the following : (1) Find maximum in a list (2) Towers of Hanoi.(8)
- 12.(a)
- (i)List down the rules for naming the variable with examples.(8)
- (ii)Write a Python program to swap two variables.(8)
- Or
- (b)
- (i)What is precedence? List out the order of precedence and demonstrate in detail with example.(8)
- (ii)Write a Python program to check whether a given year is a leap year or not.(8)
- 13.(a)
- (i)Explain string module.(8)
- (ii)Write a program to find the sum and average of array of numbers.(8)
- Or
- (b)
Write a program to perform search operation which sequentially checks each element of the list until a match is found or the whole list has been searched?
- 14.(a)
Explain in detail about lists, list operations and list slices.
- Or
- (b)
Write a program to generate electricity bill based upon the no. of units consumed. Refer the table below for unit and price details. [Table: No. of units consumed - Price (Domestic) - Price (Commercial): 1. Upto 200 units - 200 (Base price) - 500; 2. Units >200 and <500 - 1100 - 1700; 3. Units >500 <1000 - 4500 - 7000] Note : Program should read information from the user. Whether it is for domestic or commercial purpose.
- 15.(a)
- (i)Write a function that copies a file reading and writing upto 50 characters at a time.(8)
- (ii)Write a python program to count number of lines, words and characters in a text file.(8)
- Or
- (b)
Write a Python program to implement stack operations using modules.