Problem Solving and Python Programming - GE3151 2021 Regulation - Question Bank
Problem Solving and Python Programming - GE3151 2021 Regulation - Question Bank
Part A
1. Define Algorithm
2. Write an algorithm to find sum of first n natural numbers
3. What are the components of a computer
4. How will you analyze the efficiency of an algorithm?
5. What is the use of algorithm, Flowchart and Pseudocode in the perspective of problem
solving? 6.Distinguish between algorithm and program.
7. Write an algorithm to find the minimum number in a given list of numbers.
8. Write an algorithm to accept two numbers. Compute sum and print the result.
9. What is a Pseudocode?
10. What are flowcharts and list down their advantages?
11. Enlist the advantages of algorithm.
12. What are the benefits of pseudocode?
13. Write down steps involved in writing a program to solve a problem.
14. Draw a flowchart to find the maximum among the three numbers.
15. What are the factors used to judge the quality of the algorithm?
16. What is control flow? List and define the ways of execution of control.
17. List the different building blocks of algorithms.
18. Define recursion.
Part B
Part B
1. Write about different types of python operators with example scripts (12)
2. Summarize the precedence of operators in python (4)
3. Compare interpreter and compiler. What type of translator is used for python explain with neat diagram.
(12)
4. Write a script to circulate n values (4)
5. Write a python program to rotate a list by right n times with and without slicing technique.(8)
6. Discuss about keyboard arguments and default arguments in python with example.(8)
7. Evaluate the following expressions in python (6) (i) 24//6%3 (ii)float(4+int(2.39)%2) (iii)2**2**3
8. Sketch the structures of interpreter and complier. Detail the difference between them. Explain
how python works in Interactive mode and script mode with examples.(8)
9. What is a numeric literal? Give examples.(4)
10. Appraise the arithmetic operations in Python with an example.(12)
11. Outline the operator precedence of arithmetic operators in Python.(6)
12. Write a Python Program to Exchange the Value of two variables.(4)
Unit III – Control Flow, Function, Strings
Part A
1. List the three types of conditional statements in python and explain them (16)
2. Python strings are immutable. Justify with an
example (8) 3, Describe user defined function
with example (8)
4. List the two types of looping statement in python and explain them (16)
5. Compare lists and array with example. Can list be considered as an array? Justify.(6)
6. Describe user defined function with example (8)
7. Write a function find index (), which returns the index of a number in the Fibonacci sequence, if
the number is an element of this sequence and returns-1 if the number is not contained in it, call
this function using user input and display the result.(8)
8. Write a python program print the maximum among ‘n’ randomly generate‘d’ numbers by storing them in a
list.(10)
9. If you are given three sticks. You may or may not be able to arrange them in a triangle. For
example, if one of the sticks is 12 inches long and the other two are one inch long. You will not
be able to get the short sticks to meet in the middle. For any three lengths, there is a simple test
to see if it is possible to form a triangle: if any of the three lengths is greater than the sum of the
other two, then you cannot form a triangle. Otherwise, you can.
(i) Write a function named is – triangle that takes three integers as arguments, and that
prints either “Yes” or “No”: Depending on whether you can or cannot from a triangle
from sticks with the given lengths.(4)
(ii) Write a function that prompts the user to input three stick lengths, converts them to integers, and
uses is triangle to check whether sticks with the given lengths can forma triangle.(4)
10. Write a Python program to generate all permutations of a given string using built-in function.(4)
11. Write a python function are Anagram1() to check whether two strings are anagram of each other
or not with buit- in string function and are Anagram2() to check the anagram without using built-
in function.(10)
12. Summarize the precedence of mathematical operators in python.(8)
13. Explain the syntax and structure of user defined functions in Python with examples. Also discuss
about parameter passing in functions.(12)
14. Write a python function to swap the values of two variables.(4)
15. List the three types of conditional statement and explain them.(16)
16. Write a python code perform binary search. Trace it with an example of your choice.(8)
17. Appraise with an example nested if and elif header in python(6)
18. Explain with an example while loop, break statement and continue statement in python.(10)
19. Write a Python program to find the factorial of given number without recursion and with recursion.(8)
Unit IV – List, Tuples, Dictionaries
Part A
1. List out different built-in methods used in tuple
2. Define list comprehensions in python
3. How will you update list items? Give one example.
4. Can functions return tuples? If yes give example.
5. Relate strings and lists.
6. Give a function that can take a value and return the first key mapping to that value in a dictionary.
7. What is a list? How lists differ from tuples?
8. How to slice a list in Python?
9. What is cloning list? Give example.
10. What is difference between list and tuple in python?
Part B
Part A
1. Explain the commands used to read and write into a file with example (8)
2. Discuss about the use of format operator in file processing (8)
3. Describe how exceptions are handled in python with necessary examples (16)
4. Explain the commands used to read and write into a file with example (8)
5. Discuss about the use of format operator in file processing (8)
6. Describe how exceptions are handled in python with necessary examples (16)
7. What are exceptions? Explain the methods to handle them with example.(8)
8. Write a python program to count the number of words in a text file.(8)
9. How to merge multiple files in to a new using python.(6)
10. What are modules in python? How will you import them? Explain the concept by creating and
importing a module.
11. Tabulate the different modes for opening a file and explain the same.(16)
12. Appraise the use of try block and except block in python with syntax.(6)
13. Explain with an example exception with arguments in python.(10)
14. Write a program that reads a files and builds a histogram of the words in the file.(8)
15. Print all numbers present in the text file and also print the number of block spaces in that file.(8)
16. How to read or process command line arguments in python? Explain with example.