TSEP Assignments
TSEP Assignments
Python assignment
1. How to import pandas and check the version?
2. How to create a series from a list, numpy array and dict?
3. How to convert the index of a series into a column of a dataframe?
4. How to combine many series to form a dataframe?
5. How to assign name to the series’ index
6. How to get the items of series A not present in series B?
7. How to get the items not common to both series A and series B?
8. How to get the minimum, 25th percentile, median, 75th, and max of a numeric series?
10. How to bin a numeric series to 10 groups of equal size?
11. How to convert a numpy array to a dataframe of given shape? (L1)
12. How to convert year-month string to dates corresponding to the 4th day of the month?
13. How to filter words that contain atleast 2 vowels from a series?
DBMS assignment
Data structures assignment
Question 1 Show how to implement a queue using 2 stacks (no Java code is needed, just a sketch and
pseudo code) What are the complexities of enqueue() and dequeue() operations ?
Note: A stack is a data structure with push(), pop(), and isEmpty() operations; a queue is a data
structure with enqueue(), dequeue() and isEmpty() operations.
Question 2 Implement a simple Reverse Polish Notation (RPN) calculator. Reverse Polish Notation
(RPN) is a way of representing arithmetic expression, which does not require parentheses
Question 3 Implement the method get(int n), which should return the element of index n (indexing
starts with 0). If the index is out of bounds, the exception IllegalArgumentException should be thrown
. What is the complexity of this method?
Question 4 Implement the method insertAt(Item x, int n), which should insert an element at index n
into the list. If the index is out of bounds, the exception IllegalArgumentException should be thrown
What is the complexity of this method?
Question 5 Implement the method nthBFS(int), which returns the nth element in Breadth First Search
(BFS) order (“Breadth First Search” is also known as “Level Order Search”)
C assignment
Q 1. A number is called an Armstrong number if the sum of the cubes of the digits of the
number is
equal to the number. For example 153 = 1^3 + 5^3 + 3^3. Write a C program that asks the
user to
enter a number and returns if it is Armstrong or not (use function).
Q2. Write a program in C that takes as input a set of numbers and calculates the mean,
variance and standard deviation (variance is defined as (xi - x) n - 1 , where xi i th
num er in the set x is the mean and n=cardinality of the set ; standard deviation is the square
root of variance).
Q 3. Write a C program that calculates the HCF and LCM of two numbers.
Q 4. Write a C program to display and find the sum of the series 1+11+111+....111 upto n.
For eg. If n=4, the series is : 1+11+111+1111. Take the value of 'n' as input from the user.
Q 5. Write a C program that reads a positive integer n and then prints the following pattern
*********
_********
__*******
___******
____*****
_____****
______***
_______**
________*
where n is the number of lines.
Q 6. Amicable numbers are found in pairs. A given pair of numbers is Amicable if the sum of
the proper divisors (not including itself) of one number is equal to the other number and vice
– versa.
For example 220 & 284 are amicable numbers
First we find the proper divisors of 220:
220:1, 2, 4, 5, 10, 11, 20, 22, 44, 55, 110
1+ 2 + 4 + 5 + 10 + 11 + 20 + 22 + 44 + 55 + 110 = 284
Now, 284: 1, 2, 4, 71, 142
1 + 2 + 4 + 71 + 142 = 220
Write a C program to check that the input pair of numbers is amicable.
Q 7. Write a C function for the following problem:
Given a positive integer n, print the binary representation of n.
Q 8. A triangular number is one which can be represented by that number of pebbles in a
symmetric triangle. The first five triangular numbers are 1, 3, 6, 10 and 15.
Write a C function int isTriangular(int n) to test if a num er „n‟ is triangular or not
It should return 1 if it is triangular and 0 if not.
T1=1 T2=3 T3=6 T4=10 T5=15
Q 9. Write a C program to find the reverse of an integer number.
Q 10. Write a C program to sort an array of integers using bubble sort.
Q 11. Write a C program to input n numbers in an array, calculate the sum of all even
numbers and all odd numbers in the array and print the larger sum.
Example:
If the array contains the following elements:
2, 3, 3, 5, 4, 8, 7, 11, 2
The sum of all even elements is 2+4+8+2=16
Sum of all odd elements is 3+3+5+7+11=29
Therefore, the output should be 29.
Q 12. Take the price and quantity of items as an input. Write a C function to calculate the
sum of the prices. Write another C function to calculate the discount according to the
following rules:
For total less than Rs.1000, discount is 5%.
For total greater than Rs.1000 but less than Rs.5000, discount is 10%.
For total greater than Rs.5000, discount is 15%.
Write another function to print the individual item prices, total, discount and the final price.
Example:
If the prices are as follows:
Item 1: 200
Item 2: 400
Item 3: 200
Item 4: 10
Item 5: 50
And the quantities are:
Item 1: 1
Item 2: 1
Item 3: 3
Item 4: 5
Item 5: 2
Then you should print:
Item Price Quantity Subtotal
Item 1 200 1 200
Item 2 400 1 400
Item 3 200 3 600
Item 4 10 5 50
Item 5 50 2 100
-------------------------------------------------
TOTAL 1350
Discount 10% -135
-------------------------------------------------
GRAND TOTAL 1215