Chapter Questions

ICSE Computer Application - Class - X Questions

Explore chapter-wise explanatory questions and quickly move between related subchapters from a cleaner, more advanced layout.

Questions List

Browse all explanatory questions of this chapter.

50 Total Questions
1

(x) Give the output of the following program segment and specify how many times the loop is executed.


String s = "JAVA";

for(i=0; i<s.length(); i+=2)
    System.out.println(s.substring(i));

Question ID: 8483 Read Details
2

(ix)
(a) Write the Java statement to initialize the first 6 odd numbers in a 3 × 2 array.

(b) What is the result of x[0][1] + x[2][1] of the above array?

Question ID: 8482 Read Details
3

(viii) Consider the following array and answer the questions given below:

int a[ ] = {12,10,8,4,6,2,3,5,7};

(a) What is the output of System.out.print(a[0] + a[5]);?

(b) What is the index (subscript) of the largest element of the array a[ ]?

Question ID: 8481 Read Details
4

(vii)

John was asked to write a Java code to calculate the surface area of a cone. The following code was written by him:

Formula:

Surface area of a cone is A = πrℓ, where ℓ = √(r² + h²)


class area  
{  
    double area(double r, double h)  
    {  
        double l, a;  
        a = 22.0/7 * r * l;  
        l = Math.sqrt(r * r + h * h);  
        return a;  
    }  
}  

Task:

(a) Specify the type of error in the above program.
(b) Correct the program and write the error-free version.

Question ID: 8480 Read Details
5

(vi)
(a) Name one String method which results in a positive integer only.
(b) Name one String method which results in a character.

Question ID: 8479 Read Details
6

(v) Consider the following Java program and determine its output:

class report 
{
    int a, b;

    report() 
    {
        a = 10;
        b = 15;
    }

    report(int x, int y) 
    {
        a = x;
        b = y;
    }

    void print() 
    {
        System.out.println(a * b);
    }

    public static void main(String[] args) 
    {
        report r = new report();
        r.print();

        report p = new report(4, 5);
        p.print();
    }
}

Question ID: 8478 Read Details
7

(iv) Convert the given loop into exit controlled loop.

int a, b;

for ( a=10 , b=1; a>=1 ; a-=2)
{
    b+=a;
    b++;
}

System.out.print(b);

Question ID: 8477 Read Details
8

(iii) Write the Java statement for creating an object named 'sifra' of the class 'Robot', which takes three double parameters.

Question ID: 8476 Read Details
9

(ii) Write the output of the following String method:

String x= "talent";  String y="matrix";

System.out.print(x.substring(3).concat(y.substring(3)));

Question ID: 8475 Read Details
10

(i) Write the java expression to find the product of square root of P and the square root of Q using the methods of Math class.

Question ID: 8474 Read Details
11

Give the output of the following program segment. How many times is the loop executed?

for(x=10; x>20; x++)
System.out.println(x);
System.out.println(x*2);

Question ID: 8473 Read Details
12

Write the value of n after execution:

char ch ='d';
int n = ch + 5;

Question ID: 8394 Read Details
13

Name the following:

(a) What is an instance of the class called?

(b) The method which has same name as that of the class name.

Question ID: 8393 Read Details
14

Consider the given array and answer the questions given below:

int x[ ] = {4, 7, 9, 66, 72, 0, 16};

(a) What is the length of the array?

(b) What is the value in x[4]?

Question ID: 8392 Read Details
15

Give the output of the following String class methods:

(a) "COMMENCEMENT".lastIndexOf('M')

(b) "devote".compareTo("DEVOTE")

Question ID: 8391 Read Details
16

Give the output of the following program segment:

int n = 4279; int d;
while(n > 0)
{ d = n % 10;
System.out.println(d); 
n = n / 100;
}

Question ID: 8390 Read Details
17

Rewrite the following code using the if-else statement:

int m = 400;
double ch = (m>300) ? (m / 10.0) * 2 : (m / 20.0) - 2;

Question ID: 8389 Read Details
18

Give the output of the following Character class methods:

(a) Character.toUpperCase ('a')

(b) Character.isLetterOrDigit('#')

Question ID: 8388 Read Details
19

Convert the following do…while loop to for loop:

int x = 10;
do
{
x––;
System.out.print(x);
}

Question ID: 8387 Read Details
20

Evaluate the expression when the value of x = 4: \[ x *= --x + x++ + x \]

Question ID: 8386 Read Details
21

Write the Java expression for \[ (a + b)^x \]

Question ID: 8385 Read Details
22

ফটোট্যাকটিক চলন (Phototactic Movement)

Question ID: 8357 Read Details
23

ট্যাকটিক চলন কয় প্রকার

Question ID: 8356 Read Details
24

আবিষ্ট বা ট্যাকটিক চলন কাকে বলে, ট্যাকটিক চলন কাকে বলে

Question ID: 8355 Read Details
25

উদ্ভিদের চলন কত প্রকার ও কি কি

Question ID: 8354 Read Details
26

চলন গতি কয় প্রকার

Question ID: 8353 Read Details
27

চলন গতি কাকে বলে

Question ID: 8352 Read Details
28

বক্র চলন কাকে বলে

Question ID: 8351 Read Details
29

প্রকরণ চলন কাকে বলে

Question ID: 8350 Read Details
30

উদ্ভিদের চলন এর উদ্দেশ্য

Question ID: 8349 Read Details
31

চলন কাকে বলে

Question ID: 8348 Read Details
32

i) Ramesh is trying to write a program to check whether a number is palindrome or not. Due to confusion in the syntax of some of the statements. he could not complete the program and has left some places blank marked with ?1?, ?2?, ?3? and ?4? to be filled with expression function. The incomplete program is shown below:

Based on the above discussion. answer the following questions :-

 

a) What expression will be filled in place of ?1?

b) What expression will be filled in place of ?2?

c) What expression will be filled in place of ?3?

d) What expression will be filled in place of ?4?


import java.util.*;

class Palindrome {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int copy, n, rev = 0;
        System.out.println("Enter the number");
        n = sc.nextInt(); 
        copy = n;

        while (n != 0) {
            int r = ?1?; // Place 1
            rev = ?2?;   // Place 2
            n = ?3?;     // Place 3
        }

        if (?4?) {      // Place 4
            System.out.println("Palindrome");
        } else {
            System.out.println("Not palindrome");
        }
    }
}

Question ID: 8347 Read Details
33

What will be the output of the following program segment?

int a[] = {1, 2, 3, 4, 5, 6, 7, 9, 13, 16};

x = Math.pow(a[4], a[2]);


y = Math.sqrt(a[6] + a[7]);

Question ID: 8346 Read Details
34

What will be the output of the following program segment?

int ar[] = {1, 2, 3, 4, 5};
int a = 1;

for (int i = 0; i < 7; i++) { 
    a = a + i * ar[i];
}

System.out.println(a);

Question ID: 8345 Read Details
35

Convert the following segment into an equivalent do- while loop.

int a, b;

for (a = 10, b = 20; b >= 10; b = b - 2) {
    a++;
}

Question ID: 8344 Read Details
36

Differentiate between the following code fragments and also give their output :-

int f = 1, i = 2;

while (++i < 5)
    f *= i;

System.out.println(f);



int f = 1, i = 2;

do {
    f *= i;
} while (++i < 5);

System.out.println(f);

Question ID: 8343 Read Details
37

Write the output of the following code :-

String x;
String str = "INFORMATION";
x = str.concat("PRACTICE");

System.out.println(x.length());
System.out.println(x.toUpperCase());

Question ID: 8342 Read Details
38

c) If a=24, b=15. find the value of a+=b++ * 5/a++ +b

Question ID: 8341 Read Details
39

Rewrite the following code using switch case statement

if (value == 1) {
    System.out.println("1st division");
} else if (value == 2) {
    System.out.println("2nd division");
} else if (value == 3) {
    System.out.println("3rd division");
} else {
    System.out.println("Wrong choice");
}

Question ID: 8340 Read Details
40

Write the following lava Expression :- \[ z = x^3 + y^2 - \sqrt{xy} \]

Question ID: 8339 Read Details
41

(h) Evaluate the following expression if the value of x=2, y=3 and z=1.

  v=x + --z + y++ + y

Question ID: 8159 Read Details
42

Question 3

Question ID: 8158 Read Details
43

Question 2

Question ID: 8157 Read Details
44

Question 1

Question ID: 8156 Read Details
45

(a) Write a Java expression for the following:

\[ \lvert x^2 + 2xy \rvert \]

(b) Write the return data type of the following functions:

  1. startsWith()
  2. random()

(c) If the value of basic=1500, what will be the value of tax after the following statement is executed?


tax = basic > 1200 ? 200 :100;

(d) Give the output of following code and mention how many times the loop will execute?


int i;
for( i=5; i>=1; i--)
{
    if(i%2 == 1)
        continue;
    System.out.print(i+" ");
}

(e) State a difference between call by value and call by reference.

(f) Give the output of the following:
       Math.sqrt(Math.max(9,16))

(g) Write the output for the following:


String s1 = "phoenix"; String s2 ="island";
System.out.println(s1.substring(0).concat(s2.substring(2)));
System.out.println(s2.toUpperCase());

(h) Evaluate the following expression if the value of x=2, y=3 and z=1.

  v=x + --z + y++ + y

(i) String x[] = {"Artificial intelligence", "IOT", "Machine learning", "Big data"};

Give the output of the following statements:

  1. System.out.println(x[3]);
  2. System.out.println(x.length);

(j) What is meant by a package? Give an example.

Question ID: 8155 Read Details
46

(a) Differentiate between if else if and switch-case statements

(b) Give the output of the following code:


String P = "20", Q ="19";
int a = Integer.parseInt(P);
int b = Integer.valueOf(Q);
System.out.println(a+""+b);

(c) What are the various types of errors in Java?

(d) State the data type and value of res after the following is executed:


char ch = '9';
res= Character.isDigit(ch);

(e) What is the difference between the linear search and the binary search technique?

Question ID: 8154 Read Details
47

(a) Name any two basic principles of Object-oriented Programming.

Answer

  1. Encapsulation
  2. Inheritance

(b) Write a difference between unary and binary operator.

(c) Name the keyword which:

  1. indicates that a method has no return type.
  2. makes the variable as a class variable

(d) Write the memory capacity (storage size) of short and float data type in bytes.

(e) Identify and name the following tokens:

Question ID: 8153 Read Details
48

Give the output of the following program segment and also mention how many times the loop is executed:

int i;
for ( i = 5 ; i > 10; i ++ )
System.out.println( i );
System.out.println( i * 4 );

Question ID: 8152 Read Details
49

Rewrite the following using ternary operator:

if (bill > 10000 )
discount = bill * 10.0/100;
else
discount = bill * 5.0/100;

Question ID: 8151 Read Details
50

Consider the following String array and give the output

String arr[]= {"DELHI", "CHENNAI", "MUMBAI", "LUCKNOW", "JAIPUR"};
System.out.println(arr[0].length() > arr[3].length());
System.out.print(arr[4].substring(0,3));

Question ID: 8150 Read Details