0% found this document useful (0 votes)
4 views4 pages

Array Programming Question Paper 100 Questions

This document is a question paper consisting of 100 programming questions focused on array manipulation, categorized into beginner, easy, and intermediate levels. It includes tasks such as printing array elements, finding sums, searching, and handling duplicates, as well as more complex operations like finding missing numbers and calculating maximum profits. The instructions emphasize using loops and basic logic over built-in methods, ensuring clean and testable code.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Array Programming Question Paper 100 Questions

This document is a question paper consisting of 100 programming questions focused on array manipulation, categorized into beginner, easy, and intermediate levels. It includes tasks such as printing array elements, finding sums, searching, and handling duplicates, as well as more complex operations like finding missing numbers and calculating maximum profits. The instructions emphasize using loops and basic logic over built-in methods, ensuring clean and testable code.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ARRAY PROGRAMMING

Question Paper — 100 Questions | Beginner to Intermediate

Name: ______________________________ Date: ______________

Language: ______________________________ Time: ______________

Instructions
• Solve the questions in order from easy to intermediate.

• Prefer loops and basic logic before using built-in array methods.

• For questions that prohibit sorting or built-in methods, follow the constraint.

• Write clean, readable code and test your solution with multiple inputs.

Beginner Level
1. Write a program to print all elements of an array.

2. Write a program to print array elements in reverse order.

3. Write a program to find the sum of all elements in an array.

4. Write a program to find the average of all elements in an array.

5. Write a program to find the largest element in an array.

6. Write a program to find the smallest element in an array.

7. Write a program to count the number of elements in an array without using length.

8. Write a program to count even and odd numbers in an array.

9. Write a program to count positive, negative, and zero values.

10. Write a program to search for a given element using linear search.

11. Write a program to check whether an array is empty or not.

12. Write a program to copy all elements from one array into another.

13. Write a program to print elements at even indexes.

14. Write a program to print elements at odd indexes.

15. Write a program to find the first element of an array without directly using index 0.

16. Write a program to find the last element of an array without directly using the last index.

17. Write a program to calculate the product of all array elements.

18. Write a program to count how many elements are greater than a given number.

19. Write a program to count how many elements are smaller than a given number.

20. Write a program to print only the even elements of an array.

21. Write a program to print only the odd elements of an array.

Page 1
22. Write a program to find the difference between the largest and smallest elements.

23. Write a program to replace every negative element with zero.

24. Write a program to replace every even number with its square.

25. Write a program to create a new array containing only positive numbers.

Easy Level
26. Write a program to reverse an array without using a built-in reverse function.

27. Write a program to find the second largest element without sorting.

28. Write a program to find the second smallest element without sorting.

29. Write a program to find the third largest element.

30. Write a program to find the third smallest element.

31. Write a program to remove duplicate elements without using Set.

32. Write a program to count the frequency of every element.

33. Write a program to print only duplicate elements.

34. Write a program to print only elements that occur exactly once.

35. Write a program to find the first duplicate element.

36. Write a program to find the first non-repeating element.

37. Write a program to find the index of the first occurrence of a given value.

38. Write a program to find the index of the last occurrence of a given value.

39. Write a program to count how many times a given value occurs.

40. Write a program to merge two arrays without using a built-in concat function.

41. Write a program to compare two arrays and check whether they contain the same elements in the
same order.

42. Write a program to check whether an array is sorted in ascending order.

43. Write a program to check whether an array is sorted in descending order.

44. Write a program to find the sum of elements at even indexes.

45. Write a program to find the sum of elements at odd indexes.

46. Write a program to swap the first and last elements.

47. Write a program to move all zeros to the end of the array.

48. Write a program to move all negative numbers to the beginning.

49. Write a program to separate even and odd numbers into two arrays.

50. Write a program to find all pairs of elements whose sum equals a target value.

Intermediate Level
51. Write a program to find the missing number from an array containing numbers from 1 to N.

Page 2
52. Write a program to find all missing numbers from a range 1 to N.

53. Write a program to find common elements between two arrays without using built-in intersection
methods.

54. Write a program to find elements present in the first array but not the second.

55. Write a program to find the union of two arrays without duplicates.

56. Write a program to rotate an array to the right by one position.

57. Write a program to rotate an array to the left by one position.

58. Write a program to rotate an array to the right by K positions.

59. Write a program to rotate an array to the left by K positions.

60. Write a program to reverse an array in groups of K elements.

61. Write a program to find the maximum difference arr[j] - arr[i] where j > i.

62. Write a program to find the minimum difference between any two elements.

63. Write a program to find the pair with the smallest absolute difference.

64. Write a program to find the pair with the largest sum.

65. Write a program to find all triplets whose sum equals a target value.

66. Write a program to find whether an array contains a subarray with sum equal to a target.

67. Write a program to find the maximum sum of a contiguous subarray.

68. Write a program to find the minimum sum of a contiguous subarray.

69. Write a program to find the length of the longest increasing contiguous subarray.

70. Write a program to find the length of the longest decreasing contiguous subarray.

71. Write a program to find the longest sequence of consecutive 1s in a binary array.

72. Write a program to find the maximum number of consecutive zeros in a binary array.

73. Write a program to find the majority element that occurs more than N/2 times.

74. Write a program to find all elements that occur more than N/3 times.

75. Write a program to find the equilibrium index where left sum equals right sum.

76. Write a program to find all equilibrium indexes in an array.

77. Write a program to find the prefix sum array.

78. Write a program to answer multiple range-sum queries using prefix sums.

79. Write a program to find the product of all elements except the current element for every index.

80. Write a program to find the maximum product of two elements.

81. Write a program to find the maximum product of a contiguous subarray.

82. Write a program to find the longest subarray with sum equal to zero.

83. Write a program to find the longest subarray with equal numbers of 0s and 1s.

Page 3
84. Write a program to find the smallest positive missing number.

85. Write a program to rearrange an array so positive and negative numbers alternate.

86. Write a program to sort an array containing only 0s, 1s, and 2s without using a built-in sort.

87. Write a program to merge two sorted arrays into one sorted array.

88. Write a program to find the median of two sorted arrays.

89. Write a program to find the kth largest element without fully sorting the array.

90. Write a program to find the kth smallest element without fully sorting the array.

91. Write a program to find the longest consecutive sequence of integers.

92. Write a program to find the number of inversions in an array.

93. Write a program to find the maximum sum of non-adjacent elements.

94. Write a program to find the maximum circular subarray sum.

95. Write a program to find the next greater element for every array element.

96. Write a program to find the previous greater element for every array element.

97. Write a program to find the next smaller element for every array element.

98. Write a program to find the previous smaller element for every array element.

99. Write a program to find the maximum value of arr[i] - arr[j] + arr[k] under valid index ordering.

100. Write a program to find the longest subarray containing at most K distinct elements.

101. Write a program to find the minimum length subarray whose sum is at least a target.

102. Write a program to find all leaders in an array; an element is a leader if it is greater than all elements
to its right.

103. Write a program to find the maximum profit from buying and selling a stock once using an array of
prices.

End of Question Paper

Page 4

You might also like