Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

ICSE-Computer Applications

                                  Section A (40 Marks)


                                Answer all questions.
Question
1                                                                                                                             
[10]
1. Declare a single dimensional array of 10 integer values.
2. Convert the following while loop to the corresponding for loop.
int m=5, n=10;
while(n>=1)   {
System.out.println(m*n);
n–;
}
3. Convert the following segment into an equivalent do loop:
int x,c;

for(x=10, c=20;c>=20;c=c-2)

x++:

4. What is the final value of ctr when the iteration process given below,
executes?
int ctr=0;
for(int j=1;j<=5;j+=2)
++ctr;

5. If, array[]={1,4,5,6,3,32,23,90}; i) What is array.length?  ii) What is


array[10]?

Question
2                                                                                                                              
[10]

1. Which keyword used to acquire the properties of one class to another class?
2. Here is a skeleton definition of a class
class Sample {
int i;
char c;
float f;
} Implement the constructor.
3. Write a program to check whether the given number is palindrome or not.
4. Differentiate between public and private modifiers for members of a class.
5. What type of inheritance does Java here?
Question
3                                                                                                                               
[10]

1. Write a program to print Fibonacci series i.e., 0 1 1 2 3 5 8…..The number


of terms required, is to be passed as parameter.
2. What will be the result stored in x after evaluating the following expression?
int x =42;
x+ = (x++ ) + (++x) +x;
3. What will be the output of the following code?
int m=3;

int n=15;

for(int i=1;i<5;i++)

m++;

–n;

System.out.println(“m=”+m);
System.out.println(“n=”+n);
4. Analyze the following program segment and determine how many times the
loop will be executed and what will be the output of the program segment?
int p=200;
while(true)

if(p<100)

break;
p=p-40;

System.out.println(p);
5. The following is a segment of a program
x=1; y=1;
if(n>0)  {

x=x+1;
y=y+1;}

What will be the value of x and y, if n assumes a value  i)1  ii) 0 ?

Question
4                                                                                                                               
[10]

1. Give two differences between the switch statement and if else statement.
2. Write two difference between linear search and binary search.
3. Given that in x[][]={{2,4,6},{3,5,7}}, what will be the value of x[1][1] and
x[0][2]?
4. State the total size in bytes, of the arrays a[4] of char data type and p[6] of
float data type.
5. If int x[]={4,3,7,8,9,10}; What are the values of p and q?
i) p= x.length     ii)   q=x[2] +x[5] * x[1]
   
 
         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 descriptions/Mnemonic Codes
such that the logic of the program is clearly depicted.
Flow-Charts and Algorithms are not required.
Question 5                                                                                         
[15]
Designa class to overload a function polygon() as follows:
i)          void polygon(int n, char ch)       : with one integer argument and one
character type argument that draws a filled square of side n using the character
stored in ch.
1. ii) void polygon(int x, int y) : with two integer arguments that draws a filled
rectangle of length x and breadth y using the symbol ‘@’.
iii)         void polygon()              : with no argument that draws a filled triangle
shown below.

Example:

1. i) Input value of n=2, ch=’O’


Output: OO
OO

1. ii) Input value of x=2,y=5


Output

@@@@@

@@@@@

iii) Output

**

***

 
Question
6                                                                                                                             
[15]
Write  a menu driven program  to accept a number and check and display whether
it is a prime number or not OR an automorphic number or not.
13.a) Prime number : A number is said to be a prime number if it is divisible
only by 1 and itself and not by any other number. Example; 3,5,7,11,13..
14.b) Automorphic number : An automorphic is the number which is contained
in the last digit of the square. Example : 25 is an automorphic number as its
square is 625 and 25 is present as the last two digits.
 
Question
7                                                                                                                             
[15]
Special words are those words which start and end 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

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.

Question
8                                                                                                                             
[15]
Write a program that encodes a word into Piglatin. To translate a word into a
Piglatin word, convert the word into upper case and then place the first vowel of
the original word as the start of the new word along with the remaining alphabets.
The alphabets present before the vowel being shifted towards the end following by 
“YZ”.
Sample input : Flowers     Sample Output: OWERSFLYZ
Sample input : Olympics            Sample Output : OLYMPICSYZ

Question
9                                                                                                                             
 1)  Write a program to initialize the given data in an array and find the minimum
and maximum    values along with the sum of the given
elements.                                                                                                                       
      [5]
Numbers: 2 5 4 1 3
Output: Minimum value  : 1
Maximum value=5

Sum of the elements=15

2) Write a program to accept 15 integers from the keyboard, assuming that no


integer entered is a zero. Perform selection sort on the integers and then print them
in ascending order.        [10]
 

Question
10                                                                                                                           
[15] Define a class and store the given city names in a single dimensional array.
Sort these names in alphabetical order using the bubble sort technique only.
Input:  Calcutta, Agra, Mumbai, Bangalore, Delhi

Output: Agra, Bangalore, Calcutta, Delhi, Mumbai

ICSE Model Question ICSE Computer


Applications 2018

1. Define abstraction.
2. Define escape sequence with examples.
3. Write a difference between the functions isUpperCase( ) and
toUpperCase( ).
4. How are private members of a class different from public members?
5. Classify the following as primitive or non-primitive datatypes:
(i) char(ii) arrays(iii) int(iv) classes
Question
1                                                                                                                             
[10]
1. What is dynamic initialization, with an example?
2. How are the following passed in Java? i) primitive types ii) reference types
3. Consider the following class:
public class myClass {
public static int x=3, y=5;
public int a=2, b=3; }
i)          Name the variables for which each object of the class will have its
own
distinct copy.
4. ii) Name the variables that are common to all objects of the class.
5. Create a class with one integer instance variable and one class variable.
Initialize the variable using i) default constructor (ii) parameterized
constructor
6. Write a java statement to create an object mp4 of class digital.
Question
2                                                                                                                              
[10]

1. Differentiate between String and Stringbuffer type data.


2. Here is a skeleton definition of a class
class Sample {
int i;
char c;
float f;
} Implement the constructor.
3. What will be the output of the following code fragment?
If the input given is i) 7 ii) 5
if(a=5)
out.println(“Five”);
else
System.out.println(“Not Five”);
4. Differentiate between
i) equals() and compareTo() with examples and return value.
5. ii) throw and throws
6. Write an expression in Java for  x4+ 6x2 + 25 / x
Question
3                                                                                                                              
[10]

1. What are the values of x and y when the following statements are executed?
int a=63, b=36;
boolean x=(a>b) ?a:b;
int y=(a<b)?a:b;
2. What will be the result stored in x after evaluating the following expression?
int x =4;
x+ = (x++ ) + (++x) +x;
3. State the method that:
i) Converts a string to a primitive float data type.
4. ii) Determines if the specified character is an uppercase characters.
5. Write the Identifier Naming Rules. (All rules)
6. Rewrite the following program segment using the if –else statements instead
of the ternary operator.
String grade= (mark >= 90)?”A”: (mark >=80)? “B”: “C”;

Question
4                                                                                                                              
[10]

1. Give the output of the following code


double m=6.25, n=7.45;
out.println(Math.sqrt(m));
System.out.println(Math.min(m,n));
System.out.println(Math.abs(6.25-7.45));
System.out.println(Math.ceil(m));
2. Name the type of error (syntax, runtime or logical error) in each case given
below:
i) Division of a variable that contains a value of zero.
ii) Multiplication operator used when the operation should be division
iii) Missing semicolon
3. Write a java statement to input/read the following from the user using the
keyboard.
4. Character ii) String (using scanner class)
5. Write about the differences between Primitive and Reference data types with
example.
6. What is temporary instance with example?
     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 descriptions/Mnemonic Codes
such that the logic of the program is clearly depicted.
Flow-Charts and Algorithms are not required.
Question
5                                                                                                                             
[15]
Given below is a  hypothetical table showing rate of income tax for male citizens
below the age of 65 years.
Taxable income(Ti) in Rs.                                                    Income Tax in Rs.
Does not exceed Rs. 1,60,000                                                                        Nil
Is greater than Rs.1,60,000 and less
than or equal to Rs. 5,00,000                                             (Ti-1,60,000)* 10%
Is greater than Rs. 5,00,000 and less than or
equal to Rs. 8,00,000                                                      [(Ti – 5,00,000) * 20%]
+34,000
Is greater than Rs. 8,00,000                                                    [(Ti – 8,00,000)* 30%]
+ 94,000
 

Write a program to input that age, gender (male or female) and taxable income of a
person. If the age is more than 65 years or the gender is female, display “Wrong
category”. If the age is less than or equal to 65 years and the gender is male,
compute and display the income tax payable as per the table given above.
Question
6                                                                                                                             
[15]
 

Define a class Library having the following description:

Instance variables/Data members:


int acnum        stores the accession number of the book

String title       stores the title of the book


String author   stores name of the author.

Member Methods:
1. void input() –           to input and store accession number, title and author.
2. void compute() –           to accept the number of days late, calculate and
display the fine charge at the rate Rs. 2 per day.
 void display() –           to display the details in the following format:
 

Accession number                             Title                            Author


Write a main() to create an object of the class and call the above member methods.

 
Question
7                                                                                                                             
[15]
Write a program to accept a word and convert it into lower case if its in uppercase
and display the new word by replacing only the vowels with the preceeding
characters.

Sample Input : computer


Sample Output : cnmpttdr

Question
8                                                                                                                             
[15]
Write a program that encodes a word into Piglatin. To translate a word into a
Piglatin word, convert the word into upper case and then place the first vowel of
the original word as the start of the new word along with the remaining alphabets.
The alphabets present before the vowel being shifted towards the end following by 
“YZ”.

Sample input : Flowers     Sample Output: OWERSFLYZ


Sample input : Olympics         Sample Output : OLYMPICSYZ
Question
9                                                                                                                             
[15]
 
Design a class named FruitJuice with the following description:

Instance variables/Data members:


int product_code         –           stores the product code number

String flavor                –           stores the flavor of the juice (eg: orange, apple etc.)

String pack_Type        –           stores the type oif packaging (eg:tetra-pack, PET
bottle etc.)

int pack_size               –           stores package size(eg: 200mL, 400 mL, etc.)

int product_price         –           stores the price of the product.

Member Methods:
1. FruitJuice() –           deault constructor to initialize integer data members to 0
and String data members to “”
2. void input() –           to input and store the product code, flavor, pack type,
pack size and product price.
 void discount() –           to reduce the product price by 10%.
1. void display() –           to display the product code, flavor, pack type, pack
size and product price.
Write a main method to create an object of the class and call the above member
methods.
 
Question
10                                                                                                                           
[15]
Design a class to overload a function JoyString() as follows:

1. void JoyString(String s, char c1, char c2) :  with one string argument and
two character arguments that replaces the character argument c1 with the
character argument c2 in the given string s and prints the new string with
first character as uppercase.
Example:  s=”technology”
c1=’a’, c2=’o’
Output: “Technology”

1. void JoyString(String s1, String s2) : check and print string having more
characters compared to the other one.
 void JoyString(String s) : prints the position of the first space and last space
of the given string s.
Example :  Input value of= “Cloud computing means Internet based
computing”
Output: First index= 5, Last index = 36
Write the main() and call the above member methods.

You might also like