0% found this document useful (0 votes)
2 views

Computer Half Yearly Paper Solved

This document provides solutions for ICSE Computer Applications (Java) including objective questions, short answer questions, and programming problems. It covers various topics such as data types, control structures, and library methods, along with example code snippets. The solutions are aligned with ICSE standards and include explanations for each answer.

Uploaded by

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

Computer Half Yearly Paper Solved

This document provides solutions for ICSE Computer Applications (Java) including objective questions, short answer questions, and programming problems. It covers various topics such as data types, control structures, and library methods, along with example code snippets. The solutions are aligned with ICSE standards and include explanations for each answer.

Uploaded by

sauhriddyajitrc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

solve as per icse

## ICSE Computer Applications (Java) Solutions

Below are the answers and solutions for the questions visible in the provided
images, solved as per ICSE standards.

---

## **Section A: Objective Questions**

### **Fill in the Blanks and MCQs**

1. **An object has**

- **All of these** (attributes, state, behaviours) ✔️

2. **Which of the following is a reference data type?**

- **Arrays** ✔️

3. **The statement (1 > 0) || (1 < 0) evaluates to—**

- **true** ✔️

4. **______ operator allocates memory during run time of the program.**

- **new** ✔️

5. **Which Java package includes the Math class?**

- **java.lang** ✔️
6. **Give the output of Math.sqrt(x) when x = 9.0**

- **3.0** ✔️

7. **Which keyword do you use to include a package in your program?**

- **import** ✔️

8. **Errors occur in a program when—**

- **Syntax of the programming language is not followed** ✔️

9. **Assertion (A) and Reason (R) about Abstraction:**

- **Both Assertion (A) and Reason (R) are true and Reason (R) is a correct
explanation of Assertion (A)** ✔️

10. **Which of the following is mandatory in the switch statement?**

- **case** ✔️

11. **The statement (1 == 1) ? 1 : 0 evaluates to—**

- **1** ✔️

12. **Give the output of System.out.println(Math.ceil(10.6) +


Math.floor(2.4));**

- **13.0** ✔️

- Math.ceil(10.6) = 11.0, Math.floor(2.4) = 2.0, so 11.0 + 2.0 = 13.0

13. **Which component of Java is responsible for running Java bytecode?**

- **JVM** ✔️
14. **State the output of the following: (int)(7.9)**

- **7** ✔️

15. **What will be the output of the following code snippet?**

```java

if(false)

System.out.println("True");

else

System.out.println("False");

```

- **False** ✔️

16. **What does the following loop print?**

```java

for(int i=0; i<4; i++)

System.out.print(i + " ");

```

- **0 1 2 3** ✔️

---

## **Section B: Short Answer / Programming Questions**


### **Q2 (i): Write a Java expression for the following using Library
methods**

a) $$ x^3 - y^3 - 2xy $$

- `Math.pow(x,3) - Math.pow(y,3) - 2*x*y`

b) $$ \frac{\text{amount} \times \text{rate}}{(1+\text{rate})^n} $$

- `amount * rate / Math.pow(1 + rate, n)`

---

### **Q2 (ii): Rewrite using ternary operator**

Given:

```java

int size = 2;

if(size < 0)

System.out.println("Small");

else

System.out.println("Medium");

```

**Using ternary operator:**

```java

System.out.println(size < 0 ? "Small" : "Medium");

```

---
### **Q2 (iii): Evaluate the following expression when x = 4**

Expression: $$ x * -x + x++ + x $$

- Substitute $$ x = 4 $$:

- $$ x * -x = 4 * -4 = -16 $$

- $$ x++ = 4 $$ (then x becomes 5)

- Next $$ x = 5 $$

- So, total: $$ -16 + 4 + 5 = -7 $$

**Answer:** `-7`

---

### **Q2 (iv): Output of the following program segment**

```java

int sum = 0;

for(int k = 8; k <= 19; k += 3)

sum = sum + k;

System.out.println(sum);

```

- k = 8, 11, 14, 17

- sum = 8 + 11 + 14 + 17 = 50

**Output:** `50`
---

### **Q2 (v): Define a package. State the purpose of two Java packages.**

- **Definition:** A package in Java is a collection of related classes and


interfaces, providing access protection and name space management.

- **Purpose of two packages:**

- `java.util`: Contains utility classes like collections framework, date and


time facilities, etc.

- `java.lang`: Contains fundamental classes and is imported by default,


e.g., String, Math, System, etc.

---

### **Q2 (vi): Write valid statements for the following using Java library
methods**

a) Print the largest of 45 and -50

- `System.out.println(Math.max(45, -50));`

b) Print 10.5 raised to the power 4.0

- `System.out.println(Math.pow(10.5, 4.0));`

---

### **Q2 (vii): Identify and name the following tokens**


- `public` — Keyword

- `{` — Separator

- `==` — Operator

- `2` — Literal

---

### **Q2 (viii): Write the memory capacity (storage size) of the following
data types in bytes**

- float — 4 bytes

- short — 2 bytes

- char — 2 bytes

- byte — 1 byte

---

## **Section B: Programming Questions**

### **Q3: Program to check for perfect number using sum of factors**

```java

import java.util.Scanner;

public class PerfectNumber {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter a number: ");


int n = sc.nextInt();

int sum = 0;

for(int i = 1; i < n; i++) {

if(n % i == 0)

sum += i;

if(sum == n)

System.out.println(n + " is a perfect number.");

else

System.out.println(n + " is not a perfect number.");

```

---

### **Q4: Menu driven program for volume of solids**

```java

import java.util.Scanner;

public class VolumeCalculator {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println("1. Volume of Cuboid");

System.out.println("2. Volume of Cylinder");

System.out.println("3. Volume of Cone");

System.out.print("Enter your choice: ");


int choice = sc.nextInt();

double v = 0;

switch(choice) {

case 1:

System.out.print("Enter l, b, h: ");

double l = sc.nextDouble(), b = sc.nextDouble(), h =


sc.nextDouble();

v = l * b * h;

break;

case 2:

System.out.print("Enter r, h: ");

double r = sc.nextDouble();

h = sc.nextDouble();

v = Math.PI * r * r * h;

break;

case 3:

System.out.print("Enter r, h: ");

r = sc.nextDouble();

h = sc.nextDouble();

v = (1.0/3) * Math.PI * r * r * h;

break;

default:

System.out.println("Invalid choice!");

return;

System.out.println("Volume = " + v);

}
}

```

---

### **Q5: Class to print sum of series S = x¹ + x² + ... + x²⁰ where x = 2**

```java

public class SeriesSum {

public static void main(String[] args) {

int x = 2;

int sum = 0;

for(int i = 1; i <= 20; i++) {

sum += Math.pow(x, i);

System.out.println("Sum = " + sum);

```

---

### **Q6: Courier company charges calculation**

```java

import java.util.Scanner;

public class CourierCharges {


public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter weight (gm): ");

int wt = sc.nextInt();

System.out.print("Enter type of booking (O/E): ");

char type = sc.next().toUpperCase().charAt(0);

int charges = 0;

if(type == 'O') {

if(wt <= 100) charges = 100;

else if(wt <= 500) charges = 180;

else if(wt <= 1000) charges = 210;

else charges = 250;

} else if(type == 'E') {

if(wt <= 100) charges = 150;

else if(wt <= 500) charges = 200;

else if(wt <= 1000) charges = 250;

else charges = 300;

} else {

System.out.println("Invalid booking type.");

return;

System.out.println("Charges: Rs." + charges);

```

---
### **Q7: Print Fibonacci series up to n terms**

```java

import java.util.Scanner;

public class FibonacciSeries {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter number of terms: ");

int n = sc.nextInt();

int a = 0, b = 1;

System.out.print(a + " " + b + " ");

for(int i = 3; i <= n; i++) {

int c = a + b;

System.out.print(c + " ");

a = b;

b = c;

```

---

### **Q8: Accept a number, print sum of even and odd factors**

```java
import java.util.Scanner;

public class FactorSums {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.print("Enter a number: ");

int n = sc.nextInt();

int evenSum = 0, oddSum = 0;

for(int i = 1; i <= n; i++) {

if(n % i == 0) {

if(i % 2 == 0)

evenSum += i;

else

oddSum += i;

System.out.println("Sum of even factors = " + evenSum);

System.out.println("Sum of odd factors = " + oddSum);

```

---

These solutions are written as per ICSE Computer Applications (Java)


standards and cover both objective and programming questions from the
provided question paper images.
Citations:

[1] 20250522_175326.jpg
https://pplx-res.cloudinary.com/image/upload/v1748096260/user_uploads/
63724093/3483e8f6-2726-4d77-ba99-7b808d6736b3/20250522_175326.jpg

[2] 20250522_175350.jpg
https://pplx-res.cloudinary.com/image/upload/v1748096259/user_uploads/
63724093/a5fbdba6-931e-4d97-879c-442a6cb506b9/20250522_175350.jpg

[3] 20250522_175408.jpg
https://pplx-res.cloudinary.com/image/upload/v1748096259/user_uploads/
63724093/844c6a8e-635d-4dac-b859-6d7e9a65ff23/20250522_175408.jpg

[4] 20250522_175419.jpg
https://pplx-res.cloudinary.com/image/upload/v1748096259/user_uploads/
63724093/855bc2c5-e215-4c8c-bc13-8f7775b8d00d/20250522_175419.jpg

[5] Solutions for Class 10 ICSE Logix Kips Computer Applications with ...
https://www.knowledgeboat.com/learn/class-10-logix-icse-computer-
applications-java-bluej/content

[6] [PDF] ICSE BOARD EXAMINATION - Oswaal 360


https://www.oswaal360.com/pluginfile.php/10939/mod_folder/content/0/
Latest%20Board%20Papers%20Files/CISCE%20Class%2010/ICSE%20X
%20Computer%20Paper-2023.pdf

[7] [PDF] CONDITIONAL STATEMENT Program1.Write a program to input 2 ...


https://baibhavcomputer.com/wp-content/uploads/2021/07/PROGRAMS-ON-
CONDITIONAL-STATEMENT-IN-JAVA-converted-1.pdf

[8] [PDF] ICSE COMPUTER APPLICATION CLASS IX SOLVED PROGRAMS ...


https://baibhavcomputer.com/wp-content/uploads/2021/05/programs_input_c
lass9-converted.pdf

[9] Avichal solutions for Computer Applications [English] Class 10 ICSE ...
https://www.shaalaa.com/textbook-solutions/c/avichal-solutions-computer-
applications-english-class-10-icse-chapter-1.5-introduction-to-java_8232

[10] Sample Java Papers Solved - Bluej for ICSE - WordPress.com


https://bluejforicse.wordpress.com/keys/

[11] Java Number Programs (ICSE Classes 9 / 10) - KnowledgeBoat


https://www.knowledgeboat.com/studylist/number-programs-java-icse?
page=2
[12] ICSE Java Programs Class 9 and Class 10 - efaculty.in
https://www.efaculty.in/icse-java-programs-class-9-and-class-10/

[13] ICSE Class X Important java question and answer - The Bawal
https://thebawal.wordpress.com/study-material-2/icse-class-x-important-java-
question-and-answer/

[14] Free ICSE/ISC textbook solutions & question papers - KnowledgeBoat


https://www.knowledgeboat.com/solutions/icse

You might also like