Anda di halaman 1dari 3

COMPUTER APPLICATIONS

X – ICSE [2010]
General Instructions

1. This paper is divided into two Sections.


2. Attempt all questions from Section A and any four questions from Section B.
3. The intended marks for questions or parts of questions are given in brackets [ ].

SECTION A (40 Marks)


Attempt all questions.

Question 1 [5 * 2 = 10]

(a) Name any two OOP'S principles.


(b) Explain the term object using an example and state the two kinds of data
types.
(c) What is the purpose of the new operator?
(d) What is the output of the following?
char = 'A';
short m = 26;
int n = c + m;
System.out.println(n);
(e) What is a class and how it is declared? Write the difference between Class and
Object.

Question 2 [5 * 2 = 10]

a) Write the equivalent switch case statement for the following decision making
situation.

If(x==’1’ || x==’3’)
a=1;
if(x==’5’) a=2;
if(x==’7’) a=3
else a=10;

b) Write the output of following statements:


switch(num)
{
case 5: num++; System.out.println(num);
case 6: System.out.println(“SIX”);
case 7: System.out.println(num);
case 0: num++; System.out.println(“ZERO”+num); break;
case -1: num++; num*=2; System.out.println(num);
default :System.out.println(“Case is not matching”); }

i. assume num as -1
ii. assume num as 6
c) Differentiate between if and switch statements.
d) Explain the meaning of break and continue statements.
e) Explain, with the help of an example, the purpose of default in a switch statement.

Question 3 [20]

a) What do the following functions return for [4]


String x = "hello";
String y = "world";

i. System.out.prinln(x+y);
ii. System.out.println(x.length());
iii. System.out.println(x.charAt(3));
iv. System.out.println(x.equals(y));

b) Differentiate between [4]


(i) toLowerCase() and toUpperCase() methods.
(ii) compareTo( ) and equals( ) methods.

c) What is the difference between throw and throws? [2]

d) What is dangling if problem? [2]

e) Write the Output of the following: (Any 4) [4]

i. math.ciel(-28.25)
ii. math.rint(38.96)
iii. Math.floor ( 144.99)
iv. Math.abs ( 3489.45)
v. Math.max ( Math.min (15, 25), 5)
vi. ( int ) (“scholar”.charAt(2))
vii. “TuTOrIAl”.indexOf(‘l’)
viii. “MISSISSIPPI”.lastindexOf(‘S’)
ix. “kumarvivek”.substring( 3, 4)
x. Math.sqrt(100);

f) Write a note on packages? [2]


g) Write a note on String class with example? [2]
SECTlON - B (60 Marks)
Attempt any four questions from this section.

1) Write a program to input any given string to calculate the total number of
characters and vowels present in the string and also reverse the string: - [15]

Example : INPUT
Enter String : SNOWY
OUTPUT
Total number of characters : 05
Number of Vowels : 01
Reverse string : YWONS

2) Write a program to print the sum of negative numbers, sum of positive even
numbers and sum of positive odd numbers from a list of numbers(N) entered by the
user. The list terminates when the user enters a zero. [15]

3) Write an application that inputs a line of text and output the text twice – once in all
upper case and once in all lower case letters.

4) Write a program for following specification:[15]

Class name – student


Data members :
Name , Hindi marks, English marks, maths marks, computer marks, average, grade.
Member methods:
Student( ) : constructor to initialize data members.
void accept( ) : to accept name and marks in 3 subjects given.
void calcavg( ): to calculate and store the grade according to following slab:
Average marks Grade
>=90 A++
>=75 - <90 A
>=60 – 75 B
<60 C

5) A boy enters a string in which he repeats few alphabets accidentally. Now write a
program by taking that string as input to remove repeated alphabets from the string.
Then display both original and newly formed string on the screen.(15)

Anda mungkin juga menyukai