Skip to content

// 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.

  1. Question 1

    Part AUnit 1Descriptive2 marks

    Python

    List two differences between an algorithm and pseudocode.

    No verified answer or solution is available for this question.

  2. Question 2

    Part AUnit 1Descriptive2 marks

    Python

    What is a recursive algorithm?

    No verified answer or solution is available for this question.

  3. Question 3

    Part AUnit 2Descriptive2 marks

    Python

    Differentiate a compiler and an interpreter.

    No verified answer or solution is available for this question.

  4. Question 4

    Part AUnit 2Descriptive2 marks

    Python

    Write a Python script to calculate the average of three numbers.

    No verified answer or solution is available for this question.

  5. Question 5

    Part AUnit 3Descriptive2 marks

    Python

    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.

  6. Question 6

    Part AUnit 3Descriptive2 marks

    Python

    What is the purpose of break and continue statements in Python?

    No verified answer or solution is available for this question.

  7. Question 7

    Part AUnits 3, 4Descriptive2 marks

    Python

    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.

  8. Question 8

    Part AUnit 4Descriptive2 marks

    Python

    Define a dictionary in Python with a suitable example.

    No verified answer or solution is available for this question.

  9. Question 9

    Part AUnit 5Descriptive2 marks

    Python

    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.

  10. Question 10

    Part AUnit 5Descriptive2 marks

    Python

    Give the differences between packages and modules in Python.

    No verified answer or solution is available for this question.

  11. Question 11

    Part BUnit 1Descriptive13 marks

    Python

    (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.

  12. Question 12

    Part BUnits 2, 3Descriptive13 marks

    Python

    (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.

  13. Question 13

    Part BUnit 3Descriptive13 marks

    Python

    (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.

  14. Question 14

    Part BUnits 3, 4Descriptive13 marks

    Python

    (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.

  15. Question 15

    Part BUnit 5Descriptive13 marks

    Python

    (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.

  16. Question 16

    Part CUnits 1, 3Descriptive15 marks

    Python

    (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.

Keep preparing

Revisit another year or explore a different paper in the library.

More from this exam