// Anna University, Chennai / 2021
Anna University — Problem Solving and Python Programming (GE8151), November/December 2021
Problem Solving and Python Programming · GE8151 · R2017 · B.E./B.Tech. Engineering (common paper) · Semester 1
Files open in a new tab. Use your browser's download or save option to keep a copy.
Work through the questions
16 questions
No verified answers are available for this paper.
List two differences between an algorithm and pseudocode.
No verified answer or solution is available for this question.
What is a recursive algorithm?
No verified answer or solution is available for this question.
Differentiate a compiler and an interpreter.
No verified answer or solution is available for this question.
Write a Python script to calculate the average of three numbers.
No verified answer or solution is available for this question.
Write a Python script to accept two integers from the user and print their product. If the product is greater than 100, also print their sum.
No verified answer or solution is available for this question.
What is the purpose of break and continue statements in Python?
No verified answer or solution is available for this question.
What is the output of the following Python script, as printed? A = [10, 20, 30, 40, 50] for i in range (len(A))” print (A[i], end ‘ ’)
No verified answer or solution is available for this question.
Define a dictionary in Python with a suitable example.
No verified answer or solution is available for this question.
Define a file and give the basic Python file operations in the order in which they are performed.
No verified answer or solution is available for this question.
Give the differences between packages and modules in Python.
No verified answer or solution is available for this question.
(a) (i) Write a recursive algorithm to find the factorial of a given number. (5 marks) (ii) Write a short note on the building blocks of an algorithm. (8 marks) (OR) (b) (i) Write an algorithm to check whether a number is a palindrome. (5 marks) (ii) Differentiate iterative and recursive strategies for developing an algorithm. (8 marks)
No verified answer or solution is available for this question.
(a) (i) Write a Python script to find the roots of a quadratic equation. (5 marks) (ii) Explain the various data types used in Python with examples. (8 marks) (OR) (b) (i) Write a Python script to swap two variables without an intermediate variable. (5 marks) (ii) Write Python code to find a number's factorial using a function. (8 marks)
No verified answer or solution is available for this question.
(a) Differentiate between linear and binary search and write a Python script that searches for a number in a given list using binary search. (13 marks) (OR) (b) Write a short note on operations performed on Python strings. Write a Python script that accepts a phrase and outputs its acronym. An acronym takes the first letters of the words in a phrase. For example, RAM stands for random access memory. Output the acronym in uppercase even if the phrase is not capitalized. (13 marks)
No verified answer or solution is available for this question.
(a) Write a Python script to find the product of two given matrices. (13 marks) (OR) (b) Write a Python script to sort N numbers using insertion sort. (13 marks)
No verified answer or solution is available for this question.
(a) Write a Python script that calculates the average word length in a paragraph stored by the user in a text file and stores the total number of words and the average word length in another text file. (13 marks) (OR) (b) Write a Python script to toggle the case of the text in an input file and save it in an output file. The toggle of "Hello World!" is "hELLO wORLD!". (13 marks)
No verified answer or solution is available for this question.
(a) Develop an algorithm to convert the date format from 07/21/1983 to July 21, 1983. Write a Python script to implement the algorithm. (15 marks) (OR) (b) The sieve of Eratosthenes finds primes up to a limit N. Start with the numbers from 2 to N. Remove the first number, report it as prime and remove all its multiples up to N. Repeat until the list is empty. Write a Python script that prompts for N and uses this algorithm to find all primes less than or equal to N. (15 marks)
No verified answer or solution is available for this question.