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

Computer (A I) New

This document contains a worksheet with multiple choice and written questions about computer applications and object-oriented programming concepts. It covers topics like characteristics of OOP, data types, strings, loops, functions, and classes. There are 8 questions asking students to write Java code to solve problems related to these topics, like calculating volume and salary. The questions test concepts like encapsulation, inheritance, polymorphism, abstraction, wrapper classes, and more.

Uploaded by

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

Computer (A I) New

This document contains a worksheet with multiple choice and written questions about computer applications and object-oriented programming concepts. It covers topics like characteristics of OOP, data types, strings, loops, functions, and classes. There are 8 questions asking students to write Java code to solve problems related to these topics, like calculating volume and salary. The questions test concepts like encapsulation, inheritance, polymorphism, abstraction, wrapper classes, and more.

Uploaded by

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

Grade :10 Computer Application

Worksheet-1
SECTION A

Question 1
1. Name the characteristics of Object Oriented Programming that hides the complexity and provides a
simple interface.
a. Encapsulation b. Polymorphism c. Abstraction d. Inheritance

2. Which among the following is a logical error?


a. Missing semicolon b. Mismatched braces in classes and methods.
c. Misspelled keywords and identifiers. d. Addition is required but subtraction is performed.

3. The first line of the function definition is called:


a. Function prototype b. Function signature c. Both a and b d. None of these

4. A local variable in a function has its scope:


a. Limited within the function b. Can be accessed anywhere within the same class
c. No limitation at all d. None of these

5. If the name of a class is ‘Number’, what can be the possible name for its constructor?
a. number b. Number c. No d. No

6. Which among the following is a type of constructor?


a. Parameterised constructor b. Non-parameterised constructor
c. Both a and b d. None of these

7. Which of the following is a composite data type?


a. int b. String c. char d. float

8. If s=“123”, which among the following will convert it to an integer?


a. int a=Integer(s); b. int a=(int)s; c. int a=parseInt(s); d. int a=Integer.parseInt(a);

9. What package is a part of the wrapper class which is imported by default into all Java programs?
a. java.util b. java.lang c. java.awt d. None of these

10. The output of the method “Computer Application”. substring (2,8) is:
a. Application b. Computer c. puter A d. mputer
11. A wrapper class converts-

2022-2023/Grade X/ Assessment I/Computer Application Page 1 of 5


a. in to float b. float to int c. Primitive data type to object d. None of the above

12. A string is –
a. Wrapper Class b. Data Type c. Group of characters d. All of the above 13. To
remove extra spaces from both sides of string, the functions used is_______
a. truncate () b. replace () c. trim () d. remove ()
14. The minimum number of parameters required for the function substring () is:
a. 2 b. 1 c. 0 d. 3
15. We can create a composite user defined data type using:
a. A Class Definition b. An Integer Definition
c. A Boolean Definition d. A String Definition’
16. To extract a character at index ‘n’ from a string ‘mystr’, the statement will be_______
a. mystr.charAt(n) b. mystr.indexOf(n) c. mystr.charOf(n) d. mystr.indexAt(n) 17.
By using you can force immediate termination of loop, bypassing the conditional expression and
any remaining code in the body of the loop.
a. switch b. break c. continue d. default
18. A type of parameter that are used to identify what data is to be passed to a function is called:
a. Formal parameter b. Actual parameter c. Both a and b d. None of these
19. Math.pow (625,1/2) +Math.sqrt(144)
a. 17.0 b. 13.0 c. 37.0 d. 13
20. Which among the following is a logical error?
a. Missing semicolon b. Mismatched braces in classes and methods.
c. Misspelled keywords and identifiers. d. Addition is required but subtraction is performed.
Question 2
(i) Give the output of the following expression:
a+=a++ + ++a + --a + a--; when a=7.
(ii) Write java expression for-

(iii) Rewrite the following using ternary operators-


(iv) if(x%2==0)
System.out.print(“EVEN”);

2022-2023/Grade X/ Assessment I/Computer Application Page 2 of 5


else

System.out.print(“ODD”);
(iv) Convert the following while loop to the corresponding for loop:
int m = 5, n = 10; while (n>=1)
{
System.out.println(m*n); n-
-;
}

(v) Analyze the given program segment and answer the following questions:
for(int i=3;i<=4;++)
{
System.out.println (“WIN”);
}
i. How many times does the inner loop execute?
ii. Write the output of the program segment.
(vi) Give the output of the following string functions:
“ACHIEVEMENT”.replace(‘E’,‘A’).toLowerCase()
(vii) Write the output for the following:
String s= “Today is Test”;
System.out.println(s.indexOf(‘T’));
(viii) Define Unboxing with an example (ix)
In the program given below:

class MyClass
{
static int x = 7;
int y = 2;
public static void main(String args[ ])
{
MyClass obj = new MyClass();
System.out.println(x);
obj.sampleMethod(5); int
a= 6;
System.out.println(a);
}
void sampleMethod(int n)
{
System.out.println(n);
System.out.println(y);
}
}
State the name of the following-:

2022-2023/Grade X/ Assessment I/Computer Application Page 3 of 5


(i) method argument or argument variable.
(ii) instance variable.

(x) Write the function prototype for the function “sum” that takes an integer variable (x) as its
argument and returns a value of float data type.

SECTION B

Each program should have Variable Description


Question 3
Write a class with the name volume using function overloading that computes the volume of
a cube, a sphere and a cuboid. Formula: volume of a cube (vc) = s*s*s
volume of a sphere (vs) = 4/3 * pi * r * r * r (where pi = 3.14 )
Volume of a cuboid (vcd) = l * b * h

Question 4
A cloth showroom has announced the following festival discounts on the purchase of items, based
on the total cost of the items purchased:
Total Cost Discount (in Percentage)
Less than ₹ 2000 5%
₹ 2001 to ₹ 5000 25%
₹ 5001 to ₹ 10000 35%
Above ₹ 10000 50%
Write a program to input the total cost and compute and display the amount to be paid by the
customer after availing the discount.

Question 5
Write a program to input a sentence and count the number of vowels and consonants in it.
Question 6
Create a class SalaryCalculation that is described as below:
Class Name : SalaryCalculation Data
members : name (String type data)
basicPay, specialAlw, conveyanceAlw, gross, pf, netSalary AnnualSal (All double type data)

Member methods :
i. SalaryCalculation( ) - A constructor to assign name of employee (name), basic salary
(basicPay) of your choice and conveyance allowance

2022-2023/Grade X/ Assessment I/Computer Application Page 4 of 5


(conveyanceAlw) As ` 1000.00 ii. void SalaryCal( ) - to calculate other
allowances and salaries as given:

specialAlw = 25% of basic salary. gross =


basicPay + specialAlw + conveyanceAlw.
netSalary = gross - pf.
AnnualSal = 12 months netSalary.
iii. void display( ) - to print the name and other calculations with suitable headings.

Write a program in Java to calculate all the details mentioned above and print them all.

Question 7
Write a program to input a string and print out the text with the uppercase and lowercase letters reversed, but all
other character remains the same as before. Example: Input- ComPuteR aPPliCatiOn
Output- cOMpTEr AppLIcATIoN

Question 8

Write a menu driven program to perform the following task according to users choice: a)
Print the following series: 0,7,26,63…. N terms.
b) Print the sum of the following series: 1/1!-2/4!+3/9!-4/16!..n terms

2022-2023/Grade X/ Assessment I/Computer Application Page 5 of 5

You might also like