0% found this document useful (0 votes)
88 views2 pages

ICSE Class 10 Java Program Questions

The document lists 50 Java programming questions suitable for ICSE Class 10 Computer Applications, categorized into four main sections: Array Programs, Number-Based Programs, Pattern Printing, and String & Wrapper-Related Programs. Each section contains common programming tasks such as searching, sorting, and manipulating data structures. Additionally, it includes object-oriented programming concepts and methods, emphasizing practical coding skills.

Uploaded by

contactrudranil
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)
88 views2 pages

ICSE Class 10 Java Program Questions

The document lists 50 Java programming questions suitable for ICSE Class 10 Computer Applications, categorized into four main sections: Array Programs, Number-Based Programs, Pattern Printing, and String & Wrapper-Related Programs. Each section contains common programming tasks such as searching, sorting, and manipulating data structures. Additionally, it includes object-oriented programming concepts and methods, emphasizing practical coding skills.

Uploaded by

contactrudranil
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

ICSE Class 10 - Computer Applications

Last 50 Java Program Questions (Without Answers)

Array Programs

1. Binary search in a sorted integer array (common)


2. Linear search in string array, print position or "not found" (common)
3. Find maximum element in integer array
4. Find minimum in integer array
5. Reverse an integer array (common)
6. Sum of all elements in the array
7. Count even and odd elements in array
8. Merge two arrays into a third
9. Copy elements from one array to another
10. Sort array in ascending (bubble sort)
11. Remove duplicate elements from an array
12. Split array into two halves

Number-Based Programs

1. Check if a number is a palindrome (common)


2. Check if a number is EvenPal (palindrome & even sum of digits)
3. List divisors of n (user input) (common)
4. Check if a number is prime
5. Find factorial of n (common)
6. Print Fibonacci series up to n terms (common)
7. Calculate sum of digits of n
8. Reverse digits of a number
9. Count number of digits in n
10. Check if a number is armstrong

Pattern Printing

1. Print star pyramid of size n (common)


2. Number pyramid with increasing numbers
3. Pascal's triangle up to n rows
4. Floyd's triangle up to n rows
5. Diamond star pattern
6. Square or rectangle star border
7. Right-angled number triangle
8. Hollow triangle of stars

String & Wrapper-Related Programs

1. Compare two strings using compareTo() (common)


2. Concatenate two strings (common)
3. Find first/last index of a character in string
4. Count vowels and consonants in string
5. Check if string is palindrome (common)
6. Convert string to uppercase/lowercase
7. Convert numeric string to number ([Link]) (common)
8. Use wrapper methods: parse integer, toString etc.
9. Check if string starts with or ends with a given substring
10. Count occurrences of a substring/character

OOP & Methods

1. Write a method to find greater of two numbers


2. Method for checking prime number
3. Method to reverse a string
4. Method to compute sums / factorial / palindrome
5. Parameterized constructor in a class
6. Default constructor + display method
7. Demonstrate call-by-value vs reference
8. Define a class with data members and methods (e.g. Bank Account)
9. Overload a method (same name, different params)
10. Use static method for utility function (e.g., max/min)

Common questions

Powered by AI

Pascal's Triangle is a triangular array where each number is the sum of the two numbers directly above it. To print Pascal's Triangle up to n rows, start with a single '1' at the top. For each subsequent row, begin and end with '1', then calculate the intermediate values by summing the values from the previous row. This continues until n rows are printed.

In Java, all arguments are passed by value, meaning a copy of the argument is passed to the method. However, for objects, this effectively looks like call-by-reference since the reference to the object is passed by value, allowing modification of the object's data. For instance, modifying an ArrayList inside a method affects the original list outside the method because the reference points to the same memory location. For primitives, changes inside the method do not affect the original variable.

The bubble sort algorithm works by repeatedly stepping through the integer array, comparing adjacent pairs and swapping them if they are in the wrong order. This process is repeated until the array is sorted. During each pass, the largest unsorted element 'bubbles' up to its correct position. The algorithm stops when no more swaps are needed, indicating that the array is sorted.

To merge two arrays into a third array without duplicates in Java, follow these steps: 1. Create a new data structure such as a HashSet to hold the elements as it automatically manages duplicates. 2. Add elements from both arrays to this data structure. 3. Convert the HashSet to an array. This ensures that all elements in the final array are unique.

To check if a string is a palindrome, methods include comparing the string to its reverse or using two pointers from each end moving towards the center. The most efficient method depends on the context: using two pointers is generally more efficient as it avoids creating a new string or character array, saving both time and space.

An EvenPal is a number that is both a palindrome and has an even sum of its digits. To determine if a number is an EvenPal, first check if the number is a palindrome by reversing its digits and comparing it with the original number. Then, calculate the sum of all digits and check if it is even. If both conditions are met, the number is an EvenPal.

To reverse a string in Java, you can implement a method that follows these steps: 1. Convert the string into a character array. 2. Initialize two pointers, one at the start and another at the end of the array. 3. Swap the characters at these pointers and move the pointers towards each other. 4. Continue swapping until the pointers meet. 5. Convert the character array back to a string.

Wrapper classes in Java provide a way to use primitive data types as objects. They are significant for object-oriented programming as they allow primitive types to be used in collections like ArrayList. An example of using a wrapper method is Integer.parseInt(), which converts a numeric string to an integer. For instance, Integer.parseInt("123") returns the integer 123.

To check if a number is an Armstrong number, follow these steps: 1. Calculate the number of digits, n, in the number. 2. For each digit, calculate its nth power and sum these values. 3. If the sum is equal to the original number, then it is an Armstrong number.

To perform a binary search on a sorted integer array, follow these steps: 1. Start with two pointers, low at the beginning and high at the end of the array. 2. Calculate the mid index as (low + high) / 2. 3. If the element at mid is the target, return the index. 4. If the target element is less than the element at mid, set high to mid - 1. 5. If the target element is greater than the element at mid, set low to mid + 1. 6. Repeat steps 2-5 until the element is found or the search range is empty.

You might also like