TEST - 1
(Easy) Programming Course Practice Test – 001
Currency Conversion
Anita works in Hentrum, a FOREX shop which converts US dollars to Indian Rupee. Anita
wants to write a program that will convert the amount to be paid in Indian Rupee given the
USD count C and the exchange rate R to BUY.
Please help her by completing the program.
Input Format:
First line contains total number of test cases, denoted by T
Next T lines will contain C and R for a test case separated by one or more space(s).
Output Format:
T lines containing the Indian Rupee amount to be paid rounded and padded up to 2 decimal
places.
Boundary Conditions / Constraints:
1 <= T <= 25
1 <= C <= 100000
0.01 <= R <= 100.00
Example Input/Output 1:
Input:
4
10 62
562 66.54
100 67.105
1 69.148
Output:
620.00
37395.48
6710.50
69.15
Reverse Middle Value
A string S will be passed as input to the program. The program must reverse the characters
in between the first and last letters and print the new value R.
Input Format:
First line contains total number of test cases, denoted by T
Next T lines will contain value of S for that test case.
Output Format:
T lines containing the reversed number as per the condition mentioned.
Boundary Conditions / Constraints:
1 <= T <= 25
3 <= Length of S <= 1000
Example Input/Output 1:
Input:
3
902871
sunrise56morning
kick_torrent_pira()cy
Output:
978201
sninrom65esirnug
kc)(arip_tnerrot_kciy
Sum of Even & Odd Numbers
N numbers will be passed as input to the program. The program must print the sum of even
numbers followed by the sum of odd numbers.
Input Format:
First line contains total number of test cases, denoted by T
Next 2*T lines, contain the test case values for T test cases. Each test case will have
- N in the first line indicating the count of numbers
- N integer values separated by one or more space(s)
Output Format:
2T lines containing the output values for T test cases. Each test case output will have
- Sum of even numbers in the first line
- Sum of odd numbers in the second line
Boundary Conditions / Constraints:
1 <= T <= 25
1 <= N <= 100
0 <= Value of N Numbers <= 9999999
Example Input/Output 1:
Input:
3
4
2 5 4 11
5
2 4 6 8 10
4
101 22 66 17
Output:
6
16
30
0
88
118
TEST - 2
(Easy) Programming Test - L39
First M multiples of N
The number N is passed as input. The program must print the first M multiples of the
number
Input Format:
The first line denotes the value of N.
The second line denotes the value of M.
Output Format:
The first line contains the M multiples of N separated by a space.
Boundary Conditions:
1 <= N <= 999999
Example Input/Output 1:
Input:
5
7
Output:
5 10 15 20 25 30 35
Example Input/Output 2:
Input:
50
11
Output:
50 100 150 200 250 300 350 400 450 500 550
Difference between a number and it's reverse
The number N is passed as input. The program must print the difference between the
number N and it's reverse R.
Input Format:
The first line denotes the value of N.
Output Format:
The first line contains the value of N-R
Boundary Conditions:
10 <= N <= 9999999
Example Input/Output 1:
Input:
42
Output:
18
Explanation:
The output is 42-24 = 18
Example Input/Output 2:
Input:
555
Output:
0
Explanation:
The output is 555-555 = 0
Example Input/Output 3:
Input:
125
Output:
-396
Explanation:
The output is 125-521 = -396
Area of a square
The perimeter P of a square is passed as the input. The program must print the area of the
square.
Input Format:
The first line denotes the value of P.
Output Format:
The first line contains the area of the square.
Boundary Conditions:
4 <= P <= 9999999
Example Input/Output 1:
Input:
36
Output:
81
Example Input/Output 2:
Input:
124
Output:
961