Class 10 23 August 2023
Class 10 23 August 2023
Page 1
Question 2
(1) Evaluate the expression: z += a++ % --b+ --a + ++b; where a = 15, b = 8, z = 20
(2) int c=-5, a=5, j;
while(a ++ <=10)
for(j=1;j<=a ; j++)
c++;
How many times will the inner loop execute? What is the final value of c?
(3) “REDUCE”.compareTo(“REFUSE”)+“MADAGASCAR”.lastIndexOf(‘A’)
(4) Define the term token.
(5) Consider the following array and answer the questions given below:
int x [ ] = (23, 45, 67, 12, 45, 89, 24, 12, 9, 7}
(a) What is the size of the array?
(b) What is the index of value 89?
Question 3
A private Cab service company provides service within the city at the
following rates:
NON AC CAR AC CAR
UPTO 5 KM Rs 150 /- Rs 120 /-
Question 4
Write a program to input a sentence and convert it into uppercase and display each word in a separate
line. Example: Input: India is my country
Output : INDIA
IS
MY
COUNTRY
Question 5
Design a class to overload a method Number( ) as follows:
(i) void Number(int num , int d) - To count and display the frequency of a digit in a number.
Example: num = 2565685, d = 5
Frequency of digit 5 = 3
(ii) void Number(String str, char ch) - To count and display the frequency of a character (both cases) in
a string.
Example: str = malayalam, ch = a
Frequency of character a = 4
Page 2