You are on page 1of 3

Class-X-Worksheet

Computer Application
Choose the correct options:
1. The property which does not allow the data and its functions to be used as
public interface is known as:
a) Inheritance b) Polymorphism
c) Data Hiding d) Class

2. It is a machine instruction for a Java processor chip called and is independent of


the computer system it has to run upon. It is exactly same in all platforms.
a) JVM b) Java Byte Code
c) JDK d) JRE
3. State the value of n and ch.
char c=’A’;
int n= c+1;
char ch=(char)n;
a) n=66 ch=b b) n=92 ch=a
c) n=97 c=b d) n=66 ch=B
4. choose the result of the following expression:
int x=4;
x+=x++ * ++x%2;
a) 4 b) 20
c) 15 d) -14
5. Consider the following class:
public class MyClass
{
public static int x=3, y=4;
public int a=2, b=3;
}
i) Name the variables for which each object of the class will have its own distinct
copy.
ii) Name the variables that are common to all objects of the class.
a) x,y and a,b b) a,b and x,y
c) a,x and y,b d) a,y and b,x

6. State number of iterations for the following code


int a=0, x=0;
while(x++<7)
a+=x;
a) 7 times b) 6 times
c) 5 times d) 8 times

7. Evaluate the value of n from the given statement,if p=15,q=19:


int n=(q-p)>(p-q)?(q-p) : (p-q) ;
a) n=2 b) n=4
c) n=13 d) None of the above

Page 1 of 3
8. Analyze the following program segment and state the output and determine how
many times the body of the loop will be executed:
int p=200;
while(true)
{
if ( p < 100)
break;
p=p-20;
}
System.out.println ( p );
a) Output- 12, Runs 2 times b) Output- 10, Runs 2 times
c) Output- 12, Runs 3 times d) Output- 10, Runs 3 times
9. State the output of the following program segment:
double x=2.9, y=2.5;
System.out.println(Math.min (Math.floor(x), y));
System.out.println(Math.max (Math.ceil(x), y));
a) 3.0 b) 2.0
2.0 2.0
c) 2.5 d) 2.0
3.0 3.0
10. What type of conversion showing by the following code:
char c= (char) 120;
a) Implicit type conversion b) Explicit type conversion
c. both a & b. d) None of the above
11. Observe the following code and state the value of i and j before any object is
created?

a) i=0 and j=0 b) i=0.0 and j=0.0


c. ‘\0000’ d) None of the above
12. Choose the correct Java Expression for the following:
5 x3 + 2 y
x+y
a) 5* Math. pow (x,3)+2*y/x+y b) math. pow((5*x),3)+2y/x+y
c. 5*x^3+2*y/x+y d) (5*Math. pow(x,3)+2*y)/(x + y)

Page 2 of 3
13. The following program returns the reverse of the number n. Choose the write
expression for the blank, so that the program will execute successfully.

a) rev*10+num/10 b) rev+num%10
c) rev *10+num%10 d) None of the above
14. Analyze the given code and determine how many times does the inner loop
execute?
for (int i=3; i<=4; i++)
{
for (int j=2; j< i; j++)
{
System.out.println(“ “);
}
}
a) 2 times b) 3 times
c) infinite d) 4 times
15. What is the final value of c after the iteration process given below:

a) 12 b) 13
c) 15 d) None of the above
Page 3 of 3

You might also like