ComputerApplication Class10
ComputerApplication Class10
Section A has two parts question one carries 1 mark each and question 2 carries 2
marks each
Section A Question 1
1. Consider the following statement. Which of the following options best describe the
given statement
Union Bank of India maintains multiple accounts like savings deposits, fixed deposits,
current account etc. Each type of account has multiple account holders. Each account
holder can perform operations like open account, close account, deposit and withdrawal
A) Encapsulation
B) Inheritance
C) Polymorphism
D) Functional programming
1 time
12. Observe the following code snippet and chose the right value of i after these lines
are executed
Code snippet A
int I =10;
++I;
Code snippet B
int I = 10;
I++;
A) The value of the I is 11 in snippet A and 10 in snippet B
B) The value of the I is 10 in snippet A and 10 in snippet B
C) The value of the I is 11 in snippet A and 11 in snippet B
D) The value of the I is 10 in snippet A and 11 in snippet B
The value of the I is 11 in snippet A and 11 in snippet B
13. Assertion Output of the expression Math.pow(x,1.0/2) is same as Math.sqrt(x)
Reason: both expressions obtain square root of x using different math libraries
A) Assertion is true and Reason is false
B) Assertion is false and Reason is false
C) Assertion is false and Reason is true
D) Both assertion and reason are true.
| (X+Y)/(Y-Z) * PI |
Math.abs((X-y)/(Y-Z) *22.0/7)
2. Using a ternary operator find the maximum of two floating point numbers
int i= 1;
switch(i)
case 1: System.out.println(“Monday”);
case 2: System.out.println(“Tuesday”);
case 3: System.out.println(“Wednesday”);
default:
System.out.println(“invalid day);
##
***
####
*****
If(1%2 == 0)
System.out.print(“#”);
else
System.out.print(“*”);
5. Using math library write a Java expression for the below piece of code
Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + 2 * x* y )
OR
12345
1234
123
12
12
123
1234
12345
Correct the mistakes in the below snippet and rewrite the same
System.out.print(j);
System.out.println();
System.out.print(j);
System.out.println();
}
7. Raju wants to write a program which prints cat when the user enters 1 and dog when the
user enters 2 for any other input it should print neither car or dog. Assume that the user
input is stored in a variable named x. Write a code snippet to satisfy the requirement
i=3
i += ++i+--i---i+i++-i—
I = I + ++I + --I - --I + i++ - i-- I = 3 + 4 + 3 – 2 + 2 – 3 = 7
I =11
J=22
System.out.print(i);
I = 5;
Do
{
System.out.print(i);
SECTION B
A) if user enters 1 , then it should ask 2 numbers x and y from the user and compute x^y
B) if the user enters 2 then it should print the multiplication tables for 2
2x1=2
4. Boogie number is a number where the sum of digits of the square of the number is equal
to the number
Example 1
Number is 9
Example 2
Number is 7
Square of number 49
Sum of digits 13