COMPUTER APPLICATIONS

CLASS 10

PRACTICE PAPER - 1 (SHORT ANSWER QUESTIONS)

Ques 1) Why are arrays useful ?

Ques 2 ) arr is a 2-D array, declared as arr[9][15]. Find the total number of elements in arr.

Ques 3) Define literal in Java.

Ques 4) What is the output of the following code, if "abc" is passed as an argument to the function f1

public static void f1 (String s)

{ String s1= s+"xyz";

System.out.println("s1= "+s1);

System.out.println("s= "+s); }

Ques 5) What is the difference between charAt() and substring() functions?

Ques 6) Study the given code snippet and answer the questions that follow:

int output(int a, int b)

{ int f=1, n=a;

while (b>0)

{ if (b%2 ==1)

f*=n;

b/=2;

n*=n;

}

return (f);

}

(i) What will be returned when output(3,5) is invoked ?

(ii) What will be returned when output(2,8) is invoked ?

Ques 7) What are the 3 kinds of variables that a class can consist of ? Give examples.

Ques 8) Write the syntax and purpose of the following functions with an example

(i) compareTo() (ii) endsWith()

Ques 9) What is the difference between comparison done by equals method and == operator? explain with example.

Ques 10) Suppose a 10- element array A contains values a1, a2, a3..... a10. Find the values in A after the following loop is executed

for (i=0; i<9 ; i++)

A[i+1] = A[i];

Ques 11) How many times does the following loop execute?

int m=10, n=7;

while (m%n >=0)

{m=m+1;

n=n+2;

}

Ques 12) Identify the errors in following functions ?

(i) float average (a,b) (ii) float fn (int x, float d=3.14)

Ques 13) Define a wrapper class. Give any 2 examples.

Ques 14) Write a java statement to import all the classes of the package named 'simple'.

Ques 15) Write java expression for (a2+b3)/2ab