Computer Questions for (IX-X) ICSE students.

**
St. Vincent’s Convent SchoolComputer Questions for Std. IX and X Students
:**

**Your are most
wel-come to give suggestions , Questions and any queries regarding IX and X
computer Courses
:-
plz mail to:**

**Part -
I**

**I. Answer the
following questions. [10]**

1. Write the use of the function while(). Give one example.

2. Write the function of for loop. Give one example.

3. Explain the use of conditional operator with the help of an example.

4. Why the if( ) statement is known as a conditional control statement? Explain your answer with the help of an example.

5. Why do……while( ) statement is known as “Enter looping” statement? Explain your answer with the help of an example.**II. Fill in the blanks.
[10]**

1. ----------- symbol is used as unsigned right shift operator.

2. & is used for -------------------------- .

3. ------------------ Symbol is used for bit wise XOR.

4. The symbol , (comma) is used as ------------------------- .

5.
<< symbol is used as --------------------------- .

6. If int a = 23 and b = 7 then the value of a % b is --------------.

6. -------------- is the symbol for ternary operator .

7. If int a =
5 , int b = 2 and int c = a / b . then value of c is ----------------.

8. If x =
3 and x = (++ x) + (x++) then value of x after evaluation is -------- .

9. If a =
34 , b =
23 and int k = (34 > 23)? a : b ; then value of k is ------.

10. The symbol ( ~ ) is used for --------------------- .

Part –II**III. Write a programme for each
of the following. [20]**

1. Write a program to print numbers from 10 to 50 and their average.

2. Write a program to print the factorial of a number.

3. Write a program to print the sum of all even and odd numbers separately from 1 to 5.

4. Write a program to print the HCF and LCM of any two numbers.**IV. Find the out put of the following methods.
[10]**

a.
public void display( )

{ int a= 2, b =3;

for(int i =
1 ; i < =10 ; i=i+3)

{

a= a –
b;b=
b – c ; c = c + a;

System.out.println(a+” “+b+” “+c);

}

}

b.
public void disp()

{
int a = 1, b = 2 , c = 1,x = 1;

while(x
< = 4)

{

System.out.println(a+” “+b+” “+c);

x=x+1;

}

}

**I. Answer the following questions. [10]**

1. What is JVM ?

2. Why byte code is known as magic code?

3. Define a class variable.

4. What is inheritance and what is its use?

5. How real world objects are implemented in software?**II. Fill in the blanks.
[10]**

1. After the source code is compiled ----------- code is formed.

2. Information passed in to the method is known as ------------ .

3. The number or numeric variable used with a common variable to store a new element in an array is known as

---------------------.

4. ------------------ is the range of integer (int type) literal .

5. In System.out.println() , out is a --------------- .

6. ---------- is the appropriate data type to store the number 10,950 .

7. In scientific notation, the exponent part can be positive or negative but must not be ---------------------- .

8. --------------- key word is used to allocate memory to the instance variables.

9. In java a single character constant occupies 2 bytes of memory because the characters are from

----------------------- set.

10. ---------------- Variables never have private or public access specifier.

Part –II**
III. Write a programme for each of the following. [20]**
1. Write a program to print the sum of the elements of rows and columns separately with the elements of a 4x4 matrix.

2. Write a program to print all the elements present after the leading diagonal including the elements of the diagonal in a triangular form, of a matrix of order n x n.

1. a = ++ a + a++ + ++ a ; what is the value of ‘a’ after evolution of the expression if Initial value of a is 1.

2. int a = 2, x = 1;while (a < 12){ a=a+2; x= x+1;} what is the value of x ?

3. String s = “YEAR-2003” . How much memory spaces occupied by the variable s.

4. char[] ar={‘a’,’b’,’c’,’d’} . What is the value of ar[ar.length - 2] ?

5. char c = 65+5; What is the value of c?

6. public void display(int[4][5] a) ; Re-write the statement correctly, if it is wrong.

7. An array a of order 4x5 is having 20 elements, what is the value of a.length.

8. boolean [] {true,false,true,true}; if the statement is wrong then write it correctly other wise write the statement as it is.

9. int [][]a={{2,3,4},{5,6},{7,8,9}} ; What is the value of a[1][1] ?

10. String s= “Happy Diwali”; s is --------------------- .

**
Find the output of
the following programme:**

**Assignment
–VII**

1. public class operator

{
public void disp()

> { int a =
10,b = 20, c= 90,d=19;

>
System.out.println(“a is “+ a);

System.out.println(“b is “+ b);

System.out.println(“c is “+ c);

System.out.println(“d is “+ d);

System.out.println(“Now
is a < b” (a< b));

System.out.println(“Now
is a > b” (a> b));

System.out.println(“Now is a = b” (a= = b));

System.out.println(“Now
is a < = b” (a< =b));

System.out.println(“Now
is a < =a+c b” (a<=a+c));

System.out.println(“Now is d !=c” (a! = c));

}

}

2. public class output2

{

public void disp2()

{

int a = 10,a= 20;

System.out.println(“a is “+ a++);

System.out.println(“b is “+ b++);

System.out.println(“Now a is “+ a);

System.out.println(“Now a is “+ b);

System.out.println(“Now a is “+(++ a));

System.out.println(“Now a is “+ (++b));

}

}

3. public class output3

{

public void disp3()

{

int x=5,y = 6;

System.out.println(“x= “+ x);

System.out.println(“y= “+ y);

System.out.println(“x & y = “+ (x & y));

System.out.println(“x |y = “+ (x | y));

System.out.println(“x ^ y = “+ (x ^ y));

}

}

4. public class output4

{

public void disp4()

{

float x = 23.5
F, y =
7.3F;

System.out.println(“x = “+ x );

System.out.println(“y = “+ y );

System.out.println(“x+y = “+ (x+y) );

System.out.println(“x - y = “+ x - y );

System.out.println(“x * y = “+ x * y);

System.out.println(“x / y = “+ x / y);

System.out.println(“x % y = “+ x % y);

}

}**5. Find the out put of the
following Expressions .**

i. float a =
5/3; Ans : 1.0

ii. int a = 5/3; Ans : 1

iii. float d = 8 % 3; Ans : 2.0

iv. int k = 20, l = 10 Ans :73

j = ++k + 2 * k + l ++ ;

v. int j = 22 , p = 3;

p = p* ++ j; Ans :69

vi. if int j = 5 , then solve (5* ++j) % 6; Ans :0

vii. if int j = 5 , then solve (5* j++) % 6; Ans :1

viii. What if the result of the following expressions

a.
age > 65 ? 350 : 100 ; if age = 25 Ans :100

b.
age > 65 ? 350 : 100 ; if age = 65 Ans : 100

c.
age > 65 ? 350 : 100 ; if age = 85 Ans : 350

d.
age > 65 ? 350 : 100 ; if age = 100 Ans :350**
6. Write an equivalent java expression for the following expressions :**
i. ut + ½ a t 2

ii. sin a + tan -1 a – e 2x

iii. | a | + b > | b| + a

iv. ((3x + 5y)/(5x + 3y) – (8xy /2yx)) 3/2 v. e | 2 x + 4x|

1. a is 10

b is 20

c is 90

d is –19

Now
is a < b true

Now is b< c true

Now is a = b false

Now
is b < = a+c true

Now is d !=c true

2. a is 10

>
b is 20

Now a is 11

Now b is 20

Now a is 12

Now b is 22

3. x = 5

y = 6

x & y = 4

x | y = 7

x ^ y = 3

4. x = 23.5

y = 7.3

x +y = 30.8

x – y = 16.2

x * y = 171.55

x/y = 3.21918

x% y = 1.6**5. . Find the out put of the following Expressions .
**
ix. float a = 5/3; Ans : 1.0

x. int a = 5/3; Ans : 1

xi. float d = 8 % 3; Ans : 2.0

xii. int k = 20, l = 10 Ans :73

j = ++k + 2 * k + l ++ ;

xiii. int j = 22 , p = 3;

p = p* ++ j; Ans :69

xiv. if int j = 5 , then solve (5* ++j) % 6; Ans :0

xv. if int j = 5 , then solve (5* j++) % 6; Ans :1

xvi. What if the result of the following expressions

a. age > 65 ? 350 : 100 ; if age = 25 Ans :100

b. age > 65 ? 350 : 100 ; if age = 65 Ans : 100

c. age > 65 ? 350 : 100 ; if age = 85 Ans : 350

d. age > 65 ? 350 : 100 ; if age = 100 Ans :350

**
ICSE MODEL TEST – 2005-2006**

Question 1. [10]

a. What are two forms of floating literals?

b. Name the IDE used to run java programs.

c. Define a default constructor for the class named DISK to initialize its private data member’s diameter and space as 5.25” and 1.2 MB.

d. Write the storage space reserved for all kinds of primitive data types.

e. What is function signature? Support your answer with an example.

Question 2. [10]

a. char p[]={‘a’,’B’,’Z’,’z’};

int y = p[2]%3;

char a = (char)(y+65);

System.out.println(a);

b.System.out.println((x+y>2*x)?x++:y);

(ifx=5,y=3)

c. int m= ++a - --a + b -- -2*b/a;

System.out.println(m+” “+a);

(if a= 4 and b=2.0)

d. System.out.println((101011)&(110011));

e. I=1;for(;i<5;I++){ }System.out.println(++ i );

ii. Explain the function overloading, with an example.

b. Write the output of the following segments of program. [2]

i. int ar[][]={{0,1,2),{3,4,5},{6,7,8}}};

for(inti=0;i<3;i++)

{

for(intj=2;j>=0;j--)

{

System.out.print(ar[i][j]);

}

System.out.println();

}

ii. String a[]={“Bhubaneswar”,”cuttack”,”Rourkela}; [2]

a. What is the range of indices for array a?

b. What is the result of a[1].length?

c. i. What is a jump statement ?What are the different jump statements in java. [2]

ii. a. --------- is an example of composit data type. [2]

b. A switch statement can handle floating point tests(T/F)

iii. Differentiate between static variable and instance variables. [2]

iv. Write a code to print all the uppercase letters using do-while loop. [2]

v. Find the errors and correct them. [2x2]

i. int a = 10;b=20; a+b=c;System.out.println( c );

ii. char ch;

switch ( ch)

{ case A:a+=2;break;

case 2:b- = 2;

default:System.out.println(“Invalid choice”);

}

Attempt any four questions from this section

Each programme should be written using variables description /mnemonic codes, such that the logic of the program is clearly depicted.

Question 4.

The annual examination result of 60 students of a class 10 B of St. Vincent school is tabulated as follows:

Roll No Comp. Application English Mathematics

ii. Highest marks in each subjects and the roll number of the student, who obtained it.

iii. Highest total marks and the roll number of the student who obtained it.

Write a programme to read the following text as

“YOU WILL GO TO SCHOOL AND I SHALL GO HOME”

Convert all characters of the words in lowercase other than the first character so as to obtain the following output.

“You Will go To School And I Shall Go Home”

Write a programme that reads in a sentence, and prints it out with each word reversed , but with the words and punctuations in the original order

Example : if input is – men is mortal

Output is – nem si latrom.

Question 7.

Define class Employee with:

Data member: code, name, designation, basic, hra, da, pf

Default constructor: initializes code, basic,hra,da,pf to zero and name to null

Parameterized constructor: initializes code, name, basic and computes hra, da, pf as per the following criteria.

Hra= 30% of basic

Da= 70 % of basic

Pf = 10% of(basic+hra+da)

Main method:computes and display the net salary and display all data members.

Net salary = (basic + hra +da) – pf

Question 8:

Pal prime numbers are the palindrome prime numbers. I.e prime numbers that are palindrome also. Write a programe, which accept any number and check and print whether the number is pal prime or not.

i. Arrange the elements in ascending order.

ii. Calculate the mean of the minimum and the maximum elements.

iii. Calculate the sum of all the odd elements.

(Theory 40marks)**
Questions 1:**
a. Define encapsulation.

b. Explain the term object using an example.

c. Define variable.

d. Hat is wrapper class? Give one example?

e. Hat is the purpose of “new” operator?

a. State two kind of data types.

b. Write the corresponding expressions for the following mathematical operations:-

i. A2+b2

iii. z = x3 + y3 - xy/z

iv. Define an pure function.

v. Differentiate between if and switch statement.

vi. What will be the output for the following programme segment ?

String s = new String(“abc”);

Sytem.out.println(s.toUpperCase());

a. What is meant by private visibility of a method?

b. Find and correct the errors in the following programme segments.

Int n[] ={2,4,6,8,10};

For(int I = 0;I<=5;I++)

System.out.println(“n[“+I+”]=”+n[I]);

c. Explain function overloading with example.

d. Find the output of the following programme segments.

i. val = 500;

ii. val = 1600;

int val,sum,n =550;

sum = n+val >1750?400:200;

e. What is default constructor?

i. int a= 0,b = 30,c= 40;

a=a—b+c+ + + b;

System.out.println(“a=”+a);

g. Difference between compaerTo() and equals() method.

h. What is a package?Give example.

i. Explain the function of return statement..

Attempt any four questions from this section.

Each programme should be written using variables description /mnemonic codes, such that the logic of the program is clearly depicted.

Write a programme to calculate and print the sum of odd numbers and the sum of even numbers for the first n natural numbers.

the integer n is to be entered by the user.

A cloth show room has announced the following festival discounts on the purchase of items, based on the total cost of the items purchased :-

Total Cost Discount(in percentage) Less than Rs. 2000 5%

Rs. 2001 to Rs. 5000 25%

Rs. 5001 to Rs. 10000 35%

Above 10000 50%

Write a programme to inpute total cost and to compute and display the amount to be paid by the customer after availing the discount.

Consider the following statement:

“January 26 is celebrated as the Republic day of India”

Write a program to change 26 to 15 , January to August, Republic to Independence and finally print “August 15 is celebrated as the Independence day of India”

Write a program that outputs the result of the following evaluations based to the number entered by the user.

j. Natural logarithm of the number.

k. Absolute value of the number.

l. Square root of the number.

m. Random number between 0 and 1.

The marks obtained by 50 students in a subject are tabulated as follows:-

Name marks

Write a programme to input names and marks of the students in the subject.

Calculate and display :-

i. The subject average marks.

ii. The highest mark in the subject and the name of the student.

(the maximum marks in the subjects are 100)

Write a program to accept 15 integers from the key board, assuming that no integer entered is

zero. Perform selection sort on the integer and then print them in ascending

order.

**I. Answer the following
Questions:**

1. Define a class for Dates. Add required functions , constructor to initialize the date. Month and year and to print the date after validating the date.

2. Sita and Gita wants a program to take order from the Internet. The program will ask hat item the user wants,

ill ask its price, and will ask if the user wants overnight shopping. Regular shopping for items under Rs. 5000 /- is Rs. 100/-; for items

Rs. 5000 /- or more is Rs. 150 /- . For overnight delivery add Rs. 250 /-.**
3. Write a program to Input a four digit number for year and check whether the year ** is a leap year or not?( the year must be divisible by 100 and 400).

4. Write a program to print a list of 60 students in ascending order of their roll number(use bubble sort method).

X=5; y =50;

While(x<=y){x=y/x}

6.intm=10;n=7;

while(m%n>=0){m=m+1;n=n+2}

for(;m+n<19;++m)

System.out.println(“Hello \n”);

M=m+10;

8. while(ctr !=10);

{ctr=1;sum=sum+a;ctr=ctr+1;}

9.for(a=1,a>10,a=a+1){……}

10. s= 12>>2 +

**II. Write a program for the
followings.**

1. Write a program to print the greatest even number out of any 20 numbers.

2. Write a program to print the greatest prime number out of any 50 numbers.

3. Write a program to print all the integers from 1 to n divisible by m and

also print whether the number is even or odd.

4. Write menu driven a program to find whether a given number is odd or even or prime.

The program should continue as long as the user wants.

5. Write a program to sum the sequence –> 1+ 1/1! + ½! + 1/3! + ….. +1/n!

6. Write a java program to print the cosine series:

Cos(x) = 1 – x2 /2! + x4/4! - x6/6! + …… X n /n!

7. Write a programme to print the largest even and odd number out of a list of n numbers.

8. Write a programme to accept the age of n employees and count the number

of persons in the following age group. i. 26-35 ii. 36-45 iii. 46-55.

9. Write a programme to store name of the students in four different arrays

separately comes from four different regions. Consider n students.

10. Write a programme to print the largest even and odd number

out of a list of some numbers entered through the key board.

The list
terminates as soon as one enters zero.

**Part -
II**

** In
next update...**

Your are most wel-come to give
suggestions , Questions and any
queries regarding IX and X computer Courses :-

plz mail to: **manoj.maharana08@gmail.com
**