22CS104 3
22CS104 3
SECTION – A
Answer all Four questions 4×10M=40M
1. Design a menu driven application to perform the following for a given number and measure
the execution time taken for each bit.
a. Develop a function to find Fibonacci Series up to n
b. Develop a function to find the given number is Strong or not
c. Create function to get the Prime factors of a number
d. Create function to find Nth Armstrong number
3. Create a table that stores the details of student name, marks obtained in various courses (DS,
PS, PP, DBMS). Design and implement the following
a. Develop a function to find the details of students who secured the first rank.
b. Create a function to get the details of students who failed in all the subjects.
c. Develop separate functions to find the details of students who got highest score in a
given course.
d. Develop separate functions to find the details of students who got lowest score in a
given course.
e. Develop a function to find the average score and standard deviation in a given course.
4. a) A tuple of numbers is given. This tuple contains duplicates. Create a new tuple from the
original that contains no duplicates. Print both the tuples.
b) A sentence called line has the value “the quick brown fox jumps over the lazy dog”.
Develop a program to create a new sentence that transposes all its letters by 1, but take only
letters from ‘a’ to ‘x’. Perform this operation using list comprehension. (Note: The transpose
of letter ‘a’ is ‘b’ and ‘g’ is ‘h’)
c) Given a string “s” consisting of words and spaces, develop a function that returns the
length of the last word in the string. A word is a maximal substring consisting of non-space
characters only. For example, int the string s = "fly me to the moon “, the length of the last
substring is .
1 of 2
Regulation: R22 Code No: 22CS104/3
d) Develop a program for the given an integer number, repeatedly add all its digits until the
result has only one digit, and return it.
For example, if the Input: num = 38 then the Output: 2
Explanation: The process is
38 --> 3 + 8 --> 11
11 --> 1 + 1 --> 2
Since 2 has only one digit, return it.
e) Given an integer array ‘nums’ and an integer ‘k’, develop a function that returns the k
most frequent elements. You may return the answer in any order. For example, if nums =
[1,1,1,2,2,3], k = 2, then the output is [1,2]
SECTION - B
Answer all Two questions 2×20M=40M
2 of 2