My Selfpractice ARRAY
My Selfpractice ARRAY
Practice No. : 3a
Date : 14.02.2025
Q.
Question Detail Level
No.
1 You're working on a program that tracks student grades, and Easy
you need to find out how many times a specific grade, say 90,
appears in an array of test scores (frequency).
Sample Input:
arr[] = {85, 90, 78, 90, 92, 90, 87, 88, 90}
Sample Output:
The grade 90 appears 4 times in the array
OUTPUT:
Enter the no of elements:
9
Enter elements:
85 90 78 90 92 90 87 88 90
The grade 90 appears 4 times in the array
OUTPUT:
Enter the no of elements:
8
Enter elements:
5 8 2 5 9 2 3 8
5 8 2 9 3
4 Take 20 integer inputs from user and print the following: Easy
a) number of positive numbers
b) number of negative numbers
c) number of odd numbers
d) number of even numbers
e) number of 0s.
OUTPUT:
Enter the no of elements:
20
1 -3 6 9 8 -13 -5 7 0 12 -4 4 0 17 21 6 16 11 19
0
13 4 10 10 3
5 Get the values for an array of size 10. Write the logic to find whether the Easy
array elements are in Arithmetic Progression or Geometric Progression. If
the array is in neither order display ‘Random order’.
Sample Input: 1 4 7 10 13 16 19 22 25 28 Sample
Output: Arithmetic Progression Sample Input: 1 2 4 8 16
32 64 128 256 512
Sample Output: Geometric Progression Sample Input: 2
4 7 11 16 22 29 37 46 56 Sample Output: Random
Order
OUTPUT:
Enter the no of elements:
9
1 4 7 10 13 16 19 22 25
Arithmetic Progression
6 In a lucky draw, XYZ finance company selects two sets of its customers Easy
for a promotion. If the customer’s coupon is in first set, then the customer
gets Rs.10000/- as cash prize. If it is in second set, then the customer
gets tour tickets for two days. Otherwise, customer gets a batch ‘Better
luck next time’. Two sets of coupon numbers and a randomly picked
customer coupon are the inputs. Help the company to say the result.
Note: Consider each set has 10 distinctive customer coupons and no
common coupons.
OUTPUT:
Enter the no of elements:
10
Enter the first set:
2 4 7 11 16 22 29 37 46 56
Enter the second set:
1 5 9 10 13 18 19 22 25 28
Enter the coupon:
16
Sometimes later becomes never. DO IT NOW!
6
SELF PRACTICE
SDE Readiness Training
Rs.10000 Cash Prize
7 XYZ College asked their students to register for NSS and NCC if they are Easy
willing. Some of the students registered for both. Identify them if
student ids(numeric) for each group is the input. Sample Input: 10, 10, [2 4
7 11 16 22 29 37 46 56], [1 4 7
10 13 16 19 22 25 28]
Sample Output: 4 7 16 22
OUTPUT:
Enter the second set:
1 4 7 10 13 16 19 22 25 28
4
7
16
22