Saturday, February 13, 2021

Previous Year Questions on Strings

ICSE Class 10 Computer Applications 
Previous Year Questions on String




Year 2023
Question 1
Define a class to accept a string and print number of digits, alphabets and special characters in the string.

Example:      
INPUT:        S = KAPILDEV@83

OUTPUT:    Number of Digits - 2
                    Number of Alphabets - 8
                    Number of Special Characters - 1


Year 2022
Question 2
Define a class to accept a string, and print the characters with the uppercase and lowercase reversed, but all the other characters should remain the same as before

EXAMPLE:
INPUT: WelCoMe_2022
OUTPUT: wELcOmE_2022

Question 3
Define a class to declare an array to accept and store ten words. Display only those words which begin with the letter 'A' or 'a' and also end with the letter 'A' or 'a'

EXAMPLE:
Input: Hari, Anita. Akash, Amrita, Alina, Devi, Rishab, Jolin, Farha, AMITHA
Output:
Anita
Amrita
Alina
AMITHA

Question 4
Define a class to accept two strings of same length and form a new word in such a way that, the first character of the first word is followed by the first character of the second word and so on.
Example:
Input string 1-BALL
Input String 2- WORD
OUTPUT: BWAOLRLD

Year 2019
Question 5
Write a program to input a sentence and convert it into uppercase and count and display the total number of words starting with a letter 'A'.
Example:
Sample Input: ADVANCEMENT AND APPLICATION OF INFORMATION TECHNOLOGY ARE EVER CHANGING.
Sample Output : Total number of words starting with letter 'A' = 4.

Year 2018
Question 6
Write a program in Java to accept a string in lower case and change the first letter of every word to upper case. Display the new string. 
Sample input: we are in cyber world
Sample output : We Are In Cyber World

Year 2017
Question 7
Design a class to overload a function check ( ) as follows : 
(i) void check (String str, char ch) – to find and print the frequency of a character in a string.
Example : *
Input:
str = “success”
ch = ‘s’ .
Output:
number of s present is = 3

(ii) void check(String si) – to display only vowels from string si, after converting it to lower case.
Example:
Input:
s1 = “computer”
Output:
o u e

Year 2016
Question 8
Special words are those words which starts and ends with the same letter. 
Examples:
EXISTENCE
COMIC
WINDOW
Palindrome words are those words which read the same from left to right and vice versa
Examples:
MALAYALAM
MADAM
LEVEL
ROTATOR
CIVIC
All palindromes are special words, but all special words are not palindromes. Write a program to accept a word check and print Whether the word is a palindrome or only special word.

Year 2015
Question 9
Design a class to overload a function Joystring( ) as follows :
(i) void Joystring (String s, char ch1 char ch2) with one string argument and two character arguments that replaces the character argument ch1 with the character argument ch2 in the given string s and prints the new string.

Example:
Input value of s = “TECHNALAGY”
ch1=‘A’,
ch2=‘O’
Output: TECHNOLOGY

(ii) void Joystring (String s) with one string argument that prints the position of the first space and the last space of the given string s.

Example:
Input value of = “Cloud computing means Internet based computing”
Output: First index : 5
Last index : 36

(iii) void Joystring (String s1, String s2) with two string arguments that combines the two string with a space between them and prints the resultant string. 

Example :
Input value of s1 =“COMMON WEALTH”
Input value of s2 =“GAMES”
Output: COMMON WEALTH GAMES
(use library functions) 

Tuesday, February 2, 2021

Java Language Fundamentals

 Hi All,

Here we all will be discussing about some fundamental concepts of Java.

1. Identifiers

Identifiers can be defined as a name in java program which can be used for identification purpose. It can be a method name, variable name, class name, label name, package name or interface name.

For example:

So we can see that there are 5 identifiers in the above program.

There are certain rules to follow while naming identifiers:

For example:

1. Identifiers can have alphabets (a-z, A-Z), digits(0-9), underscore(_) and dollar sign($).

2. Identifiers can be of any length.

3. Identifiers must not begin with digits.

4. Identifiers are case sensitive i.e. uppercase and lowercase letters are treated differently.

5. We cannot use reserved words as identifiers.

6. All predefined classes and interfaces can be use as identifiers name. Even though it is valid but it is not a good programming practice.


Reserved Words:

Java has 53 reserved words. 



Check whether the word is Special word or Palindrome word.

Special words are those words which starts and ends with the same letter.  Examples: EXISTENCE COMIC WINDOW Palindrome words are those words...