Computer Applications — Suggested Paper 2
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). int x = (int)32.8; is an example of __________ typecasting.
[1 mark]- (a)implicit
- (b)automatic
- (c)explicit
- (d)coercion
1(ii). Choose the odd one:
[1 mark]- (a)if else
- (b)if
- (c)switch case
- (d)while()
1(iii). Return data type of isLetter(char) is __________.
[1 mark]- (a)Boolean
- (b)boolean
- (c)bool
- (d)char
1(iv). Fill in blank (v): void __________
[1 mark]- (a)display()
- (b)Display()
- (c)Print()
- (d)DISPLAY()
1(v). The output of the function "COMPOSITION".substring(3, 6):
[1 mark]- (a)POSI
- (b)POS
- (c)MPO
- (d)MPOS
1(vi). The blueprint that defines the variables and the methods common to all of a certain kind is termed as:
[1 mark]- (a)class
- (b)object
- (c)package
- (d)method
1(vii). Assertion (A): Static method can access static and instance variables. Reason (R): Static variables can be accessed only by static method.
[1 mark]- (a)Assertion and Reason both are correct.
- (b)Assertion is true and Reason is false.
- (c)Assertion is false and Reason is true.
- (d)Assertion and Reason both are false.
1(viii). The index (subscript) of the last element of an array ar[] is
[1 mark]- (a)ar.length()
- (b)ar[].length
- (c)ar.length()-1
- (d)ar.length-1
1(ix). The concept of having more than one constructor with different types of parameters:
[1 mark]- (a)Copy constructor
- (b)Method overloading
- (c)Constructor overloading
- (d)Overloaded methods
1(x). Multi line comments in Java start with /* and end with */.
[1 mark]- (a)True
- (b)False
- (c)—
- (d)—
1(xi). State the type of loop in the given program segment: for(int i = 5; i != 0; i -= 2) System.out.println(i);
[1 mark]- (a)finite
- (b)infinite
- (c)null
- (d)fixed
1(xii). Corresponding wrapper class of float data type is __________.
[1 mark]- (a)FLOAT
- (b)float
- (c)Float
- (d)Floating
1(xiii). In a calculator which Java feature allows multiple methods named calculate() for the different operations?
[1 mark]- (a)abstraction
- (b)inheritance
- (c)encapsulation
- (d)polymorphism
1(xiv). Assertion (A): The substring() method modifies the original String. Reason (R): The substring() method can extract part of a String starting from a specific index.
[1 mark]- (a)(A) is true and (R) is false.
- (b)(A) is false and (R) is true.
- (c)Both (A) and (R) are true and (R) is the correct explanation of (A).
- (d)Both (A) and (R) are true, but (R) is not the correct explanation of (A).
1(xv). Choose the odd one:
[1 mark]- (a)Robust
- (b)Platform Independent
- (c)Inheritance
- (d)Multithreading
1(xvi). Which of the following is NOT an access specifier?
[1 mark]- (a)private
- (b)protected
- (c)package
- (d)public
1(xvii). The number of bytes occupied by a character array of four rows and three columns is __________.
[1 mark]- (a)12
- (b)24
- (c)96
- (d)48
1(xviii). If the name of the class is "Yellow", what can be the possible name for its constructors?
[1 mark]- (a)yellow
- (b)YELLOW
- (c)Yell
- (d)Yellow
1(xix). Assertion (A): The result of the Java expression 3 + 7/2 is 6. Reason (R): According to the hierarchy of operators in Java, addition is done first followed by division.
[1 mark]- (a)(A) is true and (R) is false.
- (b)(A) is false and (R) is true.
- (c)Both (A) and (R) are true and (R) is the correct explanation of (A).
- (d)Both (A) and (R) are true, but (R) is not the correct explanation of (A).
1(xx). Which of the following are entry-controlled loops? 1. for 2. while 3. do..while 4. switch
[1 mark]- (a)Only 1
- (b)1 and 2
- (c)1 and 3
- (d)3 and 4
2(i). System.out.print("BEST "); System.out.println("OF LUCK"); Choose the correct option for the output of the above statements: (i) BEST OF LUCK (ii) BEST OF LUCK
[2 marks]2(ii). Write the return data type of the following functions: (i) endsWith() (ii) log()
[2 marks]2(iii). Rewrite the following using ternary operator: if(x % 2 == 0) System.out.print("EVEN"); else System.out.print("ODD");
[2 marks]2(iv). Give the output of the following string functions: (i) "ACHIEVEMENT".replace('E', 'A') (ii) "DEDICATE".compareTo("DEVOTEE")
[2 marks]2(v). Differentiate between constructor and function.
[2 marks]2(vi). How are private members of a class different from public members?
[2 marks]2(vii). John was asked to write a Java code to calculate the surface area of a cone. The following code was written by him: Surface area of cone is A = pi * r * l, where l = sqrt(r^2 + h^2) class area { double area(double r, double h) { double l, a; a = 22.0 / 7 * r * l; l = Math.sqrt(r * r + h * h); return a; } } Specify the type of the error in the above program, correct and write the program to be error free.
[2 marks]2(viii). Consider the following array and answer the questions given below: int a[] = {12, 10, 8, 4, 6, 2, 3, 5, 7}; (a) What is the output of System.out.print(a[0] + a[5]);? (b) What is the index (subscript) of the largest element of the array a[]?
[2 marks]2(ix). Name any two basic principles of object-oriented programming.
[2 marks]2(x). Identify and name the following tokens: (i) public (ii) 'a' (iii) == (iv) { }
[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. Define a class to accept a String and print the number of digits, alphabets and special characters in the string. Example: S = "KAPILDEV@83" Output: Number of digits - 2 Number of Alphabets - 8 Number of Special characters - 1
[15 marks]4. Write a program to accept a number and check and display whether it is a spy number or not. A number is spy if the sum of its digits equals the product of its digits. Example: consider the number 1124. Sum of the digits = 1 + 1 + 2 + 4 = 8 Product of the digits = 1 x 1 x 2 x 4 = 8
[15 marks]5. Design a class to overload a function sumSeries() as follows: (i) void sumSeries(int n, double x) - with one integer argument and one double argument, to find and display the sum of the series: x/1 + x/2 + x/3 + ... + x/n (ii) void sumSeries() - to find and display the sum of the following series: s = 1 + (1 x 2) + (1 x 2 x 3) + ... + (1 x 2 x 3 x ... x 20)
[15 marks]6. Define a class pin code and store the given pin codes in a single-dimensional array. Sort these pin codes in ascending order using the Selection Sort technique only. Display the sorted array. 110061, 110001, 110029, 110023, 110055, 110006, 110019, 110033
[15 marks]
7. Design a class with the following specifications: Class name: Student Member variables: name - name of student age - age of student mks - marks obtained stream - stream allocated (Declare the variables using appropriate data types) Member methods: void accept() - Accept name, age and marks using methods of Scanner class. void allocation() - Allocate the stream as per the following criteria: mks stream >= 300 Science and Computer >= 200 and < 300 Commerce and Computer >= 75 and < 200 Arts and Animation < 75 Try Again void print() - Display Student name, age, mks and stream allocated. Call all the above methods in main method using an object.
[15 marks]
8. Design a class ShowRoom with the following description: Instance variables / data members: String name - to store the name of the customer long mobNo - to store the mobile number of the customer double cost - to store the cost of the items purchased double dis - to store the discount amount double amount - to store the amount to be paid after discount Member methods: ShowRoom() - default constructor to initialize data members void input() - to input customer name, mobile number, cost void calculate()- to calculate discount on the cost of purchased items, based on the following criteria: Cost Discount (%) Less than or equal to Rs. 10000 5% More than 10000 and up to 20000 10% More than 20000 and up to 35000 15% More than 35000 20% void display() - to display customer name, mobile number, amount to be paid after discount Write a main() method to create an object of the class and call the above member methods.
[15 marks]