0% found this document useful (0 votes)
92 views3 pages

(Ge8151)

Anna university QP

Uploaded by

ksathishkm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
92 views3 pages

(Ge8151)

Anna university QP

Uploaded by

ksathishkm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Reg. No.

Question Paper Code : 40669

B.E./B.Tech. DEGREE EXAMINATIONS, NOVEMBER/DECEMBER 2021.

First Semester

Civil Engineering

GE 8151 — PROBLEM SOLVING AND PYTHON PROGRAMMING

(Common to : Aeronautical Engineering/Aerospace Engineering/Agriculture


Engineering/Automobile Engineering/Biomedical Engineering/Computer Science
and Engineering/Computer and Communication Engineering/Electrical and
Electronics Engineering/Electronics and Communication Engineering/Electronics
and Instrumentation Engineering/Electronics and Telecommunication Engineering/
Environmental Engineering/Geoinformatics Engineering/
Industrial Engineering/Industrial Engineering and Management/
Instrumentation and Control Engineering/ Manufacturing Engineering/
Marine Engineering/Material Science and Engineering/
Mechanical Engineering/Mechanical Engineering (Sandwich)/
Mechanical and Automation Engineering/Mechatronics Engineering/
Medical Electronics/Petrochemical Engineering/Production Engineering/Robotics
and Automation/Safety and Fire Engineering/Artificial Intelligence and Data
Science/Bio Technology/Biotechnology and Biochemical Engineering/
Chemical Engineering/Chemical and Electrochemical Engineering/Computer Science
and Business System/Fashion Technology/Food Technology/Handloom and
Technology/Information Technology/Petrochemical Technology/
Petroleum Engineering/Pharmaceutical Technology/Plastic Technology/Polymer
Technology/Textile Chemistry/Textile Technology)

(Regulations 2017)

Time : Three hours Maximum : 100 marks


Answer ALL questions.

PART A — (10  2 = 20 marks)

1. List out two differences between an algorithm and peseudo code.

2. What is a recursive algorithm?

3. Differentiate Compiler and Interpreter.

4. Write a python script to calculate the average of three numbers.


5. Write a python script to accept two integer numbers from the user and print
product of two numbers. If product is greater than 100 then also print the sum
of those two integer numbers.

6. What is the purpose of break and continue statements in python?

7. What is the output of the following python script?


A = [10, 20, 30, 40, 50]
for i in range (len(A))”
print (A[i], end ‘ ’)

8. Define dictionary in python with a suitable example.

9. Define a file and give the basic file operations in proper order to be performed
on a file in python language.

10. Give differences between packages and modules in python.

PART B — (5  13 = 65 marks)

11. (a) (i) Write a recursive algorithm to find the factorial of a given number.
(5)
(ii) Write a short note on building blocks of an algorithm. (8)

Or

(b) (i) Write an algorithm to check whether a given number is palindrome


or not. (5)

(ii) Differentiate iterative and recursion strategies for developing


algorithm. (8)

12. (a) (i) Write a python script to find the roots of a quadratic equation. (5)
(ii) Explain about various datatypes used in Python with example. (8)

Or

(b) (i) Write a python script to swap the values of two variables without
using an intermediate variable. (5)

(ii) Write a python code to find factorial of a number using function. (8)

2 40669
13. (a) Differentiate between linear search and binary search procedures and
write a python script to search for a number in a given list of numbers
using binary search. (13)

Or

(b) Write a short note on operations which are performed on strings in


python and write a python script that allows the user to type in phrase
and then outputs the acronym for that phrase.

Note : An acronym is a word formed by taking the first letters of the


words in a phrase and making a word from them. For example, RAM is
an acronym for random access memory. The acroym should be all
uppercase, even if the words in the phrase are not capitalized. (13)

14. (a) Write a python script to find the product of two given matrices. (13)

Or
(b) Write a python script to sort N numbers using insertion sort. (13)

15. (a) Write a python script that calculates the average word length in a single
paragraph stored in a text file by the user and stores total number of
words in the paragraph and average word length of the paragraph in
another text file. (13)

Or
(b) Write a python script to toggle the case of the text in an input text file
and save the output in an output text file. (13)
Note : the toggle of text “Hello World!” is “hELLO wORLD!”.

PART C — (1  15 = 15 marks)

16. (a) Format conversion is an important requirement in many software


applications. Hence develop an algorithm to perform the following date
format conversion :
Input date format : 07/21/1983
Output date format : July 21, 1983
Finally write a python script to implement the above algorithm. (15)

Or
(b) The sieve of Eratosthenes is an elegant algorithm for finding all of the
prime numbers upto some limit N. The basic idea is to first create a list of
numbers from 2 to N. The first number is removed from the list, and
announced as a prime number, and all multiplies of this number upto N
are removed from the list. This process continues until the list is empty.
Write a python script that prompts a user for N and then uses the sieve
algorithm to find all the primes less than or equal to N. (15)

—————————

3 40669

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy