Skip to study material

PROGRAMMING FOR PROBLEM SOLVING

Unit IV · Arrays, Searching and Sorting

AR25I Year · I Semester2025–2026

Learn arrays, searches, sorting and matrices through clear answers and worked examples.

20 topics20 two-mark questions20 five-mark questions5 diagrams and flowcharts16 C programs

40 questions

Open complete unit for printing / PDF

Array Basics

  1. 01What is an array?2 marks
  2. 02Define an array and explain its advantages and limitations.5 marks
  3. 03What values are stored by int a[5] = {2, 4};?2 marks
  4. 04Explain array declaration and initialisation with examples.5 marks
  5. 05What is the valid index range for int a[10]?2 marks
  6. 06Explain array subscripts, valid bounds and off-by-one errors.5 marks
  7. 07Why should the element count be checked before reading an array?2 marks
  8. 08Write a C program to read and display an array using loops.5 marks
  9. 09What is array traversal?2 marks
  10. 10Explain array traversal and write a program to find the sum of its elements.5 marks
  11. 11Why initialise minimum and maximum from the first element?2 marks
  12. 12Write a C program to find minimum, maximum and average in an integer array.5 marks

Arrays and Functions

  1. 13Is an int array element passed differently from an ordinary int variable?2 marks
  2. 14Explain passing individual array elements as function arguments.5 marks
  3. 15Why pass the length separately with an array parameter?2 marks
  4. 16Explain passing a one-dimensional array to a function with its length.5 marks

Searching

  1. 17What does linear search do when values are unsorted?2 marks
  2. 18Explain linear search and write a non-recursive C function to implement it.5 marks
  3. 19What prerequisite must hold for this binary-search function?2 marks
  4. 20Explain binary search and write a non-recursive C function to implement it.5 marks
  5. 21Which search is suitable for a small unsorted array without preprocessing?2 marks
  6. 22Compare linear search and binary search.5 marks

Sorting

  1. 23What does one left-to-right bubble-sort pass achieve?2 marks
  2. 24Explain bubble sort and write a C program to sort integers in ascending order.5 marks
  3. 25What is selected during each ascending selection-sort pass?2 marks
  4. 26Explain selection sort and write a C program for ascending order.5 marks
  5. 27How does insertion sort extend its sorted prefix?2 marks
  6. 28Explain insertion sort and write a C program for ascending order.5 marks
  7. 29What does a stable sorting algorithm preserve?2 marks
  8. 30Compare bubble sort, selection sort and insertion sort.5 marks

Matrices and Dimensions

  1. 31How is an element of int a[2][3] selected?2 marks
  2. 32Explain the declaration, initialisation and access of two-dimensional arrays.5 marks
  3. 33When can two matrices be added?2 marks
  4. 34Write a C program using a function to add two matrices.5 marks
  5. 35When is A × B defined, and what is the result size?2 marks
  6. 36Write a C program using a function to multiply two matrices.5 marks
  7. 37How many int elements are in int a[2][3][4]?2 marks
  8. 38Explain the declaration and access of multidimensional arrays.5 marks
  9. 39Why must the row width match in a two-dimensional array parameter?2 marks
  10. 40Explain how a two-dimensional array is passed to a function.5 marks

The 2- and 5-mark badges are practice allocations. Previous-paper questions retain their printed marks.