ICSE Computer Application - Class X - 2014 PYQ
Table of Content:
Table of Content:
A special two-digit number is such that when the sum of its digits is added to the product of its digits, the result is equal to the original two-digit number.
Example: Consider the number 59.
Sum of digits = 5 + 9 = 14
Product of digits = 5 * 9 = 45
Sum of the sum of digits and product of digits = 14 + 45 = 59
Write a program to accept a two-digit number. Add the sum of its digits to the product of its digits. If the value is equal to the number input, then display the message "Special two—digit number" otherwise, display the message "Not a special two-digit number".
Write a program to assign a full path and file name as given below. Using library functions, extract and output the file path, file name and file extension separately as shown.
Input
C:\Users\admin\Pictures\flower.jpg
Output
Path: C:\Users\admin\Pictures\
File name: flower
Extension: jpg
Design a class to overload a function area( ) as follows:
Write a program to accept the year of graduation from school as an integer value from the user. Using the binary search technique on the sorted array of integers given below, output the message "Record exists" if the value input is located in the array. If not, output the message "Record does not exist".
Sample Input:
Using the switch statement, write a menu driven program to calculate the maturity amount of a Bank Deposit.
The user is given the following options:
For option 1, accept principal (P), rate of interest(r) and time period in years(n). Calculate and output the maturity amount(A) receivable using the formula:
A = P[1 + r / 100]n
For option 2, accept Monthly Installment (P), rate of interest (r) and time period in months (n). Calculate and output the maturity amount (A) receivable using the formula:
A = P x n + P x (n(n+1) / 2) x r / 100 x 1 / 12
For an incorrect option, an appropriate error message should be displayed.
Which of the following are valid comments ?
Name the primitive data type in Java that is:
int a = new int (5); for (int i=0; i<=5; i++) a[i]=i;
Operators with higher precedence are evaluated before operators with relatively lower precedence. Arrange the operators given below in order of higher precedence to lower precedence:
Identify the statements listed below as assignment, increment, method invocation or object creation statements.
List the variables from those given below that are composite data types:
String str1 = "great"; String str2 = "minds"; System.out.println(str1.substring(0,2).concat(str2.substring(1))); System.out.println(("WH" + (str1.substring(2).toUpperCase())));
Rewrite the following program segment using if-else statements instead of the ternary operator:
String grade = (marks>=90)?"A": (marks>=80)? "B": "C";
public static void main (String [] args){ int a = 5; a++; System.out.println(a); a -= (a--) - (--a); System.out.println(a);}
What is the data type returned by the library functions :
String s = "4.3756"; int n = s.indexOf('.'); int characteristic=Integer.parseInt(s.substring(0,n)); int mantissa=Integer.valueOf(s.substring(n+1));
public void sampleMethod() { for (int i=0; i < 3; i++) { for (int j = 0; j<2; j++) {int number = (int)(Math.random() * 10); System.out.println(number); }}}
How many times does the loop execute?
What is the range of possible values stored in the variable number?
public class myClass { public static int x=3, y=4; public int a=2, b=3;}
(i)
String s = "1001"; int x = Integer.valueOf(s); double y = Double.valueOf(s); System.out.println("x="+x); System.out.println("y="+y);
(ii)
System.out.println("The king said \"Begin at the beginning!\" to me.");