0 ratings 0% found this document useful (0 votes) 4 views 8 pages Comp
The document outlines the ICSE First Term Examination for the academic year 2024-25 for the subject of Computer Science. It includes various questions related to object-oriented programming concepts, Java syntax, and programming exercises. Additionally, it features practical programming tasks and class definitions for different scenarios, such as calculating pizza costs and movie ratings.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here .
Available Formats
Download as PDF or read online on Scribd
Carousel Previous Carousel Next
. RYAN GROUP OF SCHOOLS
cl ACADEMIC YEAR 2024-25
ICSE, FIRST TERM EXAMINATION
‘ MARI
Ne
3 Wise
srp: X . KS:
suB: COMPUTER + DURATION:
SECTION A .
Question 1. (20)
ed in the
1. Which principle of object oriented programming language is depict
figure:
>
a. Encapsulation c. Inheritance
b, Polymorphism d, Abstraction
.. An object has ..
.a.‘Attributes . c. Behaviour
b. State d. Allof these
represents an entity in the real-world with its identity arid behaviour.
1. Aclass . : c. A procedure
. An-object d. A method
is a template to create similar objects that share common
aracteristics and behaviour. :
A method c. An attribute
\ procedure / ~ d. Aclasstype in Java?
P- ye
| Wriicé one of the following is te?
extyet o-x=1, ¥=0
baht 5 i dx, 1 -
1G. The sarement (I=)? 1: 0 evaluates to —...2..:-
= 20 : false
&t
~ EL. The statement S;
& te 33
bsx6
te, alia ik aesIcs
sib: X
agon (R) are true and Reason (R) is a correct
a, Botti Assertion (A) and Re
explanation of Assertion (A)
». Both Assertion (A) and Reason (R) are true and
correct explanation of Assertion(A)
Reason (R) is not a
¢. Assertion (A) is true and Reason (R) is false : i
d. Assertion (A) is false and Reason (R) is true
18. Which of the following statement is true for logical errors?
a The compiler does not detect these errors.
b, There is no indication of error when the program is executed.
c. The program may produce correct results for some input data and wrong
results for other input data. .
d. All of the above
19. Give the output of Math.ceil(-0.6).
a. 1.6 . c.-1.0
bes d.-0.0
-20; What will be the output of Math.pow(3, 0)?
. a, 00 & 0.3.0
B10 * #46
Question 2. "8s s ing
1. Write the j java expression for yoy
2. What i is ternary operator?
Explain with syntax,
3. Find the error in the given statement:
intx=(a=>b)? "a": "h :t _ ICSE 3 COMPUTER,
, ST
ertion: An object is an instance of a class
y Reasoning: When you create a class in Java using the new keyword, you are
creating an instance of an object With its own unique set of attributes.
a. Both Assertion (A) and Reason (R) are true and Reason (R) is a correct
explanation of Assertion (A)
b. Both Assertion (A) and Reason (R) are true and Reason (R) is not a
correct explanation of Asscrtion(A)
c. Assertion (A) is true and Reason (R) is false
4. Assertion (A) is false and Reason (R) is true
13. The method that changes the state of an object is known as .----.----
a. pure method . c. perfect method
b. impure method d. imperfect method
14, The technique in which the change in the formal parameter gets reflected in
the actual parameter is known a8 -..--+ .
a. call by reference c. call by argument
b. call by value d. call by method
15. A member method having the same name as {hat of the class is called ..........-
a. an alias c. a constructor
b. a friendly method d. a protected method
16. A default constructor has
a. no parameters c. two parameters
b. one parameter d. multiple parameters
17. Assertion; Abstraction is the process of exposing the implementation details
of an object.
Reasoning: Abstraction allows you to focus on what an object does rather than
how it does it. It helps in managing complexity.ICSE
x SSE 5 COMPUTER
convert the following while loop into for
loop.
Intm = 5, n= 10;
while (n>=1),
\
System.out.printin (m * n)
5, Write the syntax of new keyword and its use,
6, What are the features of Java?
7. Name Two types-of functions?”
8. Define function overloading.
9. Predict the output.
System.opu.print (“The factorial of 5 is);
System.out.print (:120);
10. What will be the value of 'n' after the execution of the code given below?
int x=2, m=1, c=];
intn=x +c;
n=n-c+x;
System.outprintin(n);
SECTION B
Answer any four questions from this section
Question 3, An Electric Shop has announced a special discount on the purchase
of Laptops ag given below: - ms : [1s] -COs,
instance Variables:
String pizzaSize — to store the size of the pizza (small, media, or barge)
int cheese — the number of cheese toppings
int pepperoni — the number of pepperoni toppings
int mushroom — the number of mushroom toppings
Member Methods:
Constructor — to initialise all the instance variables
CaleulateCost() — A public method that returns a double value, that is, the
cost of the pizza.
Pizza cost is calculated as follows:
Small: Z. 500 + 2. 25 per topping
Medium: 2. 650 +. 25 per topping
Large: 2. 800 + 2. 25 per topping
PizzaDescription() — A public method that returns a String containing the
pizza size, quantity of each topping, and the °
CalculateCosi(). Pizza cost 4s calculated by
Oates&
s1D:X ICSE fe lt |
sTD:X eS Soa i on LEPOP |
| Upto %.25,000/- tm |
| = %.50,000/-
%.25,001-% 10.0%
‘250,001 - z00.900-
{oo 15.0%
watson
Define a class Laptop described. =i
Data members /instance variables.
Name, price, dis, amt;
Member Methods:
1. A parameterized constructor to initialize the data members
2. To accept the details (nName & Price)
a To compute the discount.
4.To display the name, discount and amount to the paid after discount.
5. Write a main method to create’an object of class and call the functions
015]
Question 4. Write a program to print the pattem: °
2 ol
23 : 5
456 ;
78910
~ 411213 1415
Question 5. Write a program, to print series using function name series() to
overload a method. * (15)
g= tegen
S$ =2+4+6+.......40COMPUTER
> A x ICSE ~7-
: jon 6. Write a class wi .
estiol with the name Peri ‘ . loading
s that computes the following crimeter using function ove 115)
Perimeter of square = 4 + 5
Perimeter of rectangle = 2 + (+b)
Perimeter of Circle = 2 * ¢ *
Question 7. Define a class named MovieMagic with the following description: [15]
Instance variables/data members:
int year — to store the year of release of a movie.
String title — to-store the title of the movie
2 float tating — to store the popularity rating of the movie
(minimum rating=0.0 and maximum rating=5.0)
Member methods:
1. MovieMagic() Default constructor to initialize numeric datamembers to 0
- and String data member to “”.
2. void accept() To input and store year, title and rating. ©
3. void display() To display the title of a movie and a message based on the
rating as per the table below.
: nang | Noma
0.0102.0 | Flop
2.1 to 3.4 Semi-hit
3.5 to 4.5 Hit
: 4.6 to 5.0 Super Hit
Question 8. Create a class named Pizza that stores details about a pizza. It
should contain the following: [15]