Computer Applications — Suggested Paper 4
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). Fill in blank (iv): n = __________
[1 mark]- (a)n % 10;
- (b)n / 10;
- (c)n / 100;
- (d)n % 100
1(ii). If (a > b && b > c) then largest number is __________.
[1 mark]- (a)b
- (b)c
- (c)a
- (d)Wrong expression
1(iii). What is the output of the statement Math.pow(36, 6/5);?
[1 mark]- (a)36.0
- (b)1.0
- (c)73.71
- (d)6.0
1(iv). Name the type of error in the statement given below: double x; y; z;
[1 mark]- (a)Logical error
- (b)Syntax error
- (c)Runtime error
- (d)No error
1(v). Fill in blank (iv): cer = __________
[1 mark]- (a)NOT AWARDED;
- (b)"NOT AWARDED";
- (c)"AWARDED";
- (d)"NOT AWARDED"
1(vi). The correct statement to create an object named mango of class fruit:
[1 mark]- (a)Fruit Mango = new fruit();
- (b)fruit mango = new fruit();
- (c)Mango fruit = new Mango();
- (d)fruit mango = new mango();
1(vii). The access specifier that gives least accessibility is __________.
[1 mark]- (a)Package
- (b)Public
- (c)Protected
- (d)Private
1(viii). What is the output of the Java code given below? String color[] = {"Blue", "Red", "Violet"}; System.out.println(color[2].length());
[1 mark]- (a)6
- (b)5
- (c)3
- (d)2
1(ix). Give the output of the following: int x = 2, y = 4, z = 1; int result = (++z) + y + (++x) + (z++); System.out.print(result);
[1 mark]- (a)11
- (b)12
- (c)10
- (d)9
1(x). The jump statement that is used inside a switch case construct to terminate a statement sequence:
[1 mark]- (a)continue
- (b)break
- (c)return
- (d)goto
1(xi). What value will Math.sqrt(Math.ceil(15.3)) return?
[1 mark]- (a)16.0
- (b)16
- (c)4.0
- (d)5.0
1(xii). The number of values that a method can return is:
[1 mark]- (a)1
- (b)2
- (c)3
- (d)4
1(xiii). What is the output of the statement given below? "ANGER".compareTo("ANGEL")
[1 mark]- (a)3
- (b)-6
- (c)6
- (d)0
1(xiv). Fill in blank (i): class __________
[1 mark]- (a)Number
- (b)number
- (c)NUMBER
- (d)NUM
1(xv). The access modifier that gives least accessibility is:
[1 mark]- (a)private
- (b)public
- (c)protected
- (d)package
1(xvi). Consider the two-dimensional array P[2][3] of peripherals (input / output devices) given above; state the index of the device Barcode Scanner.
[1 mark]
- (a)P[1][1]
- (b)P[0][1]
- (c)P[1][2]
- (d)P[0][0]
1(xvii). Which of the following keyword is used to create symbolic constants in Java?
[1 mark]- (a)final
- (b)Final
- (c)Constant
- (d)Const
1(xviii). The earth spins on its axis completing one rotation in a day. The earth revolves around the sun in 365 days to complete one revolution. What is the Java concept depicted in the given picture?
[1 mark]
- (a)Array
- (b)Condition
- (c)Nested loop
- (d)While loop
1(xix). Character class methods are found in the package called:
[1 mark]- (a)java.util
- (b)java.lang
- (c)java.awt
- (d)java.io
1(xx). Consider the following program segment in which the statements are jumbled. Choose the correct order of statements to calculate and return the factorial of 4. 1. for(k = 1; k <= 4; k++) 2. return fa; 3. long fa = 1, k; 4. fa *= k;
[1 mark]- (a)1, 2, 3, 4
- (b)3, 1, 4, 2
- (c)3, 1, 2, 4
- (d)1, 3, 2, 4
2(i). Write the memory capacity (storage size) of short and float data type in bytes.
[2 marks]2(ii). State a difference between call by value and call by reference.
[2 marks]2(iii). Give the output of the following: (i) Math.floor(-4.7) (ii) Math.ceil(3.4) + Math.pow(2, 3)
[2 marks]2(vi). Consider the following String array and give the output: String arr[] = {"DELHI", "CHENNAI", "MUMBAI", "LUCKNOW", "JAIPUR"}; System.out.println(arr[0].length() > arr[3].length()); System.out.print(arr[4].substring(0, 3));
[2 marks]2(iv). The following code to compare two strings is compiled, the following syntax error was displayed — incompatible types: int cannot be converted to boolean. Identify the statement which has the error and write the correct statement. Give the output of the program segment. void calculate() { String a = "KING", b = "KINGDOM"; boolean x = a.compareTo(b); System.out.println(x); }
[2 marks]2(viii). Consider the given program and answer the questions given below: class temp { int a; temp() { a = 10; } temp(int z) { a = z; } void print() { System.out.println(a); } void main() { temp t = new temp(); temp x = new temp(30); t.print(); x.print(); } } (a) What concept of OOPs is depicted in the above program with two constructors? (b) What is the output of the method main()?
[2 marks]2(v). What is an infinite loop? Give an example.
[2 marks]2(vii). What is inheritance?
[2 marks]2(ix). Why is an object called an instance of a class?
[2 marks]2(x). What is the data type returned by the following library methods? (i) isWhitespace() (ii) compareToIgnoreCase()
[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 values into an array of double data type of size 20. Accept a double value from the user and search in the array using the linear search method. If the value is found display the message "Found" with its position where it is present in the array. Otherwise display the message "not found".
[15 marks]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
[15 marks]5. Define a class to overload the method print() as follows: void print() - To print the given format using nested loops. @#@#@ @#@#@ @#@#@ @#@#@ @#@#@ double print(double a, double b) - To display the sum of numbers between a and b with difference of 0.5. e.g. if a = 1.0, b = 4.0 output is: 1.0 + 1.5 + 2.0 + 2.5 + .......... + 4.0 int print(char ch1, char ch2) - compare the two characters and return the ASCII code of the largest character.
[15 marks]6. Write a program to accept a number and check and display whether it is a Niven number or not. A Niven number is a number which is divisible by the sum of its digits. Example: consider the number 126. Sum of its digits is 1 + 2 + 6 = 9, and 126 is divisible by 9.
[15 marks]
7. Design a class RailwayTicket with the following description: Instance variables / data members: String name - to store the name of the customer String coach - to store the type of coach the customer wants to travel long mobNo - to store the customer’s mobile number int amt - to store basic amount of ticket int totalAmt - to store the amount to be paid after updating the original amount Member methods: void accept() - to take input for name, coach, mobile number and amount void update() - to update the amount as per the coach selected (extra amount to be added to the amount as follows): Type of Coaches Amount First_AC 700 Second_AC 500 Third_AC 250 sleeper None void display() - to display all details of a customer such as name, coach, total amount and mobile number Write a main() method to create an object of the class and call the above member methods.
[15 marks]8. Define a class to accept values in an integer array of size 10. Find the sum of one digit numbers and the sum of two digit numbers entered. Display them separately. Example: Input: a[] = {2, 12, 4, 9, 18, 25, 3, 32, 20, 1} Output: Sum of one digit numbers : 2 + 4 + 9 + 3 + 1 = 19 Sum of two digit numbers : 12 + 18 + 25 + 32 + 20 = 107
[15 marks]