Sample paper 6 for ICSE computer Application
SUB: COMPUTER FOR CLASS X MARKS: 100
__________________________________________________________________
This paper is divided into two sections.
You are to answer all the questions from section A, and any four from section
B.
Section
A(40 marks)
Attempt
all questions
Question
1. [2X5=10]
a.What is
function overloading? Explain with example.
b. Name
the primitive data type in Java that is:
1.A 64 bit
integer used when you need a range of values wider than those provided by int.
2.A single
16-bit Unicode character whose default value is ‘\u0000’.
c. Define Polymorphism.
d. double
b=-65.3;
double a= Math.rint(Math.abs(b));
System.out.println(" a = "+ a);
e.
What is the difference between a static member
functions & function which are not static?
Question 2. [2X5=10]
a. Write
statements for the following
1.
To create an object of class Teacher with default
constructor.
2.
To invoke a method of class Teacher i.e Make_Result(int
x)
b. What is
the difference between a constant and a variable?
c. What is a
package? Give name of any two packages.
d. What do
you mean by type conversion? How is implicit conversion different fromexplicit
conversion?
e. State the
difference between while loop and do while loop.
Question
3. [2X5=10]
a.
What will be the
output when the following
code
segments
are executed?
1. String s=”1001”;
i.
Int x=Integer.valueOf(s);
double y=Double.valueOf(s); System.out.println(“x=”+x); System.out.println(“y=”+y);
2. System.out.println(“The king said \”
Begin at the beginning ! \” to
me.”);
b. Consider the following
code.
Public class
Student
{
Public static int
x=3,y=4;
Public int
a=2,b=3;
}
1.
Name the variables for which
each object
of the class
will
have
its
own distinct copy.
2.
Name the variables that are common to all objects
of the class.
c.
In
the program given below, state the name and value of the
1.
Method
argument or argument variable
2. class variable
3.
local
variable
4.
instance
variable
class myClass
{ static int x= 7; int y=2;
public static void main(String args[])
{
myClassobj = new myClass();
System.out.println(x);
obj.sampleMethod(5);
int a=6;
System.out.println(a);
}
void sampleMethod(int n)
{ System.out.println(n);
System.out.println(y);
}
}
d. What will be the result stored in
x after evaluating the following expression?
int x=12;
x+=(x++) + 4 + ( --x);
e. Give one example each of a primitive data type and a composite data
type.
Question 4. [2X5=10]
a) Whatisthedatatypereturnedbythelibraryfunctions:
1. compareTo()
2. equals()
b) Write the Java expressions for:
A2 + B3
c)
1. Name the package
that
contains
Scanner class.
2. Which unit of
the
class gets called,
when
the
object of
the
class is
created?
d) What is the role
of keyword void
in declaring functions?
e)
What is a token? Name any two of them.
Section
B
Attempt
any 4 questions from this section. Each program should be written using a
variable list so that the logic of the program is clearlydepicted.
Question
5.
a.
Write a class fact which takes integer number
and check whether it is Automorphic number or not.
An
automorphic number is the number which is contained in the last digit(s) of its
square.
Example 25 is an automorphic number as its
square is 625 and 25 is present as thelast two digits. [ 7 ]
b.
Create a class to take an integer number and check
if it is a palindrome number of not.
A palindrome number is a number when reversed
also the number remains the same.
Example: 121 is a palindrome number. [ 8 ]
Question
6. [15]
Define
a class student as described
below:
Datamembers/instancevariables:
Name,age,m1,
m2,m3
(marks in 3 subjects), maximum, average
Membermethods:
i) A parameterized constructor
to initialize the data
members
ii) To
accept the details of a student.
iii) To
compute
the
average
and the maximum out
of three
marks
iv) To
display
the name, age,
marks
in three subjects,
maximum
and average.
Question 7. [15]
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.
Example :
INPUT
Enter String :
SNOWY
OUTPUT
Total
number of characters
: O5
Number
of Vowels : 01
Reverse
string : YWONS
Question 8. [15]
Design a
class to overload a function polygon( ) as follows:
i) void
polygon(int n, char ch) with one integer argument and one character type
argument that draws a filled square of side n using the character stored in ch.
ii) void
polygon(int x, int y) with two integer
arguments that draws a filled rectangle of length x and breadth y, using the
symbol @
iii)
void polygon() with no argument that draws a filled triangle below.
Example
:
i)
Input value of n=2. Ch=’O’
Output:
OO
OO
ii)
Input value of x=2, y=5
Output:
@@@@@
@@@@@
iii)
Output:
*
**
***
Question
9. [15]
Write a
menu driven program to find the sum of the following series depending on the
user choosing
1 or 2
1.
S=1/4+1/8+1/12.........+1/n (value of n will be given by the user)
2. S=1/x1+2/x2+3/x3.......+n/xn(value
of x and n will be given by the user)
Question 10. [15]
No comments:
Post a Comment