Lab 6 Array Questions PDF

Summary

This document contains programming questions related to arrays and 2D arrays. It covers topics such as calculating sums, finding largest/smallest elements, reversing arrays, and performing operations on matrices. Suitable for an undergraduate-level programming course.

Full Transcript

Questions for Lab 6 Array 1. Write a program to read n integers into an array and print them. 2. Create a program to calculate the sum of all elements in an array. 3. Write a program to find the largest and smallest elements in an array. 4. Implement a progra...

Questions for Lab 6 Array 1. Write a program to read n integers into an array and print them. 2. Create a program to calculate the sum of all elements in an array. 3. Write a program to find the largest and smallest elements in an array. 4. Implement a program to reverse the order of elements in an array. 5. Write a program to find the average of n elements in an array. 6. Create a program to count the number of times a specific element appears in an array. 7. Implement a program to search for an element and print its index if found. 8. Write a program to find the second largest element in an array. 9. Implement bubble sort or selection sort to arrange an array in ascending order. 10. Modify the sorting algorithm to arrange the array in descending order. 11. Create a program that copies the contents of one array into another. 12. Write a program to merge two arrays into a single array. 13. Create a program to remove duplicate elements from an array. 14. Write a program to insert an element at a specified position in an array. 15. Implement a program to delete an element at a specific index from an array. 16. Write a program to find and print the sum of all even and odd elements in an array separately. 17. Create a program to count the number of even and odd elements in an array. 18. Implement a program to rotate the array k positions to the left. 19. Create a program to rotate the array k positions to the right. 20. Write a program to find the frequency of each unique element in an array. 21. Write a program to read a m x n 2D array and print it. 22. Create a program to find the sum of all elements in a 2D array. 23. Implement a program to find the transpose of a given 2D array. 24. Write a program to find and print the sum of each row and each column in a 2D array. 25. Create a program to find the largest element in a 2D array. 26. Implement a program to calculate the sum of the main diagonal and the secondary diagonal of a square matrix. 27. Write a program to check if a given square matrix is an identity matrix. 28. Create a program to perform the addition of two m x n matrices. 29. Write a program to perform the subtraction of two m x n matrices. 30. Implement a program to multiply two matrices and print the result.

Use Quizgecko on...
Browser
Browser