pate: 06-08-2022
MADONNA SCHOOL, DARBHANGA
Class: X 1TermExamination(2022-2023) F.M:
80
Subject:C mputer Application Time:2 Hrs.
(SECTION A (30 MARKS)
Attempt all questions
AnSwer the following questions :
a Define Instance Variable. Give an example of the same. (2)
D)What is an Exception? Write the name of the exception handling blocks. (2)
) Explain the concept of constructor overloading with an example? (2)
d) Differenciate between call by value and call by reference. (2)
e) What are the differences between local variable and class variable ? Give
Suitable example (2)
2. Write the output of the following segments of program: (1 x05-05)
(a) if(a>0 && a<20)
at+;
else
a--
System.out.printin(a);
Assume a as 0 in the above program.
(bif ( a>b || a!=b)
cttat-b;
System.out.println(c+"++a++b);
Assume a-0 and b=0
(c) System.out.printin( (x+y)>x*2) ? xt+ : y)
Assume x=5 and y-3.
(d)System.outprint(" Income Tax-Rs.");
System.out.print( (income>10000)?10/100*income : 0);
Assume Income-25000
(e switch( num)
case5: numt+;
System.out.print(num);
case 6 System.out.print("* Six")
case 7 System.out.println(num)
case 0 System.out.println(" Zero ";
case -1: ++num;
num=2;
System.out.println(num);
break;
default System.out.print(" Case does not match ");
Assume num as 6.
Page 1 of 3 P.T.O.
3. Find errors in
the
(a) a? (a following
==b):b; program segments and write it
(bif x=1 30 correctly :(1xU
System.out.print(x);
'
else
(cswitch(a)
Case 0
att;
case 1:
break);
(d)char ch;
switch(ch)
Case A: m+= 5S;
case 2 :
break;
m - 2
default
(e) if ( 2x+5 =10 &&
System.out.print("Invalid" match");
x>0)
4. Answer the
following questions
(a) Name the package needed to
(6Write any two non-primitive perform input and output tasks. (2)
(CWrite the difference between datatype.
default and (2)
examples. parameterized constructor with
(d) What is a Wrapper class ?
e) Differentiate between Write the name of 5 (2)
Wrapper class.
public and private modifiers for members of a class.
(SECTION B (50 MARKS)]
Attempt all questions
5. a) Define a class called FoodWorld
with the following
Instance variables / data members description- (10)
vegName Name of the
vegQty vegetable bought
Quantity of the vegetable bought
vegPrice Price per unit of the
bill vegetable
total bill
Member methods:
FoodWorld) to initialize the data members
void display0 to display the details in the
Name
following format
Potatoess
Quantity 2 Kg
Price Rs. 12
Bill Rs. 24
Write a main method to create an object of the class and call the above members
methods.
Page 2 of 3 P.T.C
6. Defíne elass MovieMagic with the
a
Instance variables / data members : following description: (10)
int year
to store the year of release of a
String title to store
movie
Float rating the title of the movie
to store the popularity
Member Methods rating of the movie
MovieMagic) default constructor to initialize
void accept0 data members
to input and store year, title and rating.
void display0
rating as
to
display the title of a movie and a message based on the
per the table below.
Rating Message to be displayed
0.0 to 2.0
Flop
2.1 to 3.4 Semi-hit
3.5 to 4.5 Hit
4.6 to 5.0
Super-Hit
Write a main method to create an
object of the class and call the above members
methods.
7. Design a class to overload a
function num_ calc as follows:
(a) void num_calc(int num,char ch) which (10)
computes the square of integer
arguments if ch is 's' otherwise finds cube
(b) void num_calc(int a, int b,char ch) which
computes the product of integer
arguments if ch is 'p' otherwise finds the sum
8. Write a program to calculate and print the of the
sum following series:
1- . 20! 5)
3 T
1+2+3 1+2+3+4
1+2t.. +1) (5)
9. Write a program to print the following pattern-
(a)
121
(5)
12321
1234321
123454321 (5)
(b) @
@S
@S@
@s@S
@s@s@