Work sheet 1 - 2023-24
Grade: X
Subject: Computer Applications
Practice Programs on Strings and Arrays:
1. Write a program to accept a string to exchange first and last characters.
2. Define a class to accept two strings, convert them into uppercase , check and display whether two
strings are equal or not , if the two string are not equal print the string with highest length or print message
both the strings are of equal length.
3. Write a program to input and store a number in variable “num” and search it inthe given array using
linear search technique.
4. Write a program to accept TEN floating point numbers to print the its nearestintegers without using
mathematical functions.
5. Write a program to accept 10 integers into an array and store their squared elements into another
array to print both arrays.
6. Write a program to initialize an array of 5 names and initialize another array with their respective
telephone numbers. Search for a name input by the user, in the list. If found, display “Search Successful”
and print the name along with the telephone number, otherwise display “Search unsuccessful, Name not
listed”.
7. Write a program to accept a string . Convert the string to uppercase. Count and output the number of
double letter sequences that exist in the string .
8. Write a program to accept a sentence and convert it into upper case and count the number of
words starting with the letter A.
9. Take a string containing numbers and alphabets. Display the double of the concatenated digits
from the string.
Example :
If the string is “ ch4an6di8garh “ then the concatenated number is
468. The double of which is 936. So 936 should be displayed. If there is no digits in the string then the
message “String contain no digits”.
10. Write a program to accept 10 different numbers in a single dimensional array .Display the greatest
and the smallest numbers of the array.
11. Write a program to accept 10 different numbers in a single dimensional array. Now, enter a number
and by using binary search technique .check whether or not the number is present in the list of array
elements. If the number is present then display the message ‘search is successful and print the index at
which it is present, otherwise print search is not successful.
12. Define a class to accept and store 10 strings into the array and print the strings with even
number of characters.
13. Write a program to accept 10 integers into an array to print even number positioned elements.
14. Write a program to accept a string and print the string replacing the vowels with ‘*’ , consonants
with ‘@’ and other characters with ‘#’
15. Write a program to accept the marks in physics, chemistry and maths secured by 40 students of a
class in single dimensional array. Find and display the following Number of students securing 80%
and above percentage and number of students securing 34 % and below percentage.
16. Write a program to accept 20 strings into an array to find and print number of palindrome
strings entered by the user.
17. Write a program to input and store roll numbers, names and marks in 3 subjects of N number
of students in 5 single dimensional arrays and display the remarks based on average mark as given
below
Avg.Marks Remark
85 – 100 Excellent
75 – 84 Distinction
60 - 74 First class
40 – 59 Pass
Less than 40 Poor
18. Write a program in Java to accept a word and display the same in Pig Latin form.
Sample Input: TROUBLE
Sample output: OUBLETRAY
19. Write a program to input a sentence and display the word of the sentence that contains maximum
number of vowels.