Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Logical Test

1) Create a 3X5 matrix structure[2 dimensional array] by choosing random values from the reel Array
given below:
Reel Array
[AA, BB, AA, EE, BB, GG, LL, KK, CC, DD, FF, BB, EE, AA, KK]

Example output: Matrix(3X5)


AA BB AA KK LL
CC DD AA BB KK
BB AA EE LL BB

Program: _______________

2) Find the Number of Alphabets used and their count of being present into a string.
For eg. CCNA
Has
C: 2
N:1
A:1

Result must contain only those alphabets which are used in the string with no duplicate entry.

Program: _______________

3) Create a 5 alphabets string by randomly choosing alphabet from the 26 alphabets [a-z] given that
there is no repetitive alphabet in the resulted string.
Ex: CADBK, KBNRL etc.

4) Table below provides probability of choosing a fruit from the weight table -
Fruit Name Probability(P)
MANGO 0.25
BANANA 0.50
APPLE 0.15
ORANGE 0.10
Total (P) 1

Write a program of randomly choosing 10 fruits from a bucket using the above table.
Output eg.
Array [ORANGE, APPLE,BANANA, …………..] array containing 10 fruits chosen.

5) Write a program to print only even numbers extracted from the given string :
“13-34-5-14-89-60-4-6-5-12”;

You might also like