0% found this document useful (0 votes)
17 views5 pages

WS-2 (Programming - Array & String) (Computer-ICSE) - Class-10

This document is a worksheet for Class X students focusing on programming concepts related to arrays and strings. It includes a variety of programming tasks such as searching, sorting, and manipulating both 1D and 2D arrays, as well as string operations. The tasks are designed to enhance students' understanding and skills in programming with arrays and strings.

Uploaded by

fatimazimsha
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)
17 views5 pages

WS-2 (Programming - Array & String) (Computer-ICSE) - Class-10

This document is a worksheet for Class X students focusing on programming concepts related to arrays and strings. It includes a variety of programming tasks such as searching, sorting, and manipulating both 1D and 2D arrays, as well as string operations. The tasks are designed to enhance students' understanding and skills in programming with arrays and strings.

Uploaded by

fatimazimsha
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
You are on page 1/ 5

WORKSHEET – 2 [PROGRAMMING – ARRAY & STRING] (CLASS – X)

PROGRAMMING – ARRAY & STRING


WORKSHEET – 2 (CLASS – X) [ICSE]

1. Write a program to perform linear search in a 1D array.


2. Write a program to perform binary search in a sorted array.
3. Find the first occurrence of an element in an array.
4. Find the last occurrence of an element in an array.
5. Count how many times a given element occurs in an array.
6. Find the index of the smallest element using linear search.
7. Find the index of the largest element using linear search.
8. Search for all even numbers in the array and print their indices.
9. Search for a substring-like sequence inside an array (array pattern search).
10. Implement recursive binary search.
11. Implement Bubble Sort in ascending order.
12. Implement Bubble Sort in descending order.
13. Implement Selection Sort.
17. Sort the array and remove duplicate elements.
18. Sort the array and print the second largest element.
19. Sort the array and print the k-th smallest element.
21. Find the maximum and minimum element in the array.
22. Find the sum of all array elements.
23. Find the average of array elements.
24. Reverse the array.
27. Check if the array is sorted or not.
28. Find the frequency of each element in the array.
29. Remove duplicate elements from the array.
30. Merge two sorted arrays into a single sorted array.

2D ARRAY
31. Read and display a 2D matrix.
32. Find the sum of all elements in a 2D array.
33. Find the row-wise sum of elements in a matrix.
Page [1]
WORKSHEET – 2 [PROGRAMMING – ARRAY & STRING] (CLASS – X)

34. Find the column-wise sum of elements in a matrix.


35. Find the largest element in a 2D array.
36. Find the smallest element in a 2D array.
37. Count the total even and odd numbers in a 2D array.
38. Search an element in a 2D matrix.
39. Check if a matrix is sparse (more zeros than non-zeros).
40. Transpose a matrix.
41. Add two matrices.
42. Subtract two matrices.
43. Multiply two matrices.
44. Check if a matrix is symmetric.
45. Check if a matrix is an identity matrix.
46. Find the trace of a square matrix (sum of diagonal elements).
47. Find the sum of both diagonals in a matrix.
48. Rotate a matrix 90 degrees clockwise.
49. Rotate a matrix 90 degrees anticlockwise.
50. Find the upper triangular and lower triangular matrix.

STRINGS
BASICS (10 QUESTIONS)
51. Find the length of a string without using built-in functions.
52. Reverse a string.
53. Check if a string is a palindrome.
54. Count vowels and consonants in a string.
55. Count words in a string.
56. Convert lowercase letters to uppercase.
57. Convert uppercase letters to lowercase.
58. Count digits, alphabets, and special characters in a string.
59. Copy one string into another.
60. Compare two strings without using built-in functions.

Page [2]
WORKSHEET – 2 [PROGRAMMING – ARRAY & STRING] (CLASS – X)

61. Find the frequency of each character in a string.


62. Remove all duplicate characters from a string.
63. Remove all spaces from a string.
64. Replace all spaces with a hyphen.
65. Remove vowels from a string.
66. Find the first non-repeating character in a string.
67. Find the first repeating character in a string.
68. Count the number of substrings in a string.
69. Print all substrings of a string.
70. Find the longest word in a sentence.
71. Count the frequency of each word in a sentence.
74. Remove all punctuation marks from a string.
75. Find the longest palindrome substring in a string.
76. Find the smallest word in a sentence.
77. Swap the first and last characters of a string.
78. Check if two strings are equal without using string functions.
79. Print the ASCII value of each character in a string.
80. Convert a numeric string (e.g., `"12345"`) into an integer without using built-in conversion.
81. Input: HELLO
Output:
H
HE
HEL
HELL
HELLO
82. Input: HELLO
Output:
HELLO
HELL
HEL
HE
H
Page [3]
WORKSHEET – 2 [PROGRAMMING – ARRAY & STRING] (CLASS – X)

83. Input: HELLO


Output:
H
HE
HEL
HELL
HELLO
84. Input: ABC
Output:
A
ABA
ABCBA
85. Input: XYZ
Output:
X
XYX
XYZYX
XYX
X
86. Input: PYTHON
Output:
P
PY
PYT
PYTH
PYTHO
PYTHON
87. Input: CODE
Output:
C
CO
COD
CODE
COD
CO
C
Page [4]
WORKSHEET – 2 [PROGRAMMING – ARRAY & STRING] (CLASS – X)

88. Input: CAT


Output:
C
A
T
CA
AT
CAT
89. Input: ABCDE
Output:
A
AC
A D
A E
ABCDEEDCBA
90. Hourglass Pattern
Input: HELLO
Output:
HELLO
HELL
HEL
HE
H
HE
HEL
HELL
HELLO



Page [5]

You might also like