0% found this document useful (0 votes)
18 views4 pages

Grade 10 Computer Worksheet-DF.1732359404

Uploaded by

ditu2409
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

Grade 10 Computer Worksheet-DF.1732359404

Uploaded by

ditu2409
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Unit II Revision Worksheet

Grade-10 Subject: Computer


Q.1) Read the given segments of program and answer the questions that follow
1) class Customer {
private long Cust_id;
String Cust_name;
Customer(long id, String n) {
Cust_id=id;
Cust_name=n;
}
public char funct() {
System.out.println(Cust_id+" "+Cust_name);
char chr='#';
return chr;
}
a) Write the access specifier of the class Customer.
b) What is the scope of member Cust_id;
c) Name the members of the class that can be accessed in another class namely
"Account"
d) Name the members of the class that can be accessed in the main method
contained in the same class Customer.
e) Define the main method that invokes the constructor and the member functions of
the class.
2) class Record {
public void method_Info(String x) { char a='A', b='a'; int c= a+++b;
}
a) What value is stored in c after the method gets executed?
b) What is the value stored in a after the execution of the method?
c) Define the main method which calls the above method_Info.
d) Modify method_Info so that the resultant c is displayed on the screen.
3) class MyClass {
short roll_no;
long candidate_code;
String cand_name;
}
a) Define a member method of the class, that displays the cand_name,
candidate_code and roll_no, the values being assigned as "ASTITVA", 2005123 and
20 respectively.
b) Write the Java statement that calls the above defined method.
c) What happens if an object of the above class is created in another class
"Set_Account
d) What happens if the statement short roll_no is changed to private short roll_no=25
4) public static int operate(int a, int b) {
int c=a++ +++a-a;
int d=c+b- +--b;
return d;
}
a) Write a single statement that calls the method operate if it is a member of class
"Mathematics".
b) What happens if an object 'obct' of class Mathematics directly invokes the variables
c and d in another static method as follows: System.out.println(obct.c+obct.d);
c) What will be the final resultant values in c and d, if a and b are passed as 5 and 10
respectively?
5) public void displayMessage(void) {
System.out.print("NET_SAVVY");
System.out.print("-FOLLOW NETETIQUETTES-");
System.out.println();
System.out.println("********************");
}
a) What happens if the following statement is written in public static void main() to
call the function: display Message t
b) Write the output of the method.
6) public boolean func(int a) (
int c= a%a +++++ a- + +a ;
System.out.println(c);
boolean d=false;
return d;
}
a) Write one statement that calls the above method in another non-static method
named getvalue().
b) What will be the output of the above defined method for: func(20)?
Q.2) Write a JAVA prog:
1) Define a class called with the following specifications:
Class name: Eshop
Member variables:
String name: name of the item purchased
double price: Price of the item purchased
Member methods:
void accept(): Accept the name and the price of the item using the methods of Scanner
class.
void calculate(): To calculate the net amount to be paid by a customer, based on the
following criteria:

Price Discount

1000 – 25000 5.0%

25001 – 57000 7.5 %

57001 – 100000 10.0%

More than 100000 15.0 %

void display(): To display the name of the item and the net amount to be paid.
Write the main method to create an object and call the above methods.
2) Define a class to overload the method display as follows:
void display( ): To print the following format using nested loop
1
12
123
1234
12345
void display(int n): To print the square root of each digit of the given number.
Example:
n = 4329
Output – 3.0
1.414213562
1.732050808
2.0
Q.3) Design a class with the following specifications:
Class name: Student
Member variables:
name — name of student
age — age of student
mks — marks obtained
stream — stream allocated
(Declare the variables using appropriate data types)
Member methods:
void accept() — Accept name, age and marks using methods of Scanner class.
void allocation() — Allocate the stream as per following criteria:

mks stream

>= 300 Science and Computer

>= 200 and < 300 Commerce and Computer

>= 75 and < 200 Arts and Animation

< 75 Try Again

void print() – Display student name, age, mks and stream allocated.
Call all the above methods in main method using an object.
Q.4) Define a class to overload the function print as follows:
void print() - to print the following format
1 1 1 1
2 2 2 2
3 3 3 3
4 4 4 4
5 5 5 5
void print(int n) - To check whether the number is a lead number. A lead number is
the one whose sum of even digits are equal to sum of odd digits.
e.g. 3669
odd digits sum = 3 + 9 = 12
even digits sum = 6 + 6 = 12
3669 is a lead number.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy