Wednesday , 18 July 2018
Latest Posts
Home » Weekly Practice Question Class 10 » [Week 2] Weekly Important Practice Questions for ICSE Computer Applications

# [Week 2] Weekly Important Practice Questions for ICSE Computer Applications

This week we have a few questions  which deals with finding the output of certain given programming codes for the ICSE students preparing for their 2013 Computer Applications Examination.

The correct answers will be posted next week.

Questions:

1. What will be the output of the below code when n=145

int number(int n)
{
int s=0;
while(n>0)
{
s=s+n%10;
n/=10;
}
return n;
}

2. Give the output of the below code:

public static void main()
{
String s1=”Java For”, s2=”School Students”;
System.out.println(“L”+s1.substring(1,4));
System.out.println(s2.indexOf(s1.charAt(6)));
System.out.println(s1.concat(s2));
System.out.println(s1.compareTo(s2));
System.out.println(s2.equals(s1));
}

3. Give the output of the below code:

public static void main()
{
int c=900,n=2000;
int x=0,y=0;
x=n+(c>2550?1350:1500);
y=n+c>2550?1350:1500;
System.out.println(“x = “+x);
System.out.println(“y = “+y);
}

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]

x=3500 [because, first (c>2550?1350:1500) is calculated and then the result is added to the value of ‘n’. Since, 900 is not greater than 2550, so the result of (c>2550?1350:1500) is 1500, which is then added to the value of ‘n’ i.e. 2000, and we get the answer as 3500.]

y=1350 [because, in this case, first the value of n+c is calculated and then (n+c>2550?1350:1500) is calculated. Since, n + c = 2000 + 900 = 2900 which is greater than 2550, so the result of (n+c>2550?1350:1500) is 1350.]

## Important Practice Questions for ICSE [Set 1]

Important practice questions for ICSE Computer Application students [Multiple Choice Questions and Output Questions)

1. Md.Mudassir Parvez

Md.Mudassir Parvez says
1.10
2.a.Lava
b.3
c.Java For School Students
d.
e.false

• You did not answer question 1 and question 3. In question 2, your 1st answer is incorrect, in 3rd answer, there should be no space between “Java for” and “School students”. you did not answer the 4th part of this question.

kindly go through the answers given below and the reasons along with them.

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]

x=3500 [because, first (c>2550?1350:1500) is calculated and then the result is added to the value of ‘n’. Since, 900 is not greater than 2550, so the result of (c>2550?1350:1500) is 1500, which is then added to the value of ‘n’ i.e. 2000, and we get the answer as 3500.]

y=1350 [because, in this case, first the value of n+c is calculated and then (n+c>2550?1350:1500) is calculated. Since, n + c = 2000 + 900 = 2900 which is greater than 2550, so the result of (n+c>2550?1350:1500) is 1350.]

2. 1.10
2.Lava
111
Java For School Students
-9
False
3.x=3500,y=1350

• Your answer to question 1 was incorrect and in question 2, the 2nd answer was incorrect, and in 3rd answer, there should be no space between “Java for” and “School students”.

kindly go through the answers given below and the reasons along with them.

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]

x=3500 [because, first (c>2550?1350:1500) is calculated and then the result is added to the value of ‘n’. Since, 900 is not greater than 2550, so the result of (c>2550?1350:1500) is 1500, which is then added to the value of ‘n’ i.e. 2000, and we get the answer as 3500.]

y=1350 [because, in this case, first the value of n+c is calculated and then (n+c>2550?1350:1500) is calculated. Since, n + c = 2000 + 900 = 2900 which is greater than 2550, so the result of (n+c>2550?1350:1500) is 1350.]

1. 541

2. – Lava
-3
-Java ForSchool Students
-true
-false

3. x= 3500
y=1350

kindly go through the answers given below and the reasons along with them.

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]

x=3500 [because, first (c>2550?1350:1500) is calculated and then the result is added to the value of ‘n’. Since, 900 is not greater than 2550, so the result of (c>2550?1350:1500) is 1500, which is then added to the value of ‘n’ i.e. 2000, and we get the answer as 3500.]

y=1350 [because, in this case, first the value of n+c is calculated and then (n+c>2550?1350:1500) is calculated. Since, n + c = 2000 + 900 = 2900 which is greater than 2550, so the result of (n+c>2550?1350:1500) is 1350.]

4. 1.541
2.lava
3
Java ForSchool Students
true
false
3.x=1500
y=1350

kindly go through the answers given below and the reasons along with them.

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]

x=3500 [because, first (c>2550?1350:1500) is calculated and then the result is added to the value of ‘n’. Since, 900 is not greater than 2550, so the result of (c>2550?1350:1500) is 1500, which is then added to the value of ‘n’ i.e. 2000, and we get the answer as 3500.]

y=1350 [because, in this case, first the value of n+c is calculated and then (n+c>2550?1350:1500) is calculated. Since, n + c = 2000 + 900 = 2900 which is greater than 2550, so the result of (n+c>2550?1350:1500) is 1350.]

5. 1:] i cant understand
2:] lava ; 3; java for school students;false ;false.
3:] x=3500,y=1350

• For those answers which you were unable to understand, kindly go through the answers given below and the reasons along with them.

In question 2, the 1st answer should begin with a capital ‘L’, and in 3rd answer, there should be no space between "java for" and "School students" and also, your 4th answer was incorrect.

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]

x=3500 [because, first (c>2550?1350:1500) is calculated and then the result is added to the value of ‘n’. Since, 900 is not greater than 2550, so the result of (c>2550?1350:1500) is 1500, which is then added to the value of ‘n’ i.e. 2000, and we get the answer as 3500.]

y=1350 [because, in this case, first the value of n+c is calculated and then (n+c>2550?1350:1500) is calculated. Since, n + c = 2000 + 900 = 2900 which is greater than 2550, so the result of (n+c>2550?1350:1500) is 1350.]

6. 1.541
2.a.lava
b.3
c.Java ForSchool Students
d.true
e.false
3.x=1500
y=1350

kindly go through the answers given below and the reasons along with them.

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]

x=3500 [because, first (c>2550?1350:1500) is calculated and then the result is added to the value of ‘n’. Since, 900 is not greater than 2550, so the result of (c>2550?1350:1500) is 1500, which is then added to the value of ‘n’ i.e. 2000, and we get the answer as 3500.]

y=1350 [because, in this case, first the value of n+c is calculated and then (n+c>2550?1350:1500) is calculated. Since, n + c = 2000 + 900 = 2900 which is greater than 2550, so the result of (n+c>2550?1350:1500) is 1350.]

7. 1.541
2.lava
3
Java ForSchool Students
true
false
3.x=3500
y=1350

kindly go through the answers given below and the reasons along with them.

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]

x=3500 [because, first (c>2550?1350:1500) is calculated and then the result is added to the value of ‘n’. Since, 900 is not greater than 2550, so the result of (c>2550?1350:1500) is 1500, which is then added to the value of ‘n’ i.e. 2000, and we get the answer as 3500.]

y=1350 [because, in this case, first the value of n+c is calculated and then (n+c>2550?1350:1500) is calculated. Since, n + c = 2000 + 900 = 2900 which is greater than 2550, so the result of (n+c>2550?1350:1500) is 1350.]

8. 1:) n=1%10;(sir,do not know what will be the value of 1%10;)
2:) Lava
3
Java for School students
-1
false
3:) x=3500
y=1650.

kindly go through the answers given below and the reasons along with them.

0 [because, the function number ( ) is returning the value of ‘n’, and as we know that after the execution of the given while loop, the value of ‘n’ becomes 0. Hence, the answer will be 0.]

Lava [because, s1.substring(1,4) gives, “ava”. Hence, “L”+”ava” = Lava]

3 [because, s1.charAt(6) will give ‘o’ and hence, s2.indexOf(‘o’) will give 3.]

Java forSchool students [Note: There will be no space between “Java for” and “School students”]

-9 [because, the (ASCII value of J – ASCII value of S) = 74-83 = -9]

false [because, “Java for” and “School students” are not equal.]