Professional Documents
Culture Documents
CP QB PT-3 Harish Kumar
CP QB PT-3 Harish Kumar
CP QB PT-3 Harish Kumar
Branch & Sem. : Common to all Branches except CSBS / I Date of Exam :
Subject Code : 19UCS108 Total Marks : 50
Subject Name : Problem Solving and Python Programming Duration : 1.30 Hrs
Prepared By Approved By : HOD-CSE
Part A
a)[5,2,3,4][5,2,3,4][1,2,3,4][1,2,3,4]
b)[[5],2,3,4][[5],2,3,4][[5],2,3,4][1,2,3,4]
c)[5,2,3,4][5,2,3,4][5,2,3,4][1,2,3,4]
12. Analyze the output for following string slice str1="HELLO" ,then print(str1[:3])
a. prin a. H b. HEL c. HELL d. HE
13. Analyze the output for following string membership str1="HELLO" ,then m in str1
a. False b. True c. Undefined d. conditional values
14. What will be the output of the following program?
Vowels=”AEIOU”
for i in Vowels:
print (i)
16. T1 = (1)
T1 += 5
print(T1)
PART B
1. A game has to be made from marbles of five colors; yellow, blue, green, red and Violet where
five marbles has to be kept one upon another. Write a python program using recursion, to find
how many ways these marbles can be arranged.
2. Four People A, B, C, D are sitting in a Circular arrangement. Write a python program using
recursion, to find how many ways their seating can be arranged.
3. Develop a solution to identify the right angle triangle while giving the sides of a triangle.
(Recall from the Pythagoras theorem that in a right triangle, the square of one side equals the
sum of the squares of other two sides)
5. Demonstrate with code the various operations that can be performed on list methods ?
6. Define Dictionary? How it created and accesses the different methods in Dictionary with example?
7. In a class of 50 numbers of students, 6 students are selected for state cricket academy.
Sports faculty of this school has to report to the state cricket academy about the selected
students’ physical fitness. Here is one of the physical measures of the selected students’;
Height in cm is given for those 6 selected students [153,162,148,167,175,151]. By
implementing functions, do the following operations.
(i) State academy selector has to check whether the given height is present in
the selected students list or not.
(ii) State academy selector has to order the height of students in an incremental
manner.
(iii) State academy selector has to identify the maximum height from the list.
8. Tower of Hanoi is a mathematical puzzle where we have three rods and n disks. The
objective of the puzzle is to move the entire stack to another rod, obeying the following
simple rules:
Here is a high-level outline of how to move a tower from the starting pole, to the goal
pole, using an intermediate pole:
1. Move a tower of height-1 to an intermediate pole, using the final pole.
2. Move the remaining disk to the final pole.
3. Move the tower of height-1 from the intermediate pole to the final pole using original
pole.
9. Demonstrate with code the various operations that can be performed on list methods?
10. Write a Python recursive function which computes the nth Fibonacci number. Fibonacci
numbers are defined as fib(0)=1,fib(1)=1,fib(n)=fib(n-1)+fib(n-2) and then find the 8th
Fibonacci number.
11. A musical album company has ‘n’ number of musical albums. The PRO of this company
wishes to do following operations based on some scenarios:
(i) Name of the album starts with ‘s’ or ‘S’.
(ii) Name of the album which contains ‘jay’ as substring.
(iii) Check whether the album name presents in the repository or not.
(iv) Count number of vowels and consonants in the given album name.