As A First
As A First
concepts of arrays, including basic operations and manipulations. Below are some typical
questions you might encounter on an exam based on arrays in C programming:
Manipulating Arrays
5. Reversing an array.
o Example: Write a program that reverses the elements of an array.
6. Swapping elements in an array.
o Example: Write a program that swaps the elements of an array at indices 0 and 4.
7. Shifting elements of an array.
o Example: Write a program that shifts all elements of an array one position to the
left, and moves the first element to the end.
8. Finding the largest and smallest elements in an array.
o Example: Write a program that finds the maximum and minimum elements in a
given array.
9. Linear search.
o Example: Write a program to search for an element in an array using linear
search. If the element is found, print its index; otherwise, print "not found".
10. Sorting an array.
o Example: Write a program that sorts an array of integers using the bubble sort
algorithm.
11. Counting occurrences of an element in an array.
o Example: Write a program to count how many times a specific element appears in
an array.
Multi-Dimensional Arrays
1. Write a program to read n numbers from the user and store them in an array. Then,
find the maximum and minimum numbers in the array.
2. Write a program that takes two arrays of integers and merges them into a single
array, assuming the arrays are already sorted.
3. Write a program to reverse an array and print the reversed array.
4. Write a program to find the number of even and odd elements in an array.
5. Write a program to check if a given array is sorted in ascending order or not.
Concepts to Focus On
Practice writing programs: Work through examples and try to write as many programs
as you can to get comfortable with array operations.
Understand the logic: Don't just memorize code — make sure you understand how
arrays are indexed, how elements are accessed, and how loops work with arrays.
Test edge cases: Always consider edge cases like empty arrays or arrays with only one
element.
Practice with basic sorting and searching algorithms: Sorting algorithms like Bubble
Sort, Selection Sort, and simple searching algorithms like Linear Search are often
covered in exams.
Focusing on these areas will give you a strong foundation in arrays for your first-year C
programming exam!