You are on page 1of 3

Prudence Capiital

Programming Challenge

Question 1:- Swapping 2 Numbers without using 3rd variable

Question 2:- Check if a number is Armstrong or not.

Question 3:- Check whether a given String is palindrome or not.

Question 4:-

An array of size 100 contain 100 number from 1 to 100 in random order. One number gets
replaced by an another number from 1 to 100 except that number.
1. Find the missing number.
2. Find the duplicate number.

Question 5:-
Suppose you are provided with N number of atoms. Whenever a neutron hits the atom it
disintegrate the atom into 3 more neutrons, these neutrons will again react with more atoms
which are present and again creates 3 more neutrons. The process goes on unless no atom is
left. Calculate the number of neutrons left at the end ? (Assume first neutron is always provided)
For Ex – From above diagram, 3 atoms are there and number of neutrons remaining in the end
is 7, so answer is 7.

Input –
First Input (K) – Number of time atom input should be taken
K th input – Number of atoms

Ex –

INPUT OUTPUT
3
3 7
4 9
7 15

Question 2 :-

1. Stock prices generator component


○ Write a program which has a component that will generate(random) prices for 5
stocks: Reliance, ICICI, TCS, BankOfBaroda and Cipla. Assume that all stocks
have integer prices between 1 and 100
○ Declare an array, p(integer data type), of size 5, it would contain the latest price
for each stock at following position
■ 0 Reliance
■ 1 ICICI
■ 2 TCS
■ 3 BankOfBaroda
■ 4 Cipla
○ Prices should be generated every 100 milli seconds
○ after every instance of generating prices ( and writing to the array), this
component should inform the second component by sending a message X
○ Access to array p should be protected by a lock
2. Prices Consumer component
○ The prices generated by first component will be consumed by this component
through the array p
○ After receiving message X, this component should wait T milliseconds. (T is a
random number between 80 and 120)
○ And then print prices for all stocks
○ If the first component is still having the lock for array p, then the second
component should simple print a SKIP message

If any clarification:
whats app / call: 9902 521576
email:- apremi@gmail.com, agarwa.govind@live.com

You might also like