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

10 Computer Application Practice 2

Uploaded by

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

10 Computer Application Practice 2

Uploaded by

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

M. C. KEJRIWAL F.

M 100

V I D Y A P E E T H TIME 2Hrs.

PRACTICE PAPER - 2
SUBJECT: COMPUTER APPLICATION
CLASS: X

Answers to this Paper must be written on the paper provided separately.


You will not be allowed to write during the first 15 minutes.
This time is to be spent in reading the question paper.
The time given at the head of this Paper is the time allowed for writing
the answers.

This Paper is divided into two sections.


Attempt all questions from Section A and any four questions from
Section B.
The intended marks for questions or parts of questions are given in
brackets [ ].

SECTION – A
(Attempt all questions from this Section)

Question 1. [20x1=20]
Choose the correct answers to the question from the given options. (Do not copy the question, write
the correct answers only.)

(i)

What is the above image showcasing regarding the features of OOP?


(a) Encapsulation
(b) Inheritance
(c) Abstraction
(d) Polymorphism

(ii) Relational operators are :


(a) Unary operator
(b) Binary operator
(c) Ternary operator
(d) Conditional operator

(iii) The keyword used to return a value from a function is ________________.


(a) returns
(b) return
(c) break
(d) continue

-1-
(iv) Default constructor requires how many parameters?
(a) 3
(b) 0
(c) 2
(d) 1

(v) What is the final value stored in variable x ?


double x = Math.pow (345 .index of (‘5’), 3);
(a) 8.0
(b) 7.0
(c) 16
(d) 4

(vi) Which of the following is not a Java feature?


(a) Dynamic
(b) Architectural Neutral
(c) Use of Pointers
(d) Object-Oriented

(vii) Which of the following is an invalid access modifier?


static, public, private, protected
(a) protected
(b) private
(c) static
(d) public

(viii) Multiple branches are used by _____________ statement.


(a) Break
(b) Switch
(c) Continue
(d) Loop

(ix) Which part of the class has the same name as the class?
(a) Data
(b) Object
(c) Subclass
(d) Constructor

(x) Given an integer array of size 4, the last index will be:
(a) 0th index
(b) 2nd index
(c) 3rd index
(d) 4th index

(xi) How many times ‘Hello’ is printed?


for(int i = 0; i<5; i++)
{
System.out.println(Hello );
break;
}
(a) 5
(b) 4
-2-
(c) 1
(d) 0

(xii) What is the type and value of the following expression?


– 4 + 1/2 + 2*–3 + 5.0
(a) int, -5
(b) double, -4.5
(c) int, -4
(d) double, -5.0

(xiii) Name the keyword that ends any Loop suddenly?


(a) Quit
(b) Exit
(c) Break
(d) Continue

(xiv) The members of a class are defined inside:


(a) ( )
(b) { }
(c) [ ]
(d) < >

(xv) Function prototype means


(a) Return value of a function
(b) Name of the function
(c) Body of the function
(d) Return type, name and parameters of a function

(xvi) A _________ is an exit-controlled loop


(a) Do while
(b) While
(c) For
(d) Switch

(xvii) Assertion (A): In Java, no two identifiers can use the same name.
Reason (R): Identifiers are case-sensitive.
(a) Both Assertion (A) and Reason (R) are true, and Reason (R) is a correct explanation of Assertion
(A)
(b) Both Assertion (A) and Reason (R) are true, and Reason (R) is not a correct explanation of Assertion
(A)
(c) Assertion (A) is false, and Reason (R) is true.
(d) Assertion (A) is true and Reason (R) is false.

(xviii) Read the statement and choose the correct answer:


Function overloading is the only way to exhibit polymorphism in Java.
What is Polymorphism?
(a) To exhibit in more than one form.
(b) Inheriting the features of one class by another class.
(c) Binding data and methods into one unit.
(d) Hiding the background details from the user.

-3-
(xix) Assertion (A): Constructors are used to initialize the data members at the time of object creation.
Reason (R): Constructors cannot be called explicitly.
(a) Both Assertion (A) and Reason (R) are true, and Reason (R) is a correct explanation of Assertion (A)
(b) Both Assertion (A) and Reason (R) are true, and Reason (R) is not a correct explanation of Assertion
(A)
(c) Assertion (A) is false, and Reason (R) is true
(d) Assertion (A) is true and Reason (R) is false

(xx) Math.round() returns ________ data type.


(a) int
(b) long
(c) float
(d) double

Question 2. [10x2=20]
(i) Evaluate the given Java expressions if x = 3.0 and y = 2.0 :
y += ++x - ++x + 0.5;
(ii) Write Java expression for :

(iii) Rewrite the following code snippet using the ternary operator:
if (a > b | | a > c)
System.out.println(a + “largest no.”);
else
System.out.println(a + “not the largest no.”);
(iv) Rewrite the following loop using for loop:
int a=10;
while (a-->1)
System.out.println(“*”);
(v) Give the output of the following code and mention how many times the loop will execute?
for(int i=10; i >= 1; i --)
{
System.out.print(--i+ );
}
(vi) Write down the final value in the following code segments:
(a) TRANSPARENT.replace(‘N’ , ‘u’).toLowerCase();
(b) MISSISSIPPI.indexOf(‘S’) + “MISSISSIPPI”.lastIndexOf(‘I’);
(vii) Identify the loop in the following code segment as empty/non-empty, finite/infinite loop:
for(int i=10; i>1; i++);
(viii) Find out the error in the given code, where the smallest number will be subtracted from the largest
number and if both are equal, it should print zero:
int a=5, b=5;
if( a> b )
{
System.out.println(a-b);
else
System.out.println(b-a);
}
else
System.out.println(0);
(ix) Identify the type of conversion that is taking place here. Also, give the output.
double z=2.143;
-4-
int a=(int) z;
double b = z-a;
System.out.println(a+ +  +b+  =  +z);
(x) What is the purpose of ‘break’ in the switch case?

SECTION B

(Answer any four questions from this Section.)

The answers in this section should consist of the programs in either the BlueJ environment or any
programming environment with Java as the base.
Each program should be written using variable description / mnemonic codes so that the logic of the
program is clearly depicted.
Flowcharts and algorithms are not required.

Question 3. [15]
A number is called a tech number if the given number has an even number of digits, and the number can be
divided exactly into two parts from the middle. After equally dividing the number, sum up the numbers and
find the square of the sum. For example, if N= 2025, 20+25 = 45, (45)2=2025.

Sample Input 1: 3025


Output: It is a Tech number
Sample Input 2: 1312
Output: It is not a Tech number
Sample Input 3: 131
Output: Invalid number

Write a program in Java to accept an even digit number and check and print whether it is a Tech number or
not.

Question 4. [15]
Write a program in Java to accept the employee’s name and annual salary of a person and compute the tax
payable as per the given criteria. The program should print the data in the given format:

EmployeeName Annual Salary Tax Payable


Rajib Mishra 550000.00 37500.00

Annual Income Tax payable


Up to 2 lacs NIL
200001.00 to 500000.00 10% of the amount above 2 lacs
500001.00 to 1000000.00 30000.00 + 15% of the amount above 5 lacs
Above 10 lacs 75000.00 + 25% of the amount above 10 lacs

Question 5. [15]
Write a program in Java to find and print the sum of the given series:
1 1 1 1
Sum = 𝑥 − 2𝑥 + 3𝑥 − 4𝑥 + ⋯ 𝑢𝑝 𝑡𝑜 𝑁 𝑡𝑒𝑟𝑚𝑠, where x and N are positive integers and the value of x and
N will be entered by the user.

Question 6. [15]
Write a program in Java to print the given pattern where the total number of rows will be entered by the
-5-
user.
For N=3, the pattern will be –
A
BB
CCC

Question 7. [15]
Write a menu-driven program in Java to convert weight in grams to milligrams and vice-versa as per the
user’s choice. Print both the weight.
Option 1: gm to mg
Option 2: mg to gm

Question 8. [15]
Design a class to overload the function named perimeter( ) to compute the perimeter of the given
geometrical shapes.

void perimeter(int, int) - will compute and print the perimeter of a rectangle
void perimeter(int, int, int) - will compute and print the perimeter of a triangle

------x-----

-6-

You might also like