0% found this document useful (0 votes)
71 views

Raymond Memorial Higher Secondary School

This document contains instructions for a Computer Application exam with 2 sections and 9 questions total. Section A is compulsory and contains 5 questions worth 2 marks each. Section B contains 4 questions to choose from, each worth 15 marks. The questions cover topics like wrapper classes, operators, loops, strings, arrays, and classes related to triangles and billing. Students are given 2 hours to complete the exam.

Uploaded by

Nita Bhadra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

Raymond Memorial Higher Secondary School

This document contains instructions for a Computer Application exam with 2 sections and 9 questions total. Section A is compulsory and contains 5 questions worth 2 marks each. Section B contains 4 questions to choose from, each worth 15 marks. The questions cover topics like wrapper classes, operators, loops, strings, arrays, and classes related to triangles and billing. Students are given 2 hours to complete the exam.

Uploaded by

Nita Bhadra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Raymond Memorial Higher Secondary School

Preliminary Examination 2018

********************************************************
Class – X Total marks- 100

Subject- Computer Application Time- 2 Hours

********************************************************
<Candidates are allowed additional 15 minutes for only reading the paper.
They must NOT start writing during this time. >

Answer all the questions from the Section A (compulsory) and four questions
from Section B.

The intended marks for questions are given in brackets []

Section - A (Compulsory) [40 Marks]

Question no 1. [5x2=10]

i) Name any two wrapper classes.


ii) Name the operators listed below [2]
a) < b) ++ c) && d) ?:
iii) State the number of bytes occupied by char and int data types.
iv) What is jump statement ?
v) State one similarity and one difference between while and for loop.
Question no 2. [5x2=10]

Write the output –

i) Write an expression for

ii) The following is a segment of a program.

x = 1; y = 1;
if(n > 0)
{
x = x + 1;
y = y - 1;
}
What will be the value of x and y, if n assumes a value (i) 1 (ii) 0?

iii) Give the output of the following string functions :


(a) “MISSISSIPPI”.indexOf(‘S’) + “MISSISSIPPI”.lastIndexOf(‘I’)
(b) “CABLE”.compareTo(“CADET”)

iv) Give the output of the following Math functions:


(a) Math.ceil(4.2)
(b) Math.abs(-4)

v) Convert the following while loop to the corresponding for loop :


int m = 5, n = 10;
while (n>=1)
{
System.out.println(m*n);
n–-;
}

Question no 3. [10x2=20]

i) Give the output of the following expression :


a+=a++ + ++a + -–a + a-– ; when a = 7

ii) Write the return type of the following library functions : [2]
(i) isLetterOrDigit(char)
(ii) replace(char,char)
iii) Give the output of the following program segment:
double x = 2.9, y = 2.5;
System.out.println(Math.min(Math.floor(x), y));
System.out.println(Math.max(Math.ceil(x), y));

iv) State the output of the following program segment.


String s = "Examination";
int n = s.length();
System.out.println(s.startsWith(s.substring(5, n)));
System.out.println(s.charAt(2) == s.charAt(6));

v) Rewrite the following program segment using while instead of for statement
int f = 1, i;
for (i = 1; i <= 5; i++) {
f *= i;
System.out.println(f);
}

vi) Analyse the following program segment and determine how many times the loop will be
executed and what will be the output of the program segment ?
int p = 200;
while(true)
{
if (p<100)
break;
p=p-20;
}
System.out.println(p);

vii) Analyse the following program segment and determine how many times tne
loop will be executed and what will be the output of the program segment.
int k=3, i=4;
while (++i<9)
k*=i;
System.out.println(k);

viii) Give the output of the following program segment and also mention the number of times
the loop is executed:
int a,b;
for(a=6,b=4;a<=24;a=a+6)
{
if(a%b==0)
break;
}
System.out.println(a);

ix) Write the output for the following:


String s= "Today is Test";
System.out.println(s.indexOf('T'));
System.out.println(s.substring(0,7)+ " "+ "Holiday");
x) Analyze the given program segment and answer the following questions
for(int i=3;i<=4;i++)
{
for(int j=2;j<i;j++)
{
System.out.print(" ");
}
System.out.println("WIN");
}

a) How many times does the inner loop execute ?


b) Write the output of the program segment.

Section - B (Any Four)


(Marks – 15x4=60)

Question no 4.

Define a class Electric Bill with the following specifications: [15]


class: ElectricBill

Instance Variable/ data member:


String n – to store the name of the customer
int units – to store the number of units consumed
double bill – to store the amount to paid

Member methods:
Void accept() – to accept the name of the customer and number of units consumed

Void calculate() – to calculate the bill as per the following tariff :

Number of units — Rate per unit


First 100 units — Rs.2.00
Next 200 units — Rs.3.00
Above 300 units — Rs.5.00
A surcharge of 2.5% charged if the number of units consumed is above 300 units.
Void print() – To print the details as follows :
Name of the customer ………
Number of units consumed ……
Bill amount …….
Write a main method to create an object of the class and call the above member
methods.
Question no 5.

Write a program in JAVA to check whether a number is Special Number.

A number is said to be special number when the sum of factorial of its digits is
equal to

the number itself.

Example- 145 is a Special Number as 1!+4!+5!=145.

Question no 6.

Write a program to accept a string. Convert the string to uppercase. Count and output

the number of double letter sequences that exist in the string.

Sample Input: “SHE WAS FEEDING THE LITTLE RABBIT WITH AN APPLE
Sample Output: 4

Question no 7.

Write a program to input and sort the weight of ten people. Sort and display them in
descending order using the selection sort technique. [15]

Question no 8.

Design a class to overload a function area() as follows:


(i) double area(double a. double b, double e) with three double arguments, returns the
area of a scalene triangle using the formula:

where

(ii) double area(int a, int b, int height) with three integer arguments, returns the area of
a trapezium using the formula:

(iii) double area(double diagonal1, double diagonal2) with two double arguments,
returns
the area of a rhombus using the formula:

Question no 9.

Write a program to take 10 names in a single dimensional array. Display only those
names which begin with a vowel and also ends with a vowel.

Sample Input : Eshita, Monalisha, Daniel, India ………………..


Sample Output : Eshita
India

***************************************************************************
***************************************************************************

You might also like