Advanced Programming Questions
1. Search and Count in a Multi-Dimensional Array:
Given a 2D array named `SearchBox` with 1000 rows and 50 columns, count how many
times the word `"Empty"` appears in odd-indexed rows and even-indexed columns.
2. Replace and Count in a 2D Array:
You have a 2D array `SearchBox` with 700 rows and 40 columns. Replace the word
`"Empty"` with `"Full"` but only for entries in rows divisible by 5. Print the total number of
replacements made.
3. Single-Dimensional Array Count:
Given an array `Items` of size 1000, count the occurrences of the words `"Empty"`, `"Full"`,
and `"Pending"`. Print the counts for each word separately.
4. Create and Initialize a Multi-Dimensional Array:
Create a 2D array `Matrix` with 300 rows and 60 columns. Initialize all cells as
`"Unassigned"`. Then, set all cells in rows divisible by 10 and columns divisible by 3 to
`"Assigned"`.
5. Dynamic Average Calculation:
Write a program that takes numbers as input until the user types `-1`. Calculate the
average, but exclude any numbers greater than 100. Display the final average and the
count of valid numbers.
6. Find Maximum in a List:
Take 10 numbers as input and find both the largest and second-largest numbers. Print
both results.
7. Password Validation with Multiple Rules:
Write a program to validate passwords. The password must:
- Start with a capital letter.
- Be at least 8 characters long.
- Contain at least one number.
If any condition fails, ask the user to re-enter the password until it is valid.
8. Conditional Search and Replace:
You have a 2D array `Grid` with 200 rows and 30 columns. Replace the value `"Error"` with
`"Fixed"` only if the word appears in columns indexed from 10 to 20. Count the
replacements and print the total.
9. Cumulative Product:
Take numbers as input until the user types `0`. Calculate the cumulative product of all non-
zero numbers entered. Print the result.
10. Two-Dimensional Array Manipulation:
You have a 2D array `Scores` with 500 rows and 20 columns. For every row:
- Find the highest value.
- Replace it with the string `"Max"`.
Print the updated array and the row-wise indices of the replaced values.