ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

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.
Answer:
(a) Platform Independent: Java programs can be run on any platform that has Java Virtual Machine, such as Windows, Unix etc)
Robust: It performs extensive error checking and does not let the memory get hanged.

(b) It is the ability of methods to have same name but to behave differently under different situations. For example, a student can also be an artist and a musician.

(c) A worm is responsible for memory or disk crashes. Worms work by replicating itself on the disk and taking up memory space until eventually the disk crashes.
Example : I Love You, Morris, Sobig, Mydoom worm etc.

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

(d) = is the assignment symbol. It cannot have a literal on its left.
= = is the operator for comparison of equality. It can have variables/literals on both sides.

(e) + – * / %
% mod operator is-1 applied in calculation of percentage in mathematics.

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;
Answer:
(a) Two differences between entry controlled and exit controlled loop,
entry controlled : condition is verified before execution of loop body may not get executed even once for and while loops are entry controlled
exit controlled : condition is verified after execution of loop body gets executed at least once do while loop is entry controlled !

(b) ( NOT) && ( AND) || (OR)

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

(c) Spams are unwanted e-mails sent from unknown people. These are bulk e-mails that are sent to people generally for advertising, phishing etc. In some cases, spam may consume a lot of memory space.

(d) Phishing is the act of extracting important information from innocent users, by posing as someone reliable. Some websites carry out phishing by disguising themselves as any socially important website and then asking people to provide confidential information. This confidential information are later used for harmful purposes,

(e) p = ( a < 24) ? 12 : 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);
Answer:
Rank = 1

(b) Rewrite using do. .while loop :
int Q = 7, K = 10; while ( Q > 2)
K + = 2;
Q – -;
}
System.out.print(” Result = ” + K ) ;
Answer:

int Q = 7, K = 10;
do
{
K=K+2;
Q - -;
}
while (Q > 2);
System.out.print("Result = " +K);

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

(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”);
}
Answer:
Maldives

(d) What is the difference between Math.floor( ) and Math.ceil() ?
Answer:
Math.floor ( ) : The largest floating-point value that is smaller than the entered number.
Example Math.floor(2.26) = 2.0
Math.ceil ( ): The smallest floating-point value that is greater than the entered number.
Example Math.ceil( 6.38) = 7.0

(e) Debug the following code and rewrite it correctly :
doublepr = ( b =! q ); 100 ? 250 :
Answer:
double pr = ( b != q ) ? 100 : 250;

(f) What is fall through ? Explain with an example.
Answer:
Fall through is a situation that occurs in the switch case construct when the different cases are not terminated by the break statement. As a result of which all the cases occurring after the selected case gets executed until the first break statement is reached.
For example :
switch (k)
{
case 1 : System.out.print(“Blue”) ;
case 2 : System.out.println(“Green”) ;
case 3 : System.out.println(“Orange”) ;
break;
case 4 : System.out.println(“White”) ;
}
Output if k == 1
Blue
Green
Orange

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

(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;
}
Answer:
S = 7
S= 10
S= 17

(h) Write the output of the following code :
int T = 9;
for (int n = T; n > 6; n – – )
{
int V = T * n + n ;
System.out.println( “Value = ” + V );
}
Answer:
Value =90
Value = 80
Value =70

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
Answer:
Input a number in T. Calculate the print the result of the following formulae
G = 4028 + T/4 + T2 + 8*T

import java.util.*;
public class Q5
{
void main( )
{
Scanner sc = new Scanner (System.in);
double T= 0.0, G = 0.0;
System.out.print("Enter a number : ");
T = sc.nextDouble( );
G= 4028 +, (T/ 4)+(T*T)+(8*T);
System.out.print(" Value of T = " + T + " & Result G = " + G );
}

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

Variable Description Table

Variable Name Data type Use
T double Input variable
G double result

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
Answer:

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 import java.util.*; public class
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.nextlnt(); 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 );
}
}

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

Variable Description Table

Variable Name Data type Use
M, N double Input variables
W double result

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.
Answer:

import java.util.* ;
public class Q7
{
void main( )
{
Scanner sc = new Scanner (System.in) ;
int a = 0, b= 0, ch=0, r=0;
System.out.println("Enter 2 numbers : ");
a = sc.nextlnt( );
b= sc.nextlnt( );
System.out.println("Enter the choice : ");
ch = sc.nextlnt( );
switch (ch)
{
case 1 : r = a + b;
break;
case 2 : r= a - b;
break;
case 3 : r= a * b;
break;
case 4 : r = a / b;
break;
default : System.out.print("Wrong Choice");
}
System.out.println("Result: " + r ) ;
}
}

Variable Description Table

Variable Name Data type Use
a, b integer Input variables
c integer Input of choice
r integer to store result

Question 7.
Print the result of the given series using a for loop.
1 + (1/2) + (1/3) + (1/4) + … upto n terms
Answer:

import java.util.* ;
public class Q8
{
void main( )
{
Scanner sc - new Scanner (System.in) ;
int n = 0; double s = 1.0;
System.out.println("Enter number of terms : ") ;
n = sc.nextlnt( );
System.out.print("1 + ") ;
for (int i=2; i <= n-1; i++)
{
System.out. print(" (l/"+i+ ") +");
s = s + (1.0 / i);
}
s = s + (1.0/n);
System.out.print(" (1/" + n +") = " + s );
}

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

Variable Description Table

Variable Name Data type Use
n integer Input, total terms
s double to store sum
i integer loop counter

Question 8.
Input a number of type integer. Print its factors,
Answer:

import java.util.* ;
public class Q9
{
void main( )
{
Scanner sc = new Scanner (System.in);
{
int n = 0;
System.out.println("Enter a number : ");
n = sc.nextlnt( );
System.out.print("Its   factors  are:  1  ");
for(int f = 2 ; f <= (n/2); f ++)
{
if (n%f == 0)
System.out.print(" " + f ) ;
}
System.out.print('' " + n);
}
}

Variable Description Table

Variable Name Data type Use
n integer Input number
f integer loop counter

Question 9.
Print the following pattern using nested for loop :
ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers 1
Answer:

import java.util.* ;
public class Q10
{
void main( )
{
for (int r =1; r <= 5; r++)
{
for (int c =3; c <= 8 - r ; C++)
System.out.print( c+ " " );
System.out.println( ) ;
}
}
}

ICSE Class 9 Computer Applications Sample Question Paper 3 with Answers

Variable Description Table

Variable Name Data type Use
r int to store the row number
c int to store the column number

ICSE Class 9 Computer Applications Question Papers with Answers

Leave a Comment