0% found this document useful (0 votes)
13 views9 pages

Final Exam Questions and Valuation Sheet

Uploaded by

sakthilapm1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views9 pages

Final Exam Questions and Valuation Sheet

Uploaded by

sakthilapm1999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

1.

ATM money distribution- Problem Statement

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.

2. Sequential Removal-Problem Statement


Given a strings, write a program to remove the characters from the string which has the same index as
the below sequence.
Sequence->2,4,8,16,…….N
Consider the s value is “Infosys global”, you need to remove the characters from the index position 2,4
and 8
In fo s y s gl
o b a l
01 23 4 5 6 7 89 11 12
10 13

Constraints:
S is not null and contains minimum 2 characters.

Input Format:
First line of the input contains s

Output Format:
Generated string

3. String validation II-Problem Statement

Given a word W, write a Python program to perform the following.


1. If the length of the word is greater than or equal to 3then check the following
If the 2nd char is an Alphabet and a vowel display “vowel”
If the 2nd char is an Alphabet and not a vowel display “consonant”
If the 2nd char is a digit display “digit”
If any other char display “other”
2. ifthelengthofthewordislessthan3,display“invalid”

Constraints:
W is not null

Input Format:
First line of the input contains W

Output Format:
Generated out put in a single line.

4. Number Operations-Problem Statement


Given a numbers X, write a Python program to perform the following.
1. If the number is a single digit number, then display the square of the number.
2. Ifthenumberishavingmorethan1digit, then perform the following. If
the 2nd digit is divisible by both 2 and 4 display “24”
Elseifthenumberisevennumberdisplay“2” Else
if the number is odd number display “1”

Constraints:
1 <= X<=9999

Input Format:
First line of the input contains X

Output Format:
Generated output in a single line.

5. Duplicate Number-Problem Statement

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

6. Intersection of two arrays-Problem Statement


Given two arrays A and B, write a function to compute their intersection.
Constraints:
Each element in the result must be unique.
Input Format:
First line contains the elements of the array A and B separated by a # and its elements by comma
Output Format:
Int[]

7.First unique character-Problem Statement

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

8. Reverse vowels-Problem Statement

Writeafunctionthattakesastringasinputandreverseonlythevowelsofastring. Constraints:
 The vowels do not include the letter "y".
Input Format:
First line contains the word.
Output Format:
String

9. Twin Prime- Problem Statement

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

11. Discounted price-Problem Statement

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

12. Name pass word generation-Problem Statement

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

13. Student attendance record-Problem Statement


You are given a string representing an attendance record for a student. There cord only contains the
following three characters:
1. 'A': Absent.
2. 'L': Late.
3. 'P': Present.
A student could be rewarded if his attendance record doesn't contain more than one 'A'(absent)or more
than two continuous 'L' (late).
You need to return whether the student could be rewarded according to his attendance record.

Input Format:
First line contains the attendance string.

Output Format:
boolean

14. Permutations-Problem Statement

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]

15. Set matrix zeroes-Problem Statement

Given an m x n matrix. If an element is0,set its entire row and column to 0.


Constraints:
 m== matrix.length
 n == matrix[0].length
 1<=m, n<= 200
 -231<=matrix[i][j]<=231–1
Input Format:
First line contains grid column elements separated by comma and grid row elements separated by#
Output Format:
[Integer Array]

16. Minimum swap-Problem Statement

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.

18. String decoding-Problem Statement

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

19. Matrix Multiplication-Problem Statement

Given2matricesM1,M2 of size NxN, write a program to find the product.


Constraints:
1 <= N <=106
1<=M1i,j <=106
1<=M2i,j <=106
0<=i<=(N-1)
0<=j<=(N-1)
Input Format:
First line contains n, elements of first matrix and second matrix separated by‘@’.Matrix rows are
separated by # where the elements are separated by comma.
Output Format:
[ProductMatrix]

20. Coin Change-Problem Statement

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

AllMarksneedtobeupdatedbythefacultydirectlyintheUniversityPortal oncetheuniversityopenthe portal for


mark entry.

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)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy