Computer Applications — Suggested Paper 1
150 minutes100 marks Questions from 2016–2026
A suggested paper: every question is a real ICSE board question, chosen from different years and arranged in the current pattern. Start the timed test to have your written answers marked.
Section A (40 marks)
Attempt all questions from this Section.
1. Choose the correct answers to the questions from the given options. (Do not copy the questions, write the correct answers only.)
1(i). Choose the odd one:
[1 mark]- (a)double
- (b)int
- (c)char
- (d)String
1(ii). Select the infinite loop:
[1 mark]- (a)for(int i=1; i<=10; i++)
- (b)for(int i=2; i!=0; i-=3)
- (c)for(int i=5; i<=5; i++)
- (d)for(int i=1; i>=1; i--)
1(iii). Predict the output of the following code snippet: String P = "20", Q = "22"; int a = Integer.parseInt(P); int b = Integer.valueOf(Q); System.out.println(a + "" + b);
[1 mark]- (a)20
- (b)20 22
- (c)2220
- (d)22
1(iv). In the following method prototype to accept a character, an integer and return YES or NO, fill in the blank to complete the method prototype. public __________ someMethod(char ch, int n)
[1 mark]- (a)boolean
- (b)String
- (c)int
- (d)double
1(v). String a[] = {"Atasi", "Aditi", "Anant", "Amit", "Ahana"}; System.out.println(a[1].charAt(1) + "*" + a[2].charAt(2)); The output of the above statement is:
[1 mark]- (a)da
- (b)d * a
- (c)ti
- (d)t * i
1(vi). Consider the given picture and choose the correct statement from the following:
[1 mark]
- (a)Polygon is the object and the pictures are classes
- (b)Both polygon and the pictures are classes
- (c)Polygon is the class and the pictures are objects
- (d)Both polygon and the pictures are objects
1(vii). A mechanism where one class acquires the properties of another class:
[1 mark]- (a)Polymorphism
- (b)Inheritance
- (c)Encapsulation
- (d)Abstraction
1(viii). The sales made by 5 salesmen selling 5 products is stored in a two-dimensional array of integer data type. How many bytes does the array occupy?
[1 mark]- (a)25
- (b)200
- (c)50
- (d)100
1(ix). Java compiler automatically creates a default constructor in case no constructor is present in the java class.
[1 mark]- (a)True
- (b)False
- (c)—
- (d)—
1(x). int x = 98; char ch = (char)x; what is the value in ch?
[1 mark]- (a)b
- (b)A
- (c)B
- (d)97
1(xi). Give the output of the following, when x = 'g': switch(x) { case 'M': System.out.print("Microsoft Teams "); break; case 'G': System.out.print("Google Meet"); default : System.out.print("Any software"); break; case 'W': System.out.print("Web Ex"); break; }
[1 mark]- (a)Google Meet
- (b)Any software
- (c)Google Meet Any software
- (d)WebEx
1(xii). Which of the following converts "25" to 25.0?
[1 mark]- (a)Double.Parsedouble("25")
- (b)Double.parse("25")
- (c)Double.parseDouble("25")
- (d)Double.parseDouble(25)
1(xiii). Write a method prototype named check() which takes an integer argument and returns a char:
[1 mark]- (a)char check()
- (b)void check(int x)
- (c)check(int x)
- (d)char check(int x)
1(xiv). The String class method to join two strings is:
[1 mark]- (a)concat(String)
- (b)joint(String)
- (c)concat(char)
- (d)Concat()
1(xv). The keyword to create an object of a class is __________.
[1 mark]- (a)create
- (b)new
- (c)New
- (d)NEW
1(xvi). The process of binding the data and method together as one unit is called as:
[1 mark]- (a)Encapsulation
- (b)Inheritance
- (c)Polymorphism
- (d)Dynamic binding
1(xvii). An array with 3 elements is arranged in ascending order as follows: 4 1 3 -> 1 4 3 -> 1 3 4 Name the technique used:
[1 mark]- (a)Bubble sort
- (b)Linear Search
- (c)Selection sort
- (d)Binary Search
1(xviii). In constructor overloading all constructors should have the same name as of the class but with a different set of __________.
[1 mark]- (a)Access specifiers
- (b)Classes
- (c)Return type
- (d)Parameters
1(xix). System.exit(0) terminates the program from any point.
[1 mark]- (a)True
- (b)False
- (c)—
- (d)—
1(xx). Read the if program segment given below: if(a > b) z = 25; else z = 35; Which one of the following is the correct conversion of the if program segment to ternary?
[1 mark]- (a)z = a > b ? 35 : 25;
- (b)z = a > b ? 25 : 35;
- (c)z = a > b : 35 ? 25;
- (d)z = a > b : 25 ? 35;
2(i). What are keywords? Give an example.
[2 marks]2(ii). Write the output of the following String method: String x = "talent"; String y = "matrix"; System.out.print(x.substring(3).concat(y.substring(3)));
[2 marks]2(iii). Rewrite the following using ternary operator: if(n1 > n2) r = true; else r = false;
[2 marks]2(x). Write the output for the following: String s1 = "Life is Beautiful"; System.out.println("Earth" + s1.substring(4)); System.out.println(s1.endsWith("L"));
[2 marks]2(iv). Write a Java expression for the following: square root of (3x + x^2), all divided by (a + b)
[2 marks]2(v). Name any two types of access specifiers.
[2 marks]2(vi). What is constructor overloading?
[2 marks]2(vii). Write a difference between class and an object.
[2 marks]2(viii). Write the prototype of a function check which takes an integer as an argument and returns a character.
[2 marks]2(ix). What is the difference between the linear search and the binary search technique?
[2 marks]Section B (60 marks)
Attempt any four questions from this Section. The answers in this Section should consist of the programs in either BlueJ environment or any program environment with Java as the base. Each program should be written using variable description / mnemonic codes so that the logic of the program is clearly depicted. Flowcharts and algorithms are not required.
3. 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(int n1) - To find and display the sum of even digits of a number. Example: n1 = 29865 Sum of even digits = 16 Write a main method to create an object and invoke the above methods.
[15 marks]4. Define a class to initialise the following data in an array. Search for a given character input by the user, using the Binary Search technique. Print "Search Successful" if the character is found, otherwise print "Search is not Successful". 'A', 'H', 'N', 'P', 'S', 'U', 'W', 'Y', 'Z', 'b', 'd'
[15 marks]5. Using the switch statement, write a menu-driven program for the following: (i) To find and display the sum of the series given below: S = x^1 - x^2 + x^3 - x^4 + x^5 ... - x^20 (where x = 2) (ii) To display the following series: 1 11 111 1111 11111 For an incorrect choice, an appropriate error message should be displayed.
[15 marks]
6. Define a class ElectricBill with the following specifications: Class name: ElectricBill Instance variables / data members: String n - to store the name of the customer int units - to store the number of units consumed double bill - to store the amount to be paid Member functions: void accept() - to accept the name of the customer and number of units consumed void calculate() - to calculate the bill as per the following tariff: Number of units Rate per unit First 100 units Rs. 2.00 Next 200 units Rs. 3.00 Above 300 units Rs. 5.00 A surcharge of 2.5% is charged if the number of units consumed is above 300 units. void print() - to print the details as follows: Name of the customer: ... Number of units consumed: ... Bill amount: ... Write a main() method to create an object of the class and call the above methods.
[15 marks]7. A private Cab service company provides service within the city at the following rates: AC CAR NON AC CAR UPTO 5 KM Rs. 150/- Rs. 120/- BEYOND 5 KM Rs. 10/- PER KM Rs. 08/- PER KM Design a class CabService with the following description: Member variables / data members: String car_type - To store the type of car (AC or NON AC) double km - To store the kilometer travelled double bill - To calculate and store the bill amount Member methods: CabService() - Default constructor to initialize data members. String data members to "" and double data members to 0.0. void accept() - To accept car_type and km (using Scanner class only). void calculate()- To calculate the bill as per the rules given above. void display() - To display the bill as per the following format: CAR TYPE: KILOMETER TRAVELLED: TOTAL BILL: Create an object of the class in the main method and invoke the member methods.
[15 marks]8. Define a class to overload the method perform as follows: double perform(double r, double h) - to calculate and return the value of Curved surface area of cone, CSA = pi * r * l void perform(int r, int c) - Use NESTED FOR LOOP to generate the following format. For r = 4, c = 5 the output is: 12345 12345 12345 12345 void perform(int m, int n, char ch) - to print the quotient of the division of m and n if ch is Q, else print the remainder of the division of m and n if ch is R
[15 marks]