Final Exam Questions and Valuation Sheet
Final Exam Questions and Valuation Sheet
Given an ATM money containing K units of money. N people want to with draw money from
the machine one by one in order, write a Python program to check if each person can with draw
required amount of money or not.
Constraints:
1≤N≤100
1≤Ai≤100,000foreachvalid,whereAiistheamountrequiredbyeachperson
1≤K≤1,000,000
Input Format:
Input contains comma separated integers where first input is the amount of money in machine restare
the amount of money required by each person.
Output Format:
Print a single line containing a string with length N. For each valid i,the i-th character of this string
should be '1' if the i-th person will successfully withdraw their money or '0' otherwise.
Constraints:
S is not null and contains minimum 2 characters.
Input Format:
First line of the input contains s
Output Format:
Generated string
Constraints:
W is not null
Input Format:
First line of the input contains W
Output Format:
Generated out put in a single line.
Constraints:
1 <= X<=9999
Input Format:
First line of the input contains X
Output Format:
Generated output in a single line.
Given an array A containing N numbers. There is only one repeated number in A, write a program to
print the duplicate number, If no duplicates print –1.
Constraints:
1 <= N <=106
1 <= Ai<= 106
0<=i<=(N-1)
Note: All the integers in A appear only once except for precisely one number which appears two or
more times.
Input Format:
First line contains elements of array A separated by comma‘,’.
Output Format:
Duplicatenumberifpresent,otherwise-1
Given a string S, find the first non-repeating character init and return its index.If it doesn't exist,
return -1.
Constraints:
You may assume the string contains only lowercase English letters.
Input Format:
First line contains the input string S.
Output Format:
Integer
Writeafunctionthattakesastringasinputandreverseonlythevowelsofastring. Constraints:
The vowels do not include the letter "y".
Input Format:
First line contains the word.
Output Format:
String
Given an array A[]of N natural numbers. The task is to count all possible pairs in the arr[]that areTwin
Primes.
A Twin prime are those numbers that are prime and having a difference of two(2)between the two prime
numbers. In other words, a twin prime is a prime that has a prime gap of two.
Constraints:
1<Length(A)<100
Input Format:
Input consists of commas separated integers.
Output Format:
Integer.
10. Electricity bill-Problem Statement
Given the number of metered units U, write a Python program to calculate the electricity bill amount, B.
1 to 25 units - $ 1.25 per unit
26to50units-$1.45perunit
51to75units-$1.65perunit
76 to 95 units - $ 1.95 per unit
Above95units-$2.00perunit
Constraints:
0< U<106
Input Format:
First line contains the number of metered d units, U
Output Format:
$ Bill
Given 2 numbers, number of Items N and price per item P. Write a Python program to calculate the
total amount based on the below rule.
If the customer purchases more than 50items,then few items are not billed based on the following
table.
Number of Item Range Discounted Items
0-49 0
50-100 10
101-200 20
>=201 30
Calculate the discount based on the total amount range and display the final amount payable by the
customer.
Discount
Amount Range
%
1-1000 10
1001-10000 15
Given a name N. Write a Python program to accept name of a person and generate a password based on
the below instructions.
1. If the length of the name is an even number
password=lc+le+”@”+fc+”654”+lc
2. If the length of the name is an odd number
password=lc+le+”!”+fc+”432”+lc
Note:
lc->last character in the name
le-> length of the name
fc->first character in the name
Constraints:
The N should contain minimum 3 characters.
Input Format:
First line of the input contains N
Output Format:
password
Input Format:
First line contains the attendance string.
Output Format:
boolean
Given an array A of N numbers, write a program to generate all possible permutations of the given array.
Constraints:
1 <= N<=6
-10<=Ai<=10
1 <= i<= 6
Input Format:
First line contains the elements of the array A separated by comma Output
Format:
All possible permutations of A separated by comma Sample Input
and Output:
Input:
1,2,3
Output: [1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,2,1],[3,1,2]
Given a jumbled set of numbers, write a Python program to calculate minimum number of swaps
required to bring them to this order if it was in ascending order based on below condition.
One number can be swapped with at most 2other numbers.
Constraints:
1<=t<=105,wheretisthenumberofpeopleinqueue
Input Format:
Firstlinecontainsasetofcommasseparatedintegersdescribingthefinalstateofthe queue.
Output:
Print the number of swapsrequiredifanumberhasnottobeswappedwithmorethan2times.Elseprint “Messed
up queue”.
17. Tongue twister-Problem Statement
Given a paragraph containing anchor letter. Write a Python program to determine whether a paragraph
is a tongue twister or not based on following criteria:
1. There must be minimum 7 words starting with the mentioned anchor letter.
2. There should not be more than 20 words starting with the mentioned anchor letter.
3. Two consecutive anchor words must not be same
If an entry meets all the above-mentioned criteria print “Good Tongue Twister” else print
“Inappropriate Entry”.
Constraints:
7<L<=100,whereListhelengthoftheparagraphinwords.
Input Format:
Input line contains the input paragraph and the Anchor letter separated by ‘#’.
Output Format:
Validate the input and print “Good Tongue Twister ”or“ Inappropriate Entry” according to the
conditions given above.
Given an encoded string E of length L, write a program to decode it. The encoded string E, is
generated by repeatedly moving the middle character of the original string to E. If original string has 2
middle characters, consider the first one.
Constraints:
1<L<102,whereListhelengthoftheinputString Input
Format:
First line contains the encoded string
Output Format:
Decoded string
Given the number of available$5coins,X,the number of a vailable$1coins,Y and the amount Z,write a
Python program to print the minimum number of $5 and $1 coins needed to provide exact
change. Print “NP” if exact change cannot be made.
Constraints:
-1< X<= 100
-1< Y<= 100
-1< Z<= 600
Input Format:
First line contains X,Y,Z
Output Format:
numberof$1coinsandnumberof$5coinsseparatedby‘and’
SOFTWAREREQUIREMENT
LatestversionofPython–appropriateIDE(3.x) Python
script, Node JS
HARDWAREREQUIREMENT
•
i5ori7processororR5fromAMD
16GBofRAM.500GBstoragesystem
TotalMarksSplitUp
Kindlyfollowthebelowinstructionsandpreparethemarksreadyforuploadinginuniversity portal.
InternalMark–25marks–Needtobeprovidedfromthe subjecthandlingfaculty
ExternalMark–75marks
45 marks – Upon the Completion of course in Infosys Springboard (Course Name – Object
OrientationusingPython) –uponcompletingthecourse byattendingtheassessmentthemarkwillbe provided
from Training partner end.
30Marks–willbeaccessedbytheMasterAccessorsas below
FinalExam AsperscoresinthebelowevaluationtemplatetheExternal 30
completion faculty members in institutions will evaluate and fill
OnlineMart
OnlineMart
Order class - class: OnlineMart
Student Structure class:
generate_ find_price_per_ class: Total
emailid correctness check_item_ Remarks
tracking_id()- item(item ship_order(): (30)
(10 marks) availability():-
(4 marks) name): (4 marks)
(5.5 marks)
(6.5marks)