Computer Application Specimen 2024: Sec-A Que-2 ICSE Sample Model Paper Solved

Computer Application Specimen 2024: Sec-A Que-2 ICSE Sample Model Paper Solved by expert teachers. These solutions of ICSE Specimen paper 2024 are fully applicable as latest prescribe guideline of CISCE for upcoming board exam.

Computer Application Specimen 2024 Sec A Que 2 ICSE Sample Model Paper Solved

Computer Application Specimen 2024: Sec-A Que-2 ICSE Sample Model Paper Solved

Board ICSE
Class  10th (x)
Subject Computer Application
Topic  Specimen Paper Solved
Sec  A
Question Number Que-2
Session 2023-24
Max mark 80

Question 2 Sec-A Computer Application Specimen 2024 ICSE

(i) Write the Java expression for (p + q)²

Ans:-  Math.pow((p + q) , 2)

(ii) Evaluate the expression when the value of x = 2: x = x ++ + ++ x + x

Ans:- output 10

Hint : Initially, x = 2. The expression is calculated as follows:

x = x++ + ++x + x
x = 2 + ++x + x          (x = 3)
x = 2 + 4 + x               (x = 4)
x = 2 + 4 + 4               (x = 4)
x = 10

(iii) The following code segment should print “You can go out” if you have done your homework (dh) and cleaned your room(cr). However, the code has errors. Fix the code so that it compiles and runs correctly.

boolean dh = True;
boolean cr= true;
if (dh && cr)
System.out.println(“You cannot go out”);
else
System.out.println(“You can go out”);

Ans:- 

boolean dh = true; 
boolean cr= true; 
if (dh && cr)
System.out.println("You can go out"); 
else
System.out.println("You cannot go out");

(iv) Sam executes the following program segment and the answer displayed is zero irrespective of any non zero values are given. Name the error. How the program can be modified to get the correct answer? 

void triangle(double b, double h)
{ double a;
a = ½ * b * h;
System.out.println(“Area=”+a); }

Ans:-

Logical error.

Modified program:

void triangle(double b, double h)
{	
    double a; 
    a = 1.0/2 * b * h;
    System.out.println("Area=" + a);	
}

(v) How many times will the following loop execute? What value will be returned?

int x=2;
int y=50;
do{
++x;
y-=x++;
}
while(x<=10);
return y;

Ans: – The loop will execute 5 times and the value returned is 15

Iteration X Y Remark
2 50 Initial values
1 3 47 x = 4 (3 + 1), y = 47 (50 – 3)
2 5 42 x = 6 (5 + 1), y = 42 (47 – 5)
3 7 35 x = 8 (7 + 1), y = 35 (42 – 7)
4 9 26 x = 10 (8 + 1), y = 26 (35 – 9)
5 11 15 x = 12 (11 + 1), y = 15 (26 – 11)
11 15 Condition becomes false. Loop terminates.

 

(vi) Write the output of the following String methods:

(a) “ARTIFICIAL “.indexOf(‘I’ )
(b) “DOG and PUPPY”. trim().length()

Ans part (a) output 3

Hint: indexOf() returns the index of the first occurrence of the specified character within the string or -1 if the character is not present. First occurrence of ‘I’ in “ARTIFICIAL” is at index 3 (a string begins at index 0)

Ans part (b) output 13

hint:  trim() removes all leading and trailing space from the string and length() returns the length of the string i.e., the number of characters present in the string. Thus, the output is 13.

(vii) Name any two jump statements.

Ans: Two jump statements are:

  1. break statement
  2. continue statement

(viii) Predict the output of the following code snippet:

String a=”20″;
String b=”23″;
int p=Integer.parseInt(a);
int q=Integer.parseInt(b);
System.out.print(a+”*”+b);

Ans:  Output 20 x 23

Hint:  Integer.parseInt() method will convert the strings a and b to their corresponding numerical integers — 20 and 23. In the statement, System.out.print(a + "*" + b); ab, and "*" are strings so + operator concatenates them and prints 20*23 as the output.

(ix) When there is no explicit initialization, what are the default values set for variables in the following cases?

(a) Integer variable
(b) String variable

Answer

(a) 0

(b) null

(x) int P [ ]={ 12,14,16,18}; int Q[ ]={ 20,22,24}; Place all elements of P array and Q array in the array R one after the other.

(a) What will be the size of array R [ ] ?
(b) Write index position of first and last element?

Ans:  int R[ ] = {12, 14, 16, 18, 20, 22, 24};

(a) Size of array P[ ] = 4
Size of array Q[ ] = 3
Size of array R[ ] = 7 (4 + 3).

(b) Index position of first element is 0.
Index position of last element is 6.

— End of Computer Application Specimen 2024: Sec-A Que-2 ICSE  :-

-–: Visit also :–

Return to : ICSE Specimen Paper 2024 Solved

Thanks

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!