Lab Internal 1 QP
Lab Internal 1 QP
Instructions to Students
1. Program execution has to be done in any editor.
2. After execution of program the student has to prepare pdf document in which
he/she has to add - aim, description, algorithm/flow chart, program, output screen
shot and result analysis.
3. Marks distribution: writeup (5 Marks), execution(5 Marks), result Analysis(5
Marks), Viva (5 Marks)
4. Pick the question w.r.t your rollnumber
Program Number RollNumbers
1 1,13,25,37,57
-|nooo 2 2,14,26,38,58
3 3,15,27,39,59
4 4,16,28,40,60
5,17,29,4 1,61
6 6,18,30,42,62
7 7,19,31,43,63
8 8,20,32,50,64
9 9,21,33,51,65
10 10,22,34,52,45
11,23,35,53,47
2 12,24,36,54,49
13 44,46,48,55,56
5
a. Given the following constrains and calculate net salary of an employee. CO1
L5
Basic salary : Rs. 12000
DA :129% of Basic salary
HRA :Rs1 50
TA :Rsl20
Others: Rs450
Tax cuts - a) PF :14% of Basic salary and b) IT: 15% of Basic salary
Net Salary = Basic Salary + DA +HRA +TA +Others - (PF +IT)
b. Display Payslip with all details
2 a. XYZ University offering degree courses to students has decidedto provide scholarship CO1
based on the following details: L5
Branch of Study Score (%) Scholarship(%)
Sciences >=90 50
Sciences Is an even number 5
Arts S=85 50
Arts Is an odd number 5
Note: Student is eligible for only one scholarship even if both the score conditions are
valid for the given branch of study. In such cases, pick the highest scholarship
applicable among the two.
Write a python script to accept the branch of study, score and course fee as inputs for
each student and calculate the final fees to be paid by each student based on formulae
given below:
Scholarship amount-course fee * (scholarship%)
Final fee= course fee - scholarship amount
b. Display Fee bill of a student with all necessary details
3
Write a Python script which accepts a number and find the place value of the given digit in the CO1
given number. If any digit is given which does not exist in the given number then print wrong L5
input.
Expected Output
Sample Input Hundreds Place
Given number: 34520
Given digit: 5
Given number: 34520 Wrong Input
Given digit: 8
Given number: 34525 Hundreds Place and Unit Place
Given digit: 5
Youhave X no. of5 rupee coins and Y no. of Irupee coins. You want to purchase an item for CO1
4
amount Z. The shopkeeper wants you to provide exact change. You want to pay using LS
minimum number of coins. How many 5 rupee coins and I rupee coins will you use? If exact
change is not possible then display -1.
Sample Input Expected Output
Available Available Amount to be Rs.1 Coins Rs.5 Coins
Rs.1 Coins Rs.5 Coins made needed needed
1 2 11 1 2
3 3 19 -1
Irite a Python script, which accepts a number and returns the nearest palindrome greater than CO4
he given number. L5
Write a Python script that accepts a positive integer n less than 50 from the terminal and prints COl
out the sum 1 +24+44 +7 +114+ +m, where m is less than or equal to n. If the input is L5
outside the range, the program terminates with appropriate message.
Test data and expected output:
Enter a +ve integer less than 50: 0
Invalid input
Enter a +tve integer less than 50: 39
Sum of the series is 2898549
or a CO1
7 Write a python program that accepts integers from the keyboard until we enter a zero
negative number. The program will output the number of positive values entered, the L4
minimum value, the maximum value and the average of all numbers.
Test data and expected output:
Enter a tve integer: 6
Enter next +ve integer: 3
Enter next +ve integer: 2
Enter next +ve integer:-4
Number of +ve values entered is 3
Maximum value entered is6
Minimum value entered is 2
Average value is 3.6667
Enter a tve integer: 0
No positive number entered
between 1and 100. The output C1-L4
8 Write a Python program that prints out the prime numbers numbers.
should be such that each row contains a maximum of 7 prime
Expected output:
The prime numbers between l and 99 are:
2 3 7 11 13 17
23 29 31 37 41 43
19
47 53 59 61 67 71 73
79 83 89 97
Write a Python program without using if-else construct that does the following. It accepts a C1-LA
sequence of positive integers between 1and 9both inclusive from the key-board. The program
willstop accepting input once an integer outside the range is entered. The program will finish
by printing the total number multiples of 3 and total number of even integers entered.
Test data and expected output:
Enter integers betweenl&9 both inclusive, outside range to stop
Enter integer : 0
Total no of even integer entered is 0
Total no of multiples of 3 entered is 0
Enter integers between 1&9 both inclusive, outside range to stop
Enter integer :2
Enter integer :4
Enter integer :6
Enter integer :9
Enter integer :3
Enter integer :1
Enter integer :2
Enter integer :0
Total no of even integer entered is 4
Total no of multiples of 3 entered is 3
users). C1-L4
11 Write a Python program to check the validity of a password (input from
Validation :
At least 1 letter between •a-z] and 1 letter between [A-Z].
At least 1 number between [0-91.
At least 1 character from [S#@].
Minimum length 4 characters.
Maximum length 12 characters.
the expenses of the fuel C1-L4
12 a. You and Your three friends have decided to go for a trip by sharing need to put in for
of them
equally. Write a Python script to calculate the amount (in Rs) each
the complete (both to and fro) journey.
that amount in words.
b. After calculating the amount to be paid by each person display
and ending meter reading. The C1-L4
13 a. Write a program to calculate energy bill. Read the starting
charges are as follows :
No. of units
consumed
200-500 Rates in Rs.
100-200 3.50
0-100 2.50
b. Display 1.50
Electricity bill with Name
,Address and bill details
A)Abinary number is a
System,which uses onlynumber expressed in the
two symbols and 1. Thebase-2
system for denoting integer and 0 numeral system or binary
decimal is the numeral
C1-5
binary number to decimal. non-integer numeral system
numbers. Write a Python program to standard
B) Write a
Example: (11011011) =(219) 10 convert
program to calculate factorial of a given
number
15 A) Write a python script to
find largest digit in agiven
B) Write a Python script to
number. Example n=136294 Output=9
print Fibonacci series.
16 A) Suppose we have a number n.
We
digit of a single digit number is the digithave
to find the super digit of this
number.
itself but for multi-digit numbers super digitThe super
of all digits repeatedly until the sum is asingle is the sum
then the output will be 7 because (5+1+3+6+8+2) digit number. So, if the input is like n = 513682,
=25, (2 + 5) =7.
18 A) Write a program that reads integers until the user wants to stop. When the user stops
entering humbers, display the largest of all the numbers entered
B)Write a program to find primefactors of a number. For example, if the input number is 12,
then the output should be "2 2 3". And if the input number is 315,then the output should be "3
35 7".
17 A) A positive integer greater than 1 which has no other factors except 1 and the number itself
is calleda prime number. 2, 3, 5, 7 etc. are prime numbers as they do not have any other
factors. But 6 is not prime (it is composite) since, 2 x 3 = 6.Write a python script to check a
given number is prime or not
B) Write a program to find power for a given mantissa and exponent.
18 A) Write aprogram that reads integers until the user wants to stop. When the user stops
entering humbers, display the largest of allthe numbers entered
B)Write a program to find primefactors of a number. For example, if the input number is 12,.
then the output should be "2 23". And if the input number is 315, then the output should be 3
357".
20 1. a) lf a positive integer is equal to the sum of each digit powered with the total number
of digits, then that number is called Armstrong Number. Write a Program to find
number is Armstrong number or not
b) For a number to be a Palindrome, the number must be the same when reversed. If
the number doesn't match the reverse of itself,the number is not a Palindrome. Write
a Program to check the number is palindrome or not.