ICSE Class 9Computer Applications
Sample Question Paper 1
Max Marks : 80
[2 Hours]
General Instructions
Answers to this Paper must be written on the paper provided
separately.
You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the question paper.
The time given at the head of this Paper is the time allowed for
writing the answers. O This Paper is divided into two Sections.
Attempt all questions from Section A and any four questions from
Section B.
The intended marks for questions or parts of questions are given in
brackets [ ].
Section – A [40 Marks]
(Attempt all questions)
Question 1. [5 x 2 = 10]
Answer the following in brief.
(a) Write two integer primitive data types. [2]
(b) Write two java keywords. [2]
(c) What is a token in Java ? [2]
(d) State any two harms caused by software piracy. [2]
(e) What do you mean by Intellectual property rights ? [2]
Question 2.
Answer with respect to given code. [5 x 2 = 10]
(a) What will be the value of b, c when n1 = 10, n2 = 0, given that: [2]
int b = (n1 < n2) ? n1 : n2 ;
double c = (n2 != 0) ? (n1/n2) : (n1 * 2);
2.
(b) Given theinitial value of r = 5 in the following expression : [2]
v = r++ + 2*r + 2*r++
Write the final value in v and r.
(c) Given the initial value of a = 10, k = 2 in the following expression : [2]
k+ = a++ + ++a/2;
Write the final value in k and a.
(d) Rewrite the following code after debugging (underline the changes made) :
[2]
switch (wn) ;
{
case 1 : System.out.print(” Geography”);
break;
case 2 : System.out.print(“Chemistry”) break;
Default : System.6ut.print(“Mathematics”);
}
(e) Rewrite the following code after debugging (underline the changes made) [2]
for (int f = 10 , f > 5 , f++ )
{
System.out.print( f +”………”);
}
Question 3.
(a) Differentiate between Entry controlled and Exit controlled loop. [2]
(b) Differentiate between data type int and data type double. [2]
(c) Differentiate between constructor and other methods of a class. [2]
(d) Write the following code by using while loop : [4]
for (k = 501; k <= 521; k = k+2 )
{
System.out.print (” % ” + k );
}
3.
(e) Write thefollowing code by using if .. else statement: [2]
P = ( g == 9.8) ? 0 : 1;
(f) Write the output of the following code : [4]
System.out.print(“The series is as follows – n” ); for( int k = 710; k > 660; k – = 10)
{
System.out.println ( “XX ” + (k – 10) );
}
(g) Write the output of the following code : [4]
double d = 100, c;
c = d;
while ( c > 20 )
{
System.out.println (“Value : : ” + c );
c – = 20;
}
Section-B
(Attempt Any Four)
Question 4.
It is puja season-and shopping season too ! You work as an employee at Small
Bazaar. The owner has asked you to create an application that would quickly
calculate a discount on the purchase, and also a gift. He hands you the following
table for you to implement in your code:
Purchase Amount (P in Rs.) Discount (D) Gift
P<1100 5 % of P A Wallet
P >= 1100 & P <5100 10 % Of P Wrist Watch
P >=5100 & P <10100 15% of P Wall Clock
P >=10100 20% of P Travel kit
Write a program that inputs the amount of purchase. Print the Amount Payable
and the gift that the customer should get. [15]
Question 5.
Teacher -“What is a Nest number ?” [15]
4.
Kabir- “A numberis said to be a ‘Nest Number’ if the number contains at least
one digit which is zero.”
Eg Input : 2008
Output : It is a Nest Number
Teacher-‘great job, Kabir ! Can you write a code to check for the same ?’
Assume that you are Kabir. Write a program to input a number and check if it is a
Nest number or not! [15]
Question 6.
Write a program to print the given series : [15]
3 6 12 24 48 96 …. up to n terms
Output
Enter the number of terms : 7 6 12 24 48 96 192 384
Question 7.
Write a program to input n and print the following pattern [ here n = 4] [15]
@ @ @ @
@ @ @
@ @
@
Question 8.
Imagine that you are a time keeper at the FI Grand Prix. You keep a record of the
time taken by a car to complete a lap in seconds. For easier data keeping, the
boss asks you to record the time in minutes and seconds. [15]
Write a code that takes time in seconds as input. Show the time in minutes and
seconds.
Time Taken in seconds: 5000
The time taken is 83 minutes and 20 seconds
Question 9.
Input a number and verify whether it is a Lead Number or not. A number is called
a Lead number if the sum of the even digits is equal to the sum of the odd digits.
For example, 1452. [15]
5.
ICSE Class 9Computer Applications
Sample Question Paper 2
Section – A
(Attempt all questions)
Question 1.
(a) Write two differences between Object Oriented Programming and Procedure
Oriented Programming.
(b) Define abstraction with an example.
(c) What is copyright and what is trademark ?
(d) What are Java Applets ?
(e) What are spams ?
Question 2.
(a) Write two differences between if else and switch-case constructs.
(b) Write two features of a constructor.
(c) What are increment and decrement operators ?
(d) What are comments? Give example.
(e) What is ternary operator?
Question 3.
Answer with respect to given code :
(a) The given code has some errors. Rewrite the code correctly and underline the
changes made
Switch (m)
{
case 8 : System.out.piint [88];
break;
default: System.out.print [100];
}
(b) Identify the error, if any, in the following code snippet:
for ( c ==25, c < 20 , c – -)
(c) Identify the error, if any, in the following code snippet:
for (q = = 1; q <= 100 ; q = = q + 10 )
6.
(d) What arethe components of a for loop ?
(e) What is the role of break statement in a loop ? Show a code example.
(f) Write the output of the following code :
int y = 6;
do
{
System.out.print( y++ + ” .. ” )
y++;
}
while ( y <= 12);
(g) Write the output of the following code :
for ( k = 100; k > 55; k= k – 5)
{
if ( k%2 = = 0)
{
continue ;
}
System.out.print(k + ” “);
}
Section – B
(Attempt Any four)
7.
Question 4.
Input anumber in K. Calculate the print the result of the following formulae :
W = (7*K + K2
) / 2
Question 5.
Input two numbers and find the max and min. Show the use of the ternary
operator.
Question 6.
Input a number and print the corresponding day of the week. Assume that a.
week begins with Sunday with day number being 1. Valid day numbers are from
1 to 7. Use switch..case operator.
Question 7.
Print the given series using a for loop.
10 2 30 4 50 6 … upto n terms
Output :
Enter number of terms : 10
10 2 30 4 50 6 70 8 90 10
Question 8.
Input a number of type integer. Calculate and print the product of its digits. Use
while loop.
Question 9.
Print the following pattern using nested for loop.
5
6 5
7 6 5
8 7 6 5
9 8 7 6 5
8.
ICSE Class 9Computer Applications
Sample Question Paper 3
Section – A
(Attempt all questions)
Question 1.
(a) Write two features of Java.
(b) Define polymorphism with an example.
(c) How are worms harmful ?
(d) What is the difference between = and = = ?
(e) Name the arithmetic operators used in Java. Which operator does a different
task in mathematics ? Explain in brief with example.
Question 2.
(a) Write a difference between entry controlled and exit controlled loop.
(b) What are the logical operators?
(c) What is a spam?
(d) What is phishing?
(e) Rewrite the following condition using ternary operators :
if ( a < 24 )
p = 12;
else
P = 48;
Question 3.
(a) What will be the output:
int K = 66, f = 2, g = 6 , rank = 1;
if ( K % f != 0 )( K %g != 0)
{
rank = 0;
}
System.out.print( ” Rank = ” + rank);
9.
(b) Rewrite usingdo. .while loop :
int Q = 7, K = 10;
while ( Q > 2)
{
K + = 2;
Q – -;
}
System.out.print(” Result = ” + K ) ;
(c) What will be the output of the given code , given that Pg = 16, Pr = 22
if (( Pg >= 10 &&Pr <= 20 )) (( Pg >= 20 &&Pr <= 10 ))
{
System.out.print (“Madagaskar”);
else
{
System.out.print (“Maldives”);
}
(d) What is the difference between Math.floor( ) and Math.ceil() ?
(e) Debug the following code and rewrite it correctly :
doublepr = ( b =! q ); 100 ? 250 :
(f) What is fall through ? Explain with an example.
(g) Write the output of the following code :
int W = 737, s = 0;
int cW = W;
while ( cW != 0 )
{
s = s + cW % 10;
System.out.println( ” S = ” + s );
cW = cW/10;
}
(h) Write the output of the following code :
int T = 9;
10.
for (int n= T; n > 6; n – – )
{
int V = T * n + n ;
System.out.println( “Value = ” + V );
}
Section – B
(Attempt Any Four)
Question 4.
Input a number in T. Calculate the print the result of the following formulae :
G = 4028 + T/4 + T2
+ 8*T
Question 5.
Calculate and print the value of W, by taking necessary inputs, given the
following :
W = ((M – 10) + (N – 5)) / P when P = 10
= ((M – 20) + (N – 10)) / (4*P) when P = 20
= ((M – 5) + (N – 15)) / (2*P) otherwise
Question 6.
Create a mini calculator. Enter two numbers (say a, b). Enter a choice (say ch).
Perform add, subtract, multiply and divide upon the value of choice being 1, 2, 3,
4.. Use switch..case operator.
Question 7.
Print the result of the given series using a for loop.
1 + (1/2) + (1/3) + (1/4) + … upto n terms
Question 8.
Input a number of type integer. Print its factors,
Question 9.
Print the following pattern using nested for loop :
12.
ICSE Class 9Computer Applications
Sample Question Paper 4
Section-A
(Attempt all questions)
Question 1.
(a) What is an object?
(b) Define encapsulation with an example.
(c) What do you mean by software ethics?
(d) What is hacking?
(e) What is software piracy?
Question 2.
(a) What is fall through?
(b) What are the various loop statements used in Java?
(c) Write the uses of break statement.
(d) What is netiquette? State two of them.
(e) Write two protective measures to safeguard your computer.
Question 3.
(a) What are keywords? Give example.
(b) Name two rules of naming an identifier.
(c) What are literals? Give example.
(d) What is type casting?
(e) What is special about the main( ) method?
(f) Given the initial value of a = 20, k = 15 in the following expression
k = k + a++ + ++a/2;
13.
Write the finalvalue in k and a.
(g) Rewrite the following using if ..else construct switch ( ko )
case 25 : System.out.print (“Yellow”);
break;
default: System.out.print (“Purple”);
(h) Rewrite the following using while loop
for ( m = 75; m >= 50 ; m = m - 10)
System.out.print( k + " " );
(i) What will be the output of the following code :
int pa = 600;
while ( pa <1000)
{
System.out.print( pa ++);
pa = pa + 100;
}
(j) What will be the output of the following code :
int N = 77, f = 0, status = 1;
for(f = 2; f <= N; f++)
{
( N % f == 0)
{
status = 0;
break;
}
}
System.out.print( ” Status = ” + status + ” at value of f = ” + f);
Section – B
(Attempt Any Four)
14.
Question 4.
In aschool picnic group, there were 22 students and 3 teachers. Each person had
to pay an amount of Rs 450 for food, Rs 225 for transport and Rs 175 for
entertainment. The organizers profit was 10% of the entire expenditure. Calculate
and print the entire expenditure and the profit of the organizer.
Question 5.
In a library, books were given to members for 10 days. Upon late return, they
were charged at a rate given below –
Days Late (D) Late Fine(F)
D <= 5 10
D > 5 and D <= 10 15
D > 10 30
Input the number of days a member is late in returning a book. Print the late fine.
Output
Enter number of days late : 12
Number of days late 12
Fine to pay = 30
₹
Question 6.
In a art workshop, different courses had different course code and course charge
per day, as given below
Course Code Course Name Course Charge (per day)
101 Stone Painting 160
102 Origami 125
201 Bag Painting 250
Input the course code( c) and number of days(d) a student wants to enroll.
Calculate and print the amount to be paid by a student. [Apply switch case
construct]
Output Enter the Course Code : 102 Enter the number of days of course : 15
Amount to pay = 1875.
₹
15.
Oswal 61 SampleQuestion Papers ICSE Class 9
Computer Applications Solutions
Section-A
Answer 1.
(i) (b) encapsulation
Explanation :
Encapsulation is the process of binding together data and methods of
objects / entities as one unit.
(ii) (b) An object
Explanation :
An object is an identifiable entity with a set of attributes, behaviour and
state.
(iii) (a) 4 bytes
Explanation :
The float data type in java is of 4 bytes.
(iv) (c) 4
Explanation :
4 + 8 % 2
4 + 0
⇒
4
⇒
Due to operator precedence 8 % 2 is evaluated first. Its result is 0 so final
result is 4.
(v) (c) Comment
Explanation :
/* … */ are used in Java to write multiline comments.
(vi) (c) pow( )
Explanation :
The pow() function returns the value of a number raised to an exponent.
(vii) (a) a compound statement
16.
Explanation :
If multiplestatements execute for a condition it is a compound statement.
(viii) (b) 0 times
Explanation :
The loop condition i>100 will never meet as i is getting decremented.
(ix) (d) All of these
Explanation :
A nested while loop can have any of the types of blocks if/for/switch etc.
(x) (a) Stealing jewellery
Explanation :
Stealing jewellery is not related to crime using network and electronic
media.
(xi) (a) Instructions only
Explanation :
As Procedure Oriented Programming follows Top-down approach so the
focus is on the steps or instructions to solve a problem.
(xii) (a) Objects
Explanation :
The objects of a class are the ones who can access and invoke the functions
of the class.
(xiii) (a) Keyword
Explanation :
While is a keyword in java that is used to create loops.
(xiv) (c) Ternary
Explanation :
The Ternary operator ?: takes more than two operands . It is also called as
conditional operator.
(xv) (c) Abstract Window Toolkit
Explanation :
AWT stands for Abstract Window Toolkit, it is used by applets to interact with
the user.
(xvi) (b) 98.0
Explanation :
17.
The Math.floor( )function returns the lower whole number value of a
fractional number.
(xvii) (b) Scalene triangle
Explanation :
Since the conditions imply all the three sides are unequal , the output must
be scalene triangle.
(xviii) (a) Never
Explanation :
The loop will not execute as the value of i starts with 10 and the loop
condition is i<10, which is never met.
(xix) (d) All iterations of outer loop
Explanation :
The inner loop iterates for all iterations of the outer loop.
(xx) (d) All of these
Explanation :
A FOSS is a software that can be freely used , copied and modified.
Answer 2.
(i) double pr = ( b != q ) ? 100 : 250;
(ii) Object Oriented Programming (OOP) is a programming paradigm which revolves
around the behaviour of an object, and its interactions with other objects and
classes. In OOP, the program is organised around data or objects rather than functions
or procedures. It follows the design principles of Data Abstraction,
Encapsulation, Inheritance, and Polymorphism.
(iii)
Attributes Behaviours
Manufacturer Start Computer
Model Shutdown Computer
Processor Run Applications
18.
Attributes Behaviours
RAM
Hard Disk
(iv)(a) i + c/b;
int + char / byte
int + char
⇒
int
⇒
(b) f/d + c*f;
float / double + char * float
⇒
double + float
⇒
double
⇒
(v) p = ++a + –a
p = 8 + 7
⇒
p = 15
⇒
q – = p
q = q – p
⇒
q = 0 – 15
⇒
q = –15
⇒
(vi) Scanner sc=new Scanner(System.in);
String n=sc.nextLine( );
String sn= sc.nextLine( );
String add= sc.nextLine( );
System.out.println(n+ “t” + sn);
System.out.println(“t”+add);
(vii)
Math.round() Math.abs()
1. Used to round a decimal fraction as per the rounding 1. Used to find the absolu
19.
Math.round() Math.abs()
rules. number.
2.Example Math.round(121.75), returns 122
2. Example Math.abs(– 121
121.75
(viii) if (c= =1 || c= =2)
x++;
else if (c= =3 || c= =4)
y++;
else
n++;
(ix) Below is the syntax of nested for loop:
for (<initial value>; <test condition>; <update value>)
{
for (<initial value>; <test condition>; <update value>)
{
executable statement(s)
}
}
(x) When we purchase an original software, we become the licensed user
and we get the right to use it. However, we cannot make copies of this
software and load it in other computers. Thus, when someone copies a
software without buying the appropriate license or copyright, it is known as
software piracy. Piracy can come in many forms:
1. Licensed user duplication for unlicensed users.
2. Illegal internet distribution.
Section-B
Answer 3.
W = ((M – 10) + (N – 5)) / P when P = 10
= ((M – 20) + (N – 10)) / (4*P) when P = 20
= ((M – 5) + (N – 15)) / (2*P) otherwise
20.
import java.util.*;
public classQ3
{
void main()
{
Scanner sc = new Scanner (System.in);
double M= 0.0, N = 0.0, W=0.0; int P=0;
System.out.println(“Enter Numbers M, N : ”);
M = sc.nextDouble();
N = sc.nextDouble();
System.out.println(“Enter Number P: ”);
P = sc.nextInt();
if ( P = =10 )
W = ((M – 10) + (N – 5)) / P;
else if ( P= =20 )
W = ((M – 20) + (N – 10)) / (4*P);
else
W= ((M – 5) + (N – 15)) / (2*P);
System.out.print(“ Value of W = “ + W );
}
}
Variable Description Table
Variable Name Data Type Use
M, N double Input variable
W double result
Answer 4.
import java.util.*;
public class arithmatic
{
public static void main(String [] args)
{
21.
int a,b,sum=0,sub=0,mul=0 ,mod=0;
doublediv=0.0;
Scanner sc=new Scanner(System.in);
System.out.println(“Enter 1st number :”);
a=sc.nextInt();
System.out.println(“Enter 2nd number :”);
b=sc.nextInt();
sum=a+b;
sub=a-b;
mul=a*b;
div=a/b;
mod=a%b;
System.out.println(“Sum :” + sum);
System.out.println(“Substraction :” + sub);
System.out.println(“Multiplication :” + mul);
System.out.println(“Division :” + div);
System.out.println(“Modulus :” + mod);
}
}
Answer 5.
import java.util.Scanner;
public class ProgBuzzAutomorphic
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.println(“1. Buzz number”);
System.out.println(“2. Automorphic number”);
System.out.print(“Enter your choice: “);
int choice = in.nextInt();
System.out.print(“Enter number: “);
int num = in.nextInt();
switch (choice)
{
case 1:
22.
if (num %10 = = 7 || num % 7 = = 0)
System.out.println(num + “ is a Buzz Number”);
else
System.out.println(num + “ is not a Buzz Number”);
break;
case 2:
int sq = num * num;
int d = 0;
int t = num;
while(t > 0)
{
d++;
t /= 10;
}
int ld = (int)(sq % Math.pow(10, d));
if (ld = = num)
System.out.println(num + “ is automorphic”);
else
System.out.println(num + “ is not automorphic”);
break;
default:
System.out.println(“Incorrect Choice”);
break;
}
}
}
Answer 6.
import java.util.Scanner;
public class ProgSpecialNumber
{
public static void main(String args[])
{
Scanner in = new Scanner(System.in);
System.out.print(“Enter a 2 digit number: “);
int orgNum = in.nextInt();
23.
if (orgNum <10 || orgNum > 99)
{
System.out.println(“Invalid input. Entered number is not a 2 digit number”);
System.exit(0);
}
int num = orgNum;
int digit1 = num % 10;
int digit2 = num / 10;
num /= 10;
int digitSum = digit1 + digit2;
int digitProduct = digit1 * digit2;
int grandSum = digitSum + digitProduct;
if (grandSum = = orgNum)
System.out.println(“Special 2-digit number”);
else
System.out.println(“Not a special 2-digit number”);
}
}
(v) (a) There would be no growth of mould on moist bread as mould could not grow in
lower temperature.
(b) Mycelia first appears on the bread.
(c) Bread mould obtain its nourishment by extracellular digestion from the substratum
on which it grows. This nourishment is called saprophytic mode of nutrition.
Answer 7.
import java.util.Scanner;
public class ProgMultipleHarshad
{
public static void main(String [ ] args)
{
Scanner in = new Scanner(System.in);
System.out.print(“Enter number to check:”);
int num = in.nextInt();
int dividend = num;
int divisor;
int count = 0;
for(dividend>1)
24.
{
divisor=0;
int t =dividend;
for(int t = 1 ; t>0 ; t++)
{
int d = t % 10;
divisor += d;
t /= 10;
}
if (dividend % divisor = = 0 && divisor != 1)
{
dividend = dividend / divisor;
count++;
}
else
{
break;
}
}
if (dividend = = 1 && count > 1)
System.out.println(num + “is Multiple Harshad Number”);
else
System.out.println(num + “is not Multiple Harshad Number”);
}
}
Answer 8.
import java.util.*;
public class Q8
{
void main()
{
Scanner sc = new Scanner (System.in);
int C = 0, D = 0 , T = 0;
System.out.print(“Enter the Course Code : ”);
C = sc.nextInt();
System.out.print(“Enter the number of days of course : ”);
25.
D = sc.nextInt();
switch( C)
{
case 101 : T = D * 160;
break;
case 102 : T = D * 125;
break;
case 201 : T = D * 250;
break;
default : T = 0;
System.out.print(“Sorry, no such course”);
}
System.out.print(“ Amount to pay = ` ” + T );
}
}
Variable Description Table
Variable Name Data Type Use
C int Input variable, number of days late
D int amount to pay as late fine
T int amount to pay as late fine
Output
Enter the Course Code : 102
Enter the number of days of course : 15
Amount to pay = ₹1875