Question Paper Code : 70115
B.E./B.Tech. DEGREE EXAMINATIONS, NOVEMBER/DECEMBER 2022.
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.
How does flow of control work?
- 2.
Explain Towers of Hanoi problem.
- 3.
Write a snippet to display "Hello World" in python interpreter.
- 4.
Illustrate the use of * and + operators in string with example.
- 5.
Comment with an example on the use of local and global variable with the same identifier name.
- 6.
Define Fruitful Function.
- 7.
Relate String and List.
- 8.
Let list= ['a', 'b', 'c', 'd', 'e', 'f']. Find the following (a) List [1:3] (b) t[:4] (c) t[3:].
- 9.
How does try and execute work?
- 10.
How do you handle the exception inside a program when you try to open a non-existent file?
PART B — (5 × 16 = 80 marks)
- 11.(a)
- (i)Compare and contrast machine language, assembly language and high-level language in detail.
- (ii)Give the difference between recursion and iteration.
- Or
- (b)
Explain in detail about the Notation of Algorithm.
- 12.(a)
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.
- Or
- (b)
Explain in detail about precedence of python operators and the associativity of python operators.
- 13.(a)
Write a Python program to find the square root of a number without using inbuilt function and explain the same.
- Or
- (b)
Write a Python program for linear search and binary search and explain its implementation in detail.
- 14.(a)
Demonstrate with Python code the various operations that can be performed on tuples.
- Or
- (b)
Define Dictionary in python. Do the following operations on dictionaries.
- (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.
- (v)Merge two dictionaries and create a new dictionary using a single expression.
- 15.(a)
Explain about the file reading and writing operations using format operator with python code.
- Or
- (b)
Write a Python program to dump objects to a file using pickle.