Professional Documents
Culture Documents
652660b20952flab 2submission
652660b20952flab 2submission
Lab-02 (11-10-2023)
Insertion Problems
Task 1:
Write a program to insert an element at a specific position in a 1D array.
Requirements:
Suppose you have an array of size 8 with elements: {12, 45, 78, 34, 56, 90, 23, 67}.
You are required to insert an element at index 3.
The element to be inserted is 50.
Display the updated array.
Task 2:
Write a program to insert an element at a specific position in a 2D array.
Requirements:
Suppose you have a 2D array with dimensions 3x3:
1 2 3
4 5 6
7 8 9
Deletion Problems
Task 3:
Write a program to delete an element at a specific position in a 1D array.
Requirements:
Suppose you have an array of size 7 with elements: {10, 20, 30, 40, 50, 60, 70}.
Task 4:
Write a program to delete an element at a specific position in a 2D array.
Requirements:
10 20 30 40
50 60 70 80
Traversal Problems
Task 5:
Write a program to traverse (display) the elements of a 1D array.
Requirements:
Suppose you have an array of size 6 with elements: {5, 12, 24, 36, 48, 60}.
Task 6:
Write a program to traverse (display) the elements of a 2D array.
Requirements:
Suppose you have a 2D array with dimensions 2x3:
22 45 68
12 35 58