ICSE Class 10 Computer Applications - Chapter 1: Fundamentals of Java
Chapter 1: Fundamentals of Java
Key Concepts:
- Java is an object-oriented, high-level programming language.
- It uses classes, objects, and methods for programming.
- The structure of a Java program includes: class definition, main method, statements inside main().
Important Keywords:
- class, public, static, void, main, System.out.println()
Data Types in Java:
- int: integer type (e.g., 5, -10)
- double: decimal numbers (e.g., 4.5, -3.14)
- char: single character (e.g., 'A')
- boolean: true/false
Operators:
- Arithmetic: +, -, *, /, %
- Relational: ==, !=, <, >, <=, >=
- Logical: &&, ||, !
Sample Questions and Answers:
1. What is the use of 'main' method in Java?
-> It is the entry point of every Java application.
2. Define a variable. Give an example.
-> A variable is a named memory location. Example: int x = 10;
3. What is the output of the following code?
int a = 5; int b = 10;
System.out.println(a + b);
ICSE Class 10 Computer Applications - Chapter 1: Fundamentals of Java
-> Output: 15
4. Write a Java program to check if a number is even or odd.
int num = 7;
if(num % 2 == 0)
System.out.println("Even");
else
System.out.println("Odd");
5. Write a program to swap two numbers without using a third variable.
int a = 5, b = 10;
a = a + b;
b = a - b;
a = a - b;
Board Pattern-Based Program:
Write a program to find the sum of digits of a 3-digit number.
int num = 123, sum = 0;
while(num > 0) {
int digit = num % 10;
sum += digit;
num /= 10;
System.out.println("Sum = " + sum);
Output-Based Question:
int x = 4;
System.out.println(++x + x++);
-> Output: 5 + 5 = 10 (x becomes 6 after execution)
This chapter focuses on understanding the core building blocks of Java programs and how basic constructs
work.