SUB: COMPUTER FOR CLASS X MARKS:
100
PART I (40 marks)
Question
1 [2 X 5=10]
1. Define
encapsulation?
2. Explain
the term object with example?
3. Define identifier with example; mention 2 naming rules for identifier?
3. Define identifier with example; mention 2 naming rules for identifier?
4. What
are wrapper classes? Give 2 examples?
5. What
is the purpose of new keyword?
2. Write mathematical operations for corresponding expression? [2]
a. a2+b2
b. z=√(x2+y2-x/z)
3. Define recursive function? [2]
4. Identify keywords, identifiers, literals,&
comments from the [4]
following code
// example
class definition to demonstrate usage of ternary operator
public class
ternary{
public void
work(){
byte a=10;
int b=20,c;
c=(a>b)?a:b;
System.out.println(“value of c=”+c);}}
Question 3 [20]
1. Explain the term type casting? [2]
2. Explain what is the job of return key word? [2]
4. What is default constructor, and parameterized constructor? [2]
5. Differentiate between constructor and method [2]
6. Explain 4 OOP principles? [4]
7. Write
output of the following? [2]
a. if
x=7,y=2;
i.
x>>=y
ii.
x<<=--y;
System.out.println(“value
of x=”+x);
System.out.println(“value
of y=”+y);
8. Identify (class name, object name, constructor and parameter from
the following)
a. Calculator op=new Calculator(10,20); [2]
9. find the output of the following program [2]
a. int val=500,n=550;
int sum=(n+va)l>1750?400:200;
System.out.println(sum);
b. int val=1600,n=550;
int sum=(n+val)>1750?400:200;
System.out.println(sum);
PART II (60 marks)
Question 4 [15]
Write a program to solve 2 series as follows
using 2 different functions as mentioned
a.
double seires(int n) to solve the series [8]
S=a/1+a/2+a/3+a/4---------
a/n
b.
void series1(int n) to solve the series
0,3,8,15,24------
n [7]
Question
5 [15]
a.
Write an OOP for class volume which has
3 functions for finding volume of three shapes i.e. circle, rectangle, square,
this should be done using functions having parameters and no return type. [7]
b. Write
an OOP for class convert, using functions having both parameters & return
type. First function is for converting distance from CM to Feet and second
function is for converting KM to Miles. [8]
Question
6 [15]
Define a class student having the following
description
Data members
String name-> to store name
Int roll-> to store roll no.
Int p,c,b-> to store physics,
chemistry ,bio marks
Double s-> to store percentage
of science marks
Member function
void Input()-> to input details
of student
void Calculate()-> to calculate
percentage science & marks,
void Display()-> to display
name,rollno,percentage having message that the student is a ranker if the
percentage is >80
Question 7 [15]
Write a program that has a method
integerPower (base, exponent) that returns the value of base exponent
For example, integerPower (3, 4) calculates 34 (or 3 * 3 * 3 * 3). Assume that exponent is a positive, nonzero integer and that base is an integer. The method should use a for or while loop to control the calculation. Do not use any math-library methods.
For example, integerPower (3, 4) calculates 34 (or 3 * 3 * 3 * 3). Assume that exponent is a positive, nonzero integer and that base is an integer. The method should use a for or while loop to control the calculation. Do not use any math-library methods.
Question 8 [15]
A cloth show room has announced the following
festival discounts on purchase of items, based in the total cost of items
purchased
Purchase
|
Discount%
|
<Rs.2000
|
5%
|
Between Rs.2001 & 5000
|
25%
|
Between Rs.5001 & 10000
|
35%
|
Above Rs.10001
|
50%
|
Write a program to input total purchase,
compute and display the amount to be paid after availing discount. (use any
type of user define function)
Question 9 [15]
Write a program using Predefine Math
functions to find answers for the following.
1. Find
maximum number between two inputted numbers
2. Absolute
value of a given number
3. Square
root of a given number
4. Cube
of given number.
The above answers should be solved in a user
define function called Mathematics.
No comments:
Post a Comment