ICSE Class 9 Computer Applications Sample Question Papers
ICSE Class 9 Computer Applications Sample Question Papers
General Instructions
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);
(b) Given the initial 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]
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:
Question 5.
Teacher -“What is a Nest number ?” [15]
Kabir- “A number is 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]
ICSE Class 9 Computer 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];
}
(e) What is the role of break statement in a loop ? Show a code example.
Section – B
(Attempt Any four)
Question 4.
Input a number 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
ICSE Class 9 Computer 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);
(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”);
}
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 :
ICSE Class 9 Computer 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?
Question 3.
(a) What are keywords? Give example.
Section – B
(Attempt Any Four)
Question 4.
In a school 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)
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.
Oswal 61 Sample Question 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 :
4+8%2
⇒4+0
⇒4
Due to operator precedence 8 % 2 is evaluated first. Its result is 0 so final result is 4.
Stealing jewellery is not related to crime using network and electronic media.
(xi) (a) Instructions only
Explanation :
The objects of a class are the ones who can access and invoke the functions of the class.
(xiii) (a) Keyword
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 :
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 :
Attributes Behaviours
RAM
Hard Disk
Math.round() Math.abs()
1. Used to round a decimal fraction as per the rounding rules. 1. Used to find the absolute va
W double result
Answer 4.
import java.util.*;
public class arithmatic
{
public static void main(String [] args)
{
int a,b,sum=0,sub=0,mul=0 ,mod=0;
double div=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:
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();
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)
{
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 : ”);
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
Output
Enter the Course Code : 102
Enter the number of days of course : 15
Amount to pay = ₹1875