- Class 10 Java Program
- ICSE Java Programs - Home
- Year 2025 Programs
- Short Questions/Answers
- Class & Object Based Program - CloudStorage
- Square root of sum of squares of all elements - NORM
- Super String Program
- Binary Search Program
- Menu Driven Program
- Check Sum Program
- Solved Specimen Question Paper Year 2025 Programs
- Short Questions/Answers
- Class & Object Based Program - Bank
- Binary Search Program
- String to Uppercase Program
- Sum of Row in Array Program
- SUPERSPY Program
- Menu Driven Program - Overload Method
- Year 2024 Programs
- Short Questions/Answers
- Class & Object Based Program - Courier Service Program
- Method Overloading Program
- EvenPal Program
- Diagonal Array Program
- Selection Sort Program
- Gmail ID Validation Program
- Solved Specimen Question Paper Year 2024 Programs
- Short Questions/Answers
- Class & Object Based Program - Eshop
- Selection Sort Program
- Count the Vowels Program
- Sum of Even & Odd Elements in Array Program
- Duck Number Program
- Method Overloading Program
- Year 2023 Programs
- Short Questions/Answers
- Class & Object Based Program - Student Stream Allocation
- Bubble Sort Program
- Menu Driven Program - Overload Method
- Print Number of Digits, Alphabets and Special Characters Program
- Linear Search Program
- Sum of Single and Double Digit Number in Array Program
- Year 2021 Programs
- Short Questions/Answers
- Class & Object Based Program - Hotel Bill Calculation
- Bubble Sort Program
- Menu Driven Program - Overload Method
- Method Overloading - Pattern & Series
- EvenPal Program
- Student Range Program
- Year 2020 Programs
- Short Questions/Answers
- Class & Object Based Program - Cab Service
- Binary Search Technique Program
- UpperCase Conversion Program
- Method Overloading
- Menu Driven Program - Pattern & Series
- Double Dimensional Array - Diagonal Sum
- Solved Specimen Question Paper Year 2020
- Short Questions/Answers
- Class & Object Based Program
- Arrange Student details using Selection Sort Method
- Class Overload Program
- Menu Driven Program
- Sum of elements in Double Dimensional Array Program
- Pair of Vowels Program
- Year 2019 Programs
- Short Questions/Answers
- Class & Object Based Program
- Menu Driven Program - Generate Unicode, Pattern
- Sort Array Elements in Ascending Order using the Bubble Sort Technique Program
- Series Overload Program
- Count Letters in a Sentence Program
- Tech Number Program
- Year 2018 Programs
- Short Questions/Answers
- Class & Object Based Program - Railway Ticket
- Pronic Number
- Proper Case Sentence Program
- Function Overloading - Volume Program
- Menu Driven Program - Pattern
- Deviation Program
- Year 2017 Programs
- Short Questions/Answers
- Class & Object Based Program - Electric Bill
- Spy Number Program
- Menu Driven Program - Series Program
- Array Based Program - Largest Number, Smallest Number, Sum of Numbers Program
- Function Overload - String Program
- Alphabet Sort - Selection Sort Techniques Program
- Solved Specimen Question Paper Year 2017 Programs
- Short Questions/Answers
- Class & Object Based - Taxi Meter Program
- Menu driven - Sum of Series Program
- Abbreviation Program
- Largest & Smallest Integer in Array Program
- Sum of Prime Numbers Program
- Sort Names in Array Program
- Year 2016 Programs
- Short Questions/Answers
- Class & Object - Book Fair Program
- Menu Driven - Pattern Program
- Palindrome or Special Word Program
- Function Overloading - Sum of Series Program
- Niven Number Program
- Two Different Arrays Program
- Year 2015 Programs
- Short Questions/Answers
- Class & Object - Parking Lot Program
- Pattern Program
- Array Based Student Result Program
- Function Overloading String Based Program
- Arrange Names - Bubble Sort Technique Program
- Menu Driven - Factors/Factorial Program
- Year 2014 Programs
- Short Questions/Answers
- Class & Object - Movie Magic Program
- Special Two-digit Number Program
- Assign Full Path and File name Program
- Function Overloading - Area Program
- Menu Driven - Bank Deposit Program
- Array Sort - Binary Search Program
- Year 2013 Programs
- Short Questions/Answers
- Class & Object - FruitJuice Program
- International Standard Book Number (ISBN) Program
- Piglatin Program
- Descending Order Bubble Sort Program
- Function Overloading - Sum of Series Program
- Menu Driven - Composite Number / Smallest digit in Number Program
- Year 2012 Programs
- Short Questions/Answers
- Class & Object - Library Program
- Income Tax Calculation Program
- Double Letter Sequences in a String Program
- Function Overloading - Polygon Program
- Menu Driven - Fibonacci / Sum of Digits Program
- STD (Subscriber Trunk Dialing) Codes Program
- Year 2011 Programs
- Short Questions/Answers
- Class & Object - Mobike Program
- Descending Order - Selection Sort Program
- Special Number Program
- New Word by replacing Vowels with the next Character Program
- Function Overloading - Compare Integers, Characters, Strings Program
- Menu Driven - Series Program
- Year 2010 Programs
- Short Questions/Answers
- Binary Search Program
- Class & Object - Student Marks Program
- Ticket Discount Program
- Menu Driven - Prime Number / Automorphic Number Program
- Combine Two Arrays in Third Array Program
- Frequency of Characters in a String Program
- Year 2009 Programs
- Short Questions/Answers
- Electronic Shop Discount Program
- Generate Triangle / Inverted Triangle Program
- Longest Word Program
- Function Overloading - Number Calculation Program
- Menu driven - BUZZ Number / GCD Program
- Exam Results Program
- Year 2008 Programs
- Short Questions/Answers
- Tax Computation Program
- Reverse Uppercase & Lowercase in String Program
- Sort String Bubble Sort Program
- Menu Driven - Palindrome / Perfect Number Program
- Function Overloading - Volume Program
- Sum of Series Program
- Year 2007 Programs
- Short Questions/Answers
- Salary Calculation Program
- Sum of Series Program
- Maximum & Minimum Program
- Count of a word in String Program
- Menu Driven - Temperature Program
- Palindrome Program
Java Programs - Solved 2012 ICSE Computer Science Paper
![]() Share with a Friend |
Solved 2012 ICSE Computer Science Paper
Class 10 - ICSE Computer Science Solved Papers
Short Questions/Answers - ICSE 2012 Computer Science
(a) Give one example each of a primitive data type and a composite data type.
Primitive data type: int
Composite data type: array
(b) Give one point of difference between unary and binary operators.
Unary operators act on one operand.
Binary operators act on two operands.
(c) Differentiate between call by value or pass by value and call by reference or pass by reference.
In call by value, a copy of the actual parameters are passed as arguments.
In call by reference, original actual parameters are passed as arguments.
(d) Write a Java expression for √(2as + u2).
Math.sqrt(2 * a * s + u * u)
(e) Name the type of error (syntax, runtime or logical error) in each case given below:
(i) Division by a variable that contains a value of zero.
Runtime error.
(ii) Multiplication operator used when the operation should be division.
Logical error.
(iii) Missing semicolon.
Syntax error.
Question 2
(a) Create a class with one integer instance variable. Initialize the variable using:
(i) default constructor
(ii) parameterized constructorclass Number{
int num;
public Number(){
num = 0;
}
public Number(int n){
num = n;
}
}
(b) Complete the code below to create an object of Scanner class:Scanner sc = ____ Scanner(__________);
Scanner sc = new Scanner(System.in);
(c) What is an array? Write a statement to declare an integer array of 10 elements.
An array is one of the composite data types that stores a collection of elements of the same type in contiguous memory locations.int a[] = new int[10];
(d) Name the search or sort algorithm that:
(i) Makes several passes through the array, selecting the next smallest item in the array each time and placing it where it belongs in the array.
Exchange Selection Sort Algorithm.
(ii) At each stage, compares the sought key value with the key value of the middle element of the array.
Binary Search Algorithm.
(e) Differentiate between public and private modifiers for members of a class.
The public modifier makes the members accessible from anywhere.
The private modifier makes the members accessible only from within the class.
Question 3
(a) What are the values of x and y when the following statements are executed?int a = 63, b = 36;
boolean x = (a > b)? true : false;
int y = (a < b)? a : b;
x = true
y = 36
(b) State the values of n and ch.char c = \'A\';
int n = c + 1;
char ch = (char)n;
n = 66
ch = ‘B’
(c) What will be the result stored in x after evaluating the following expression?int x = 4;
x += (x++) + (++x) + x;
x = x + x++ + ++x + x;
x = 4 + 4 + 6 + 6;
x = 20
(d) Give output of the following program segment:double x = 2.9, y = 2.5;
System.out.println(Math.min(Math.floor(x), y));
System.out.println(Math.max(Math.ceil(x), y));
2.0
3.0
(e) State the output of the following program segment:String s = "Examination";
int n = s.length();
System.out.println(s.startsWith(s.substring(5, n)));
System.out.println(s.charAt(2) == s.charAt(6));
nation
true
(i) Converts a string to a primitive float data type.Float.parseFloat()
(ii) Determines if the specified character is an uppercase character.Character.isUpperCase()
(g) State the data type and values of a and b after the following segment is executed:String s1 = "Computer", s2 = "Applications"
a = (s1.compareTo(s2));
b = (s1.equals(s2));
Data type of a is int, and value is 2.
Data type of b is boolean, and value is false.
(h) What will the following code output:String s = "malayalam";
System.out.println(s.indexOf(\'m\'));
System.out.println(s.lastIndexOf(\'m\'));
0
8
(i) Rewrite the following program segment using while instead of for statement.int f = 1, i;
for(i = 1; i <= 5; i++){
f *= i;
System.out.println(f);
}int f = 1, i = 1;
while(i <= 5){
f *= i;
System.out.println(f);
i++;
}
(j) In the program given below, state the name and the value of the:
(i) method argument or argument variable
(ii) class variable
(iii) local variableclass MyClass{
static int x = 7;
int y = 2;
public static void main(String args[]){
MyClass obj = new MyClass();
System.out.println(x);
obj.sampleMethod(5);
int a = 6;
System.out.println(a);
}
void sampleMethod(int n){
System.out.println(n);
System.out.println(y);
}
}
Method argument is n, and its value is 5.
Class variable is x, and its value is 7.
Local variable is a, and its value is 6.
