0% found this document useful (0 votes)
5 views

ComputerApplication Class10

Uploaded by

Joshua Sam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

ComputerApplication Class10

Uploaded by

Joshua Sam
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Class 10 computer application

Paper 01 total marks 80 time duration 2 hours

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

Inheritance is also an acceptable answer and Encapsulation is also an accepted answer

2. Which of the following are logical operators in Java


A) Pre increment
B) Post increment
C) Not
D) Assignment
Assignment as the rest are assignment operators
3. Your friend wants to write a computer program where he is designing different
classes. He wants to ensure that the data present in the base class is visible to the
derived class but not to other classes then the access specifier to use is
A) Public
B) Private
C) Protected
D) Package
Protected
4. Which of the following Java expression will find the cuberoot of 27. Mark all the
correct options note more than one option is correct if you mark all options that are
right you will get 1 mark 0 otherwise.
A) X= Math.pow(27,1/3)
B) X = Math.cbrt(27)
C) X = Math.round(Math.cbrt(27))
D) X= Math.pow(27,1.0/3)
Option B and option D are ok
5. How many times will hi be printed
for( int i =0 ;i >1; i++)
System.out.println(“hi”);
A) Infinite times
B) 1 time
C) 0 times
D) Syntax error
O times
6. How many times will this loop execute
do
{
int x =0;
}while(x);
A) Infinite times
B) 1 time
C) 0 times
D) Syntax error

1 time

7. How many bytes will “A” character occupy in memory.


A) 4 bytes
B) 1 byte
C) 8 bytes
D) 2 bytes
2 bytes
8. A function that does not return any parameters uses the return type
A) int
B) void
C) double
D) char
void
9. Assertion: the expression >= does a logical comparison of two numeric datatypes
Reason: the expression is a relational operator
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.
Assertion is false and Reason is true Because a >= is a numeric comparison
not logical

10. How many variables can we return from a method


A) 2 variables
B) 3 variables
C) 1 variable
D) None or 1 variable
None or 1 variable
11. The output of the function Math.abs(Math.ceil(-11.5)) is _______

10.0Math.ceil will return -10 and abs will make it 10

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.

Both assertion and reason are true.


14. An exit controller loop is
A) For loop
B) While loop
C) If condition
D) Do while loop
Do while loop
15. Read the code snippet below and guess the output
for(int I = 0; I <10; I++)
{
if(I == 3)
continue;
System.out.println(“hi”);
}
A) Hi is printed 10 times
B) Hi is printed 9 times
C) Hi is not printed even once
D) Hi is printed 11 times.
Hi is printed 9 times because when I = 3 it skips the print statement
16. Implicit type conversion means a datatype being converted to another by the
compiler automatically. The condition for an implicit data type conversion is
A) The destination type is smaller than the source type
B) The destination type is larger than the source type
C) The destination and source are of same type
D) None of the above

The destination type is larger than the source type

17. Assertion : ? Is a conditional operator similar to an if condition


Reason: ? Operator cannot use expressions while an if condition can use
expressions
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.
Assertion is true and Reason is false
18. Assertion : A switch condition is similar to an if condition
Reason: the only difference is a switch case cannot be used when we have
expression where as an if condition can support an expression
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.
Both assertion and reason are true.
19. All loops viz for, while, do- while can be nested True/False
True
20. A switch case without a default will lead to a compiler error True/False
False

Section A Question 2 Each question carries 2 marks


Question 2:

1. Write a Java expression for the following mathematical statement

| (X+Y)/(Y-Z) * PI |

where PI is a constant (22/7)

Math.abs((X-y)/(Y-Z) *22.0/7)

2. Using a ternary operator find the maximum of two floating point numbers

A > b > a:b

3. Identify the output of the following code

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);

MondayTuesdayWednesdayInvaliday No break present


4. Write only the code snippet required to print the following pattern

##

***

####

*****

For( int I = 1 ; I < = 5 ; i++)

For(j = 1; j <= I ; j++)

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

(X^2 + y^2 + 2xy )^1/2

Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + 2 * x* y )

OR

Math.sqrt(x*x+ y*y+ 2 * x* y ) OR Math.pow((x*x+ y*y+ 2 * x* y ), 1.0/2)

6. Your friend wanted to print this pattern

12345

1234

123
12

However he got the output as

12

123

1234

12345

Correct the mistakes in the below snippet and rewrite the same

for( int i=1; i<6;i++)

for( int j=1; j<i; j++)

System.out.print(j);

System.out.println();

for( int i=5; i>=1;i--)

for( int j=1; j<=i; j++)

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

Switch (x) If( x == 1)


{ {
Case 1 : System.out.println(“Cat”); break; System.out.println(“Cat”);
Case 2 : System.out.println(“dog”); break; }else if ( x == 2)
default : System.out.println(“Neither cat or {
dog”); break; System.out.println(“dog”);
} }
Else
{
System.out.println(“Neither Cat or dog ”);
}

8. What is the value of I after executing this expression

i=3

i += ++i+--i---i+i++-i—
I = I + ++I + --I - --I + i++ - i-- I = 3 + 4 + 3 – 2 + 2 – 3 = 7

9. What is the value of I and J and x after this line is executed

I =11

J=22

x = ++I + ++j %--I + j---i


x = 12 + 23 %11 + 23 – 10 = 12 + 2 +23 -10 ; j = 22 I = 10 x = 27

10. Re write this for loop using a do while loop

for( int i=5;i>0 i--)

System.out.print(i);

I = 5;

Do
{

System.out.print(i);

}while(--I > 0);

SECTION B

Answer all questions each question carries 15 marks


3. Write a menu driven program to do the following

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

2x2=4 till 2x10 =20

C) any other input should print “enter either 1 or 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

Square of the number = 81

Sum of digits = 9 therefore 9 is a boogie number

Example 2

Number is 7

Square of number 49

Sum of digits 13

Sum of digits is not equal to 7 hence number is not a boogie number

You might also like