0% found this document useful (0 votes)
183 views4 pages

ICSE Class 10 Computer Exam Paper

The document provides details about a mid-term examination for class 10 computer application students. It contains two sections - section A with multiple choice questions and section B requiring long answer questions to be solved as programs. Section A contains questions on Java concepts like strings, loops, methods etc. Section B requires programs on courier charge calculation, area of triangles, and checking if a number is Krishnamurthy.

Uploaded by

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

ICSE Class 10 Computer Exam Paper

The document provides details about a mid-term examination for class 10 computer application students. It contains two sections - section A with multiple choice questions and section B requiring long answer questions to be solved as programs. Section A contains questions on Java concepts like strings, loops, methods etc. Section B requires programs on courier charge calculation, area of triangles, and checking if a number is Krishnamurthy.

Uploaded by

shrutismitanaik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Florence Public School

R. T. Nagar, Bangalore
Mid Term Examination – October 2023
Sub: Computer Application
Class: X [ICSE]
Date: 13/10/23
Time Duration: 2 hours[9.30a.m to 11.30a.m.] Max Marks: 100
Answers to this paper must be written on the separate paper.
You will not be allowed to write during the first 15 minutes.
The time is to be spent in reading the question paper.
This paper is divided into two sections.
Attempt all questions from Section A and any four questions from Section B.

Section A [40 Marks]


(Attempt all questions from this section)
Question 1.
Four alternatives are given for each question. Choose the most appropriate answer: [20 x 1 = 20]

1. String is a ____________ datatype.


a. Primitive b. Composite c. Basic d. Both a and c
2. Assertion(A): The dangling else ambiguity can be resolved by using { }.
Reason(R): The ambiguity that arises due to less number of if compared to else in nested loop is called
as dangling else.
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
Assertion(A)
c. Assertion(A) is true and Reason(R) is false.
d. Assertion(A) is false and Reason(R) is true.
3. The index of the last character in a String is always -
a. 9 b. length() c. length() – 1 d. 10
4. The return type of endsWith() method is __________
a. int b. String c. boolean d. char
5. If a loop is executing for n times, the condition is checked for ________ times
a. n b. n-1 c. n+1 d. 10
6. The keyword used to execute the group of statements when none of the case constants matches in a
switch statement -
a. break b. case c. default d. else
7. Number of bytes reserved to store the String “Java is Fun” -
a. 22 bytes b. 11 bytes c. 9 bytes d. 18 bytes
8. Method that doesn’t has any return type is called as ___________
a. Constructor b. instance method c. static method d. void
9. Converting from an object of Wrapper class to Primitive datatype is __________
a. Autoboxing b. Unboxing c. Boxing d. Both a and c
10. The parameter passed to toUpperCase( ) method of Character wrapper class is __________
a. No parameter b. char c. String d. int
11. Method that doesn’t change the state of an object is called __________
a. Pure method b. Accessor c. Mutators d. Both a and b
12. Assertion(A): When any object is passed as parameters, it is called as call by reference
Reason(R): The values stored in the object of actual parameter is copied into formal parameter.
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
Assertion(A)
c. Assertion(A) is true and Reason(R) is false.
d. Assertion(A) is false and Reason(R) is true.
13. When any primitive data type values are passed as parameters, it is ______________
a. Call by value b. Call by reference
c. Can be call by value or reference d. None of the above
14. The method that has return type other than void should consist of ___________
a. calculation statement b. looping statement c. condition statement d. return
15. All the instance methods of a class should be declared __________
a. With the keyword static b. Without the keyword static
c. With or without static d. With keyword void
16. An example for empty loop is ___________
a. while(++a<=10); b. for(int i=1;i<=10;i++);
c. do{ }while(a++<=10; d. All of the above
17. The variables declared within a method are called as –
a. Local variables b. Instance variables c. class variables d. parameters
18. String method used to get part of a string is –
a. concat( ) b. length( ) c. substring( ) d. indexOf( )
19. Statement used to terminate the program –
a. break b. continue c. ; d. [Link](0)
20. “Hello”.compareTo(“Help”) returns –
a. 4 b. -4 c. false d. 2

Question 2
1. Write Java statements for the following [2]
a. To display the String s after removing the last word.
b. To display the first letter of the String s in capitals and rest of the letters in small letters

2. Write output for the following: [2]


a. [Link]([Link]([Link]([Link](-3.6)), [Link]([Link](-3.6))));
b. [Link]([Link]([Link](-4.4), [Link](-3.0));
3. Write output for the following:
String s= “Academic Year-2023-24”; [4]
a. [Link](([Link](3,6) + [Link](11,13)).toUpperCase( ));
b. [Link]([Link](“2024”));
c. [Link]([Link]([Link](14,16))+5));
d. [Link]([Link]([Link](8)));

4. Differentiate between Entry- controlled and Exit-controlled loop. [2]

5. Mention the output for the following code snippets: [4]


a. for(int i=1;i<5;i++)
{
for(int j=i;j>=1;j--)
[Link](j);
[Link]();
}
b. int a=10;
switch(a++)
{
case 10: [Link](a++);
case 11: [Link](++a); break;
case 12: [Link](a);
default: [Link](a-3);
}

6. Mention any 4 features of Constructor. [2]

7. Correct the errors if any in the following code. Also mention the type of error [2]
String s=”12345”;
for(int i=0;i<=5;i++)
[Link]([Link](i));

8. Name the built-in method and the class name to which it belongs, that is used to perform the following
a. To convert the String consisting of digits to double datatype.
b. To join 2 strings.

Section B [60 Marks]


(Answer any 4 questions – Each question carries 15 marks)
Each program should be written using variable description

Question 3 [15]
Define a class CourierService with the following descriptions:
class: CourierService
Instance Variables/ Data Members:
String name – To store the name of the customer
String type – To store the type of parcel (Ordinary/Express)
int weight – to store the weight of the parcel
double charge – to store the calculated charges
Member methods:
CourierService() – default constructor to initialize all the instance variables.
void accept() – To accept the name of the customer, type and weight of the parcel
void calculate() – To calculate the charges as per the following tariff:
Weight in Kgs Charge Charge
Ordinary Express
Upto 10 Rs. 800 Rs. 1500
11 – 20 Rs. 1500 Rs. 3000
Above 20 Rs. 4000 Rs. 5500

void print() – To display the details


Write a main method to create an object of the class and call the above member methods.

Question 4 [15]
Write a menu driven program to perform as given below:
√3 2
1. To find the area of equilateral triangle = (s ) where s= side of an equilateral triangle.
4
1
2. To find the area of isosceles triangle = 4 𝑏 ∗ √4𝑎2 − 𝑏 2
3. To find the area of scalene triangle = √s(s − a)(s − b)(s − c), where s= (a+b+c)/2

Question 5 [15]
A Krishnamurthy number is a number whose sum of factorial of digits is equal to the number.
Ex: 145 → 1!+4!+5! → 1+24+120 → 145
Write a program to input a number check and display whether it is a Krishnamurthy number or not.

Question 6 [15]
Create a class to overload the function palindrome( ) as follows:
1. boolean palindrome(int n) - checks and returns true if the number is palindrome else returns false
2. boolean palindrome(String s) – checks and returns true if the string is palindrome else returns false

Question 7 [15]
Write a program to input a String check and display whether it is a Unique word or not. A word is said to be
unique if the letters are not repeated in the string, i.e., all the letters are different
Ex: COMPUTER
Output: Unique Word

Question 8 [15]
Create a class to overload the function display as given below:
void display(int n) – displays all the even digits of the number
void display(int x, int n) – displays the series x, x4, x7, … n terms
void display(String s) – displays the pattern as given below
Ex: if s=”RACE”
Output: R
RA
RAC
RACE

Common questions

Powered by AI

Method overloading enhances functionality by allowing multiple methods with the same name but different parameters, improving code readability and organization. In Question 6, the class overloads the 'palindrome()' function for both integers and strings. The overloaded method for integers checks if a number is a palindrome by comparing it with its reverse, while the overload for strings checks if the reverse matches the original. This polymorphism allows the same logic to be applied across different data types using intuitive, single-method names, providing flexibility and consistency in use .

Index boundary errors occur when accessing elements beyond the valid range of an array or string indices, often leading to runtime exceptions as observed in code snippets dealing with methods like 'charAt'. Resolution involves validating access within bounds using conditions that ensure indices remain within accepted limits. Using error handling constructs like try-catch blocks can mitigate unexpected terminations, improving error resilience and enhancing program stability . Proper boundary checking logic before data access prevents many common exceptions in Java.

The 'display' method in Question 8 showcases flexibility by overloading the method to handle different input types and operations: displaying even digits, a mathematical series, or string pattern. This allows the function to be reused in various situations without duplicating method names, enhancing code reusability. For instance, the same method name 'display' can efficiently output numeric sequences or string manipulations based on specified logic, allowing developers to write cleaner and easily maintainable code .

Entry-controlled loops, such as for and while loops, evaluate the condition before executing the loop's body, ensuring zero iteration in case the condition is initially false. In contrast, exit-controlled loops, like the do-while loop, execute the loop's body at least once before evaluating the condition. A programmer might choose entry-controlled loops for scenarios where initial condition satisfaction is crucial, like iterating through arrays where bounds are predefined. Exit-controlled loops are preferable when ensuring at least one execution is necessary, such as collecting user input where initial values need to be processed .

The 'substring' method extracts a portion of a string from a starting index up to, but not including, an end index. Proper understanding of 0-based indexing is crucial for correct usage. Errors can occur when the indices are out of the string bounds, potentially throwing exceptions. Ensuring that the indices validate against the string's length will prevent runtime errors . Proper error handling contributes to robust code especially when user input determines indices.

The primary function of the default constructor in the CourierService class is to initialize all instance variables with default values. It differs from other types of constructors, such as parameterized constructors, which accept arguments to initialize the instance variables with specific values. The default constructor sets standard defaults and is automatically provided if no constructors are explicitly defined .

The 'calculate()' method in the CourierService class computes the parcel charges based on predefined tariffs depending on the parcel's weight and type. It uses conditional statements to determine the correct charge; for instance, if the parcel's weight is up to 10 kg, it assigns Rs. 800 for ordinary parcels and Rs. 1500 for express parcels. The method ensures accurate charge assignment according to the weight brackets and parcel type .

Krishnamurthy numbers are numbers where the sum of the factorial of each digit equals the number itself, as illustrated with 145 (1! + 4! + 5! = 145). A Java program to identify them would involve iterating through each digit of the number, calculating the factorial, and summing these factorial values. The program would then compare the sum to the original number to determine if they match, returning a result indicating a Krishnamurthy number .

Wrapper classes encapsulate Java primitives allowing objects to be treated as primitives, facilitating conversion processes like autoboxing and unboxing. Unboxing is converting an object of a Wrapper class back to a primitive type. An example is extracting an integer value from an Integer object, facilitating seamless data manipulation. The exam references autoboxing and unboxing as concepts crucial to optimal memory management and engagement with Java's Object-Oriented principles, particularly when interfacing collections that require objects .

Implementing a menu-driven program for calculating triangle areas, as in Question 4, provides user interactivity, allowing users to select computations easily. Benefits include enhanced user engagement and versatile functionality covering multiple cases in a single execution flow. Challenges may involve ensuring input validation, managing user navigation efficiently, and handling dependencies or exceptions when calculations involve advanced math operations. Effective structuring to prevent complex branching and maintaining user experience fluidity are crucial .

You might also like