Coding Question 1 Test 1
Coding Question 1 Test 1
There is a JAR full of candies for sale at a mall counter. JAR has the
capacity N,
that is JAR can contain maximum N candies when JAR is full. At any point
of time.
JAR can have M number of Candies where M<=N. Candies are served to
the
customers. JAR is never remain empty as when last k candies are left. JAR
if
refilled with new candies in such a way that JAR get full.
at point of time. Update the JAR after each purchase and display JAR at
Counter.
JAR.
Given,
Input Value
Output Value
Input Value
0
Output Value
INVALID INPUT
Question 2
There will be a batch of 3 trainees, appearing for running test in track for
3 rounds.
You need to record their oxygen level after every round. After trainee are
finished
with all rounds, calculate for each trainee his average oxygen level over
the 3
rounds and select one with highest oxygen level as the most fit trainee. If
more
than one trainee attains the same highest average level, they all need to
be
selected.
Display the most fit trainee (or trainees) and the highest average oxygen
level.
Note:
unfit‖
Example 1:
INPUT VALUES
95
92
95
92
90
92
90
92
90
OUTPUT VALUES
Trainee Number : 1
Trainee Number : 3
Note:
Round 1
Round 2
Round 3
Question 3
CODING:
system, the weight of clothes put inside it for wash is uncertain. But based
on
weight measured by sensors, it decides time and water levels which can
be changed
by menus given on the machine control area. For low Water level, time
estimate is
between 2001 grams and 4000 grams. For High Water level, time
estimated is 45
than 7000, then output is: "OVERLOADED!", and for all other inputs, the
output
<integer>
Example 1
Input Value
2000
Output Value
Questionn 4
Q2. Caesar Cipher The Caesar cipher is a type of substitution cipher in
which each
alphabet.
on.
the key is the number of OFFSETs to shift the cipher alphabet. Key can
have basic
For example, if given plain text contains any digit with value 5 and key =
2, then 5
will be replaced by 7. ―-‖ (Minus sign) will remain as it is. Key value less
than 0
Example 1:
Input:
Output:
plaintext and key as input parameters and returns its cipher text as
output.
Exterior walls
If a user enters zero as the number of walls then skip Surface area values
as User
Example 1:
12.3
15.2
12.3
15.2
12.3
15.2
10.10
10.10
10.00
Question 5
A City Bus is a Ring Route Bus which runs in circular fashion.That is, Bus
once
starts at the Source Bus Stop, halts at each Bus Stop in its Route and at
the end it
reaches the Source Bus Stop again.
If there are n number of Stops and if the bus starts at Bus Stop 1, then
after nth
Bus Stop, the next stop in the Route will be Bus Stop number 1 always.
If there are n stops, there will be n paths.One path connects two stops.
Distances
(in meters) for all paths in Ring Route is given in array Path[] as given
below:
(When calculating fare for others, the calculated fare containing any
fraction value
should be ceiled. For example, for distance 900n when fare initially
calculated is
from the previous one. And each index position can be mapped with
values at same
Input as source and destination stops(in the format containing first two
characters
of the Name of the Bus Stop) and calculate and return travel fare.
Example 1:
Input Values
ca
Ca
Output Values
INVALID OUTPUT
Example 2:
Input Values
NI
HA
Output Values
23.0 INR
Input should not be case sensitive and output should be in the format
<FLOAT>
INR
Solution in Python: