Advertisements
Chapters
1.2: Elementary Concept of Objects and Classes
1.3: Values and Data Types
1.4: Operators in Java
1.5: Introduction to Java
1.5: Input in Java
1.6: Mathematical Library Methods
1.7: Conditional Statements in Java
1.8: Iterative Constructs in Java
1.9: Nested Loop
2: Library Classes
3: Arrays (Single Dimensional and Double Dimensional)
4: String Handling
5: User - Defined Methods
▶ 6: Class as the Basis of all Computation (Objects and Classes)
7: Constructors
8: Encapsulation and Inheritance
![Avichal solutions for Computer Applications [English] Class 10 ICSE chapter 6 - Class as the Basis of all Computation (Objects and Classes) Avichal solutions for Computer Applications [English] Class 10 ICSE chapter 6 - Class as the Basis of all Computation (Objects and Classes) - Shaalaa.com](/images/computer-applications-english-class-10-icse_6:1e1eb1b47d2b4696b609e5cd9260118f.jpg)
Advertisements
Solutions for Chapter 6: Class as the Basis of all Computation (Objects and Classes)
Below listed, you can find solutions for Chapter 6 of CISCE Avichal for Computer Applications [English] Class 10 ICSE.
Avichal solutions for Computer Applications [English] Class 10 ICSE 6 Class as the Basis of all Computation (Objects and Classes) Review Insight [Pages 380 - 381]
What is meant by private member method?
Differentiate between private and protected visibility modifiers.
Name the keyword that informs that an error has occurred in an input/ output operation.
Name the keyword that distinguishes between instant variables and class variables.
Differentiate between public and private modifiers for the members of a class.
In the program given below, state the name and the value of the
- method argument or argument variable
- class variable
- local variable
- instance variable
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);
}
}
Name the keyword which: indicates that a method has no return type.
Name the Java keyword that stores the address of the currently calling object.
Identify the statement given below as assignment, increment, method invocation or object creation statement.
System.out.println(“Java”);
Identify the statement given below as assignment, increment, method invocation or object creation statement.
costPrice = 457.50;
Identify the statement given below as assignment, increment, method invocation or object creation statement.
Car hybrid = new Car();
Identify the statement given below as assignment, increment, method invocation or object creation statement.
petrolPrice++;
List the variables from those given below that are composite data types:
- static int x;
- arr[i]=10;
- obj.display();
- boolean b;
- private char chr;
- String str;
Consider the following class:
public class MyClass
{
public static int x - 3, y = 4;
public int a = 2, b = 3;
}
- Name the variables for which each object of the class will have its own distinct copy.
- Name the variables that are common to all objects of the class.
The access specifier that gives the most accessibility is _______ and the least accessibility is ________.
Name the keyword which is used to resolve the conflict between method parameter and instance variables/fields.
Name any two types of access specifiers.
A class is a blueprint or prototype or template to create similar objects. Each object of the class contains the characteristics and behaviour described within the class. The characteristics and behaviour of a real world object resemble data and functions (methods) of a software object. You can use a data field that is common for all the objects of the class. The data members of a class can be declared such that their scope can be limited to the scope of the class or entire program. Java language also provides the keyword to distinguish the current object from the object passed to the method.
Based on the above discussion, answer the following questions:
- An object is also called ______ of a class.
- substance
- instance
- resonance
- None
- The data members declared within a class is also termed as:
- instance variables
- local variables
- global variables
- temporary variables
- What type of data is accessible only within the scope of a class?
- public
- protected
- private
- secure
- Name the keyword which distinguishes current object and the object passed to the method.
- new
- final
- static
- this
Avichal solutions for Computer Applications [English] Class 10 ICSE 6 Class as the Basis of all Computation (Objects and Classes) EXERCISES [Pages 382 - 389]
Multiple Choice Questions:
Which keyword makes class members accessible outside the class in which they are declared?
Private
Protected
Public
Hidden
Find the access specifier which prohibits a class member from being used outside a class:
Private
Public
Protected
None
A class object is also known as:
Identifier
Instance variable
Specifier
Modifier
Which of the following statements is the most appropriate for the private members?
They are visible out of the class in which they are defined.
They can be used in the sub-classes.
They are only visible in the class in which they are declared.
None of the above.
Which of the following keywords are used to control access to a class member?
Default
Abstraction
Protected
Interface
Which of the members can be accessed globally?
Private
Public
Protected
All of the above
The maximum number of objects of a class can be created as:
1
2
On the user's choice
Number of variables
A class contains:
Attributes and methods.
A number of object of same types.
Data and member function.
All of the above.
Which of the following features is not the principle of OOP?
Encapsulation
Transparency
Inheritance
Polymorphism
A package is a:
Collection of data.
Collection of functions.
Collection of classes.
A nested class.
Fill in the blanks with appropriate words:
Primitive data types are also called as ______ data types.
A user defined data type can be created by using a/an ______.
______ keyword represents the current object in the member method.
______ members are accessible from anywhere in the program.
If no access specifier is mentioned then ______ specifier is referred by default.
______ members are accessible only within the same class.
______ members are accessible in its own class as well as in a sub class.
Case-Study based question:
Given below is a class based program to accept name and price of an article and find the amount after 12% discount if the price exceeds 10,000 otherwise, discount is nil. There are some places in the program left blank marked with ?1?, ?2?, ?3? and ?4? to be filled with appropriate keyword/expression.
class Discount
{
int pr; double d, amt; String nm;
Scanner ob = ....?1?..... Scanner(System.in);
void input( )
{
System.out.println("Enter customer's name:");
nm= ....?2?.... ;
System.out.println("Enter price of the article:");
pr = ob.nextlnt( );
}
void calculate()
{
if (...?3?...)
d = ......?4?..... ;
else
d = 0;
amt = pr - d;
}
void print()
{
System.out.println("Name = " + nm);
System.out.println(" Amount to be paid = " + amt);
}
Based on the above discussion, answer the following questions:
- What will be keyword/ expression filled in place of ?1?
- What will be keyword/expression filled in place of ?2?
- What will be keyword/expression filled in place of ?3?
- What will be keyword/expression filled in place of ?4?
Answer the following questions:
Why is a class known as composite data type?
Name the types of data used in a class.
What is the purpose of the new operator?
Can a class be referred to as user defined data type? Comment.
What is public access of a class?
How are private members of a class different from public members?
Mention any two attributes required for class declaration.
Explain instance variables.
Give an example of instance variables.
Explain any two types of access specifiers.
What is meant by private visibility of a method?
Answer the questions given below (Long answer type):
'Object is an Instance of a class.' Explain this statement.
Differentiate between built-in data types and user defined data types.
Which of the following declarations are illegal and why?
- class abc(...)
- public class NumberOfDaysWorked(...)
- private int x;
- private class abc(...)
- default key getkey(...)
Why can't every class be termed as user defined data type?
Differentiate between static data members and non-static data members.
Differentiate between private and protected visibility modifiers.
State any one difference between instance variable and class variable.
Unsolved Programs based on Class:
Define a class Calculate to accept two numbers as instance variables. Use the following member methods for the given purposes:
Class name: Calculate
Data members: int a, int b
Member methods:
void inputdata(): to input both the values
void calculate(): to find sum and difference
void outputdata(): to print sum and difference of both the numbers.
Use a main method to call the functions.
Define a class Triplet with the following specifications:
Class name: Triplet
Data members: int a, int b, int c
Member methods:
void getdata(): to accept three numbers
void findprint(): to check and display whether the numbers are Pythagorean Triplets or not.
Define a class Employee having the following description:
Class name: Employee
Data members/Instance variables
int pan: to store personal account number
String name: to store name
double tax income: to store annual taxable income
double tax: to store tax that is calculated
Member functions:
void input(): Store the pan number, name, taxable income
void cal(): Calculate tax on taxable income.
void display(): Output details of an employee
Calculate tax based on the given conditions and display the output as per the given format.
Total Annual Taxable Income | Tax Rate |
Up to ₹ 2,50,000 | No tax |
From ₹ 2,50,001 to ₹ 5,00,000 | 10% of the income exceeding ₹ 2,50,000 |
From ₹ 5,00,001 to ₹ 10,00,000 | ₹ 30,000 + 20% of the income exceeding ₹ 5,00,000 |
Above ₹ 10,00,000 | ₹ 50,000 + 30% of the income exceeding ₹ 10,00,000 |
Output: | Pan Number | Name | Tax-Income | Tax |
................... | ................... | ................... | ................... | |
................... | ................... | ................... | ................... | |
................... | ................... | ................... | ................... | |
................... | ................... | ................... | ................... |
Define a class Discount having the following description:
Class name: Discount
Data members
int cost: to store the price of an article
String name: to store the customer's name
double dc: to store the discount
double amt: to store the amount to be paid
Member methods:
void input(): Stores the cost of the article and name of the customer.
void cal(): Calculates the discount and amount to be paid
Void display(): Displays the name of the customer, cost, discount and amount to be paid
Write a program to compute the discount according to the given conditions and display the output as per the given format.
List Price | Rate of discount |
Up to ₹ 5,000 | No discount |
From ₹ 5,001 to ₹ 10,000 | 10% on the list price |
From ₹ 10,001 to ₹ 15,000 | 15% on the list price |
Above ₹ 15,000 | 20% on the list price |
Output: | Name of the customer | Discount | Amount to be paid |
........................... | ........................... | ........................... | |
........................... | ........................... | ........................... | |
........................... | ........................... | ........................... |
Define a class Telephone having the following description:
Class name: Telephone
Data members
int prv, pre: to store the previous and present meter readings
int call: to store the calls made (i.e. pre − prv)
String name: to store name of the consumer
double amt: to store the amount
double total: to store the total amount to be paid
Member function:
void input(): Stores the previous reading, present reading and name of the consumer
void cal(): Calculates the amount and total amount to be paid
void display(): Displays the name of the consumer, calls made, amount and total amount to be paid
Write a program to compute the monthly bill to be paid according to the given conditions and display the output as per the given format.
Calls made | Rate |
Up to 100 calls | No charge |
For the next 100 calls | 90 paise per calls |
For the next 200 calls | 80 paise per calls |
More than 400 calls | 70 paise per calls |
However, every consumer has to pay ₹ 180 per month as monthly rent for availing the service.
Output: | Name of the customer | Calls made | Amount to be paid |
........................... | ........................... | ........................... | |
........................... | ........................... | ........................... |
Define a class Interest having the following description:
Class name: Interest
Data members:
int p: to store principal (sum)
int r: to store rate
int t: to store time
double interest: to store the interest to be paid
double amt: to store the amount to be paid
Member methods:
void input(): Stores the principal, rate, time
void cal(): Calculates the interest and amount to be paid
void display(): Displays the principal, interest and amount to be paid
Write a program to compute the interest according to the given conditions and display the output.
Time | Rate of interest |
For 1 year | 6.5% |
For 2 years | 7.5% |
For 3 years | 8.5% |
For 4 years or more | 9.5% |
(Note: Time to be taken only in whole years)
Define a class Library having the following description:
Class name : Library
Data members
String name: to store name of the book
int price: to store the printed price of the book
int day : to store the number of days for which fine is to be paid
double fine: to store the fine to be paid
Member methods:
void input(): To accept the name of the book and printed price of the book
void cal(): Calculates the fine to be paid
void display(): Displays the name of the book and fine to be paid
Write a program to compute the fine according to the given conditions and display the fine to be paid.
Days | Fine |
First seven days | 25 paise per day |
Eight to fifteen days | 40 paise per day |
Sixteen to thirty days | 60 paise per day |
More than thirty days | 80 paise per day |
Bank charges interest for the vehicle loan as given below:
Number of years | Rate of interest |
Up to 5 years | 15% |
More than 5 and up to 10 years | 12% |
Above 10 years | 10% |
Write a program to model a class with the specifications given below:
Class name : Loan
Data members/Instance variables
int time: Time for which loan is sanctioned
double principal: Amount sanctioned
double rate: Rate of interest
double interest: To store the interest
double amt: Amount to pay after given time
Member Methods:
void getdata(): to accept principal and time.
void calculate(): to find interest and amount.
Interest = (Principal*Rate*Time)/100
Amount = Principal + Interest
void display(): to display interest and amount.
Hero Honda has increased the cost of its vehicles as per the type of the engine using the following criteria:
Type of Engine | Rate of increment |
2 stroke | 10% of the cost |
4 stroke | 12% of the cost |
Write a program by using a class to find the new cost as per the given specifications:
Class name: Honda
Data members/Instance variables
int type: to accept type of engine 2 stroke or 4 stroke
int cost: to accept previous cost
Member Methods:
void gettype(): to accept the type of engine and previous cost
void find(): to find the new cost as per the criteria given above
void printcost(): to print the type and new cost of the vehicle
Define a class called 'Mobike' with the following specifications:
Class name : Mobike
Instance variables/Data members:
int bno: to store the bike number
int phno: to store the phone number of the customer
String name: to store the name of the customer
int days: to store the number of days the bike is taken on rent
int charge: to calculate and store the rental charge
int charge: to calculate and store the rental charge
Member methods:
void input(): to input and store the details of the customer
void compute(): to compute the rental charge
The rent for a mobike is charged on the following basis:
For first five days: ₹ 500 per day
For next five days: ₹ 400 per day
Rest of the days: ₹ 200 per day
void display(): to display the details in the following format:
Bike No. | Phone No. | Name | No. of days | Charge |
xxxxxx | xxxxxxxx | xxxxxxxxx | xxx | xxxxxx |
Write a program using a class with the following specifications:
Class name: Caseconvert
Data members: String str
Member functions:
void getstr(): to accept a string
void convert(): to obtain a string after converting each uppercase letter into lowercase and vice versa.
void display(): to print the converted string.
Write a program by using a class with the following specifications:
Class name: Vowel
Data members: string s; int c(to count vowels)
Member functions:
void getstr(): to accept a string
void getvowel(): to count the number of vowels
void display(): to print the number of vowels.
A bookseller maintains record of books belonging to the various publishers. He uses a class with the specifications given below:
Class name: Stock
Data members/Instance variables
String title: Contains title of the book.
String author: Contains author name.
String pub: Contains publisher's name.
int noc: Number of copies.
Member Methods:
void getdata(): to accept title, author, publisher's name and the number of copies.
void purchase(int t, String a, String p, int n): to check the existence of the book in the stock by comparing total, author's and publisher's name. Also check whether noc >nor not.
If yes, maintain the balance as noc-n, otherwise display book is not available or stock is under flowing.
Write a program to perform the task given above.
Write a program by using class with the following specifications:
Class name: Characters
Data members/Instance variables
str: String
Member Methods:
void input (String st): to assign st to str
void check_print(): to check and print the following:
- number of letters
- number of digits
- number of uppercase characters
- number of lowercase characters
- number of special characters
Define a class Student with the following specifications:
Class name: Student
Instance variables/Data Members:
String name: to store the name of the student
int eng: to store marks in English
int hn: to store marks in Hindi
int mts: to store marks in Maths
double total: to store total marks
double avg: to store average marks
Member methods:
void accept(): to input marks in English, Hindi and Maths
void compute(): to calculate total marks and average of 3 subjects
void display(): to show all the details viz. name, marks, total and average
Write a program to create an object and invoke the above methods.
Define a class called ParkingLot with the following description:
Class name: ParkingLot
Instance variables/Data members:
int vno: to store the vehicle number
int hours: to store the number of hours the vehicle is parked in the parking lot
double bill: to store the bill amount
Member methods:
void input(): to input the vno and hours
void calculate(): to compute the parking charge at the rate ₹ 3 for the first hour or the part thereof and ₹ 1.50 for each additional hour or part thereof.
void display(): to display the detail
Write a main method to create an object of the class and call the above methods.
Design a class Railway Ticket with following description:
Instance variables/data members:
String name: To store the name of the customer
String coach: To store the type of coach customer wants to travel
long mob no: To store customer’s mobile number
int amt: To store a basic amount of ticket
int total amt: To store the amount to be paid after updating the original amount
Member methods
void accept (): To take input for a name, coach, mobile number and amount
void update (): To update the amount as per the coach selected
(extra amount to be added in the amount as follows)
Type of Coaches | Amount |
First_ AC | 700 |
Second_AC | 500 |
Third _AC | 250 |
sleeper | None |
void display(): To display all details of a customer such as a name, coach, total amount and mobile number.
Write a main method to create an object of the class and call the above member methods.
Solutions for 6: Class as the Basis of all Computation (Objects and Classes)
![Avichal solutions for Computer Applications [English] Class 10 ICSE chapter 6 - Class as the Basis of all Computation (Objects and Classes) Avichal solutions for Computer Applications [English] Class 10 ICSE chapter 6 - Class as the Basis of all Computation (Objects and Classes) - Shaalaa.com](/images/computer-applications-english-class-10-icse_6:1e1eb1b47d2b4696b609e5cd9260118f.jpg)
Avichal solutions for Computer Applications [English] Class 10 ICSE chapter 6 - Class as the Basis of all Computation (Objects and Classes)
Shaalaa.com has the CISCE Mathematics Computer Applications [English] Class 10 ICSE CISCE solutions in a manner that help students grasp basic concepts better and faster. The detailed, step-by-step solutions will help you understand the concepts better and clarify any confusion. Avichal solutions for Mathematics Computer Applications [English] Class 10 ICSE CISCE 6 (Class as the Basis of all Computation (Objects and Classes)) include all questions with answers and detailed explanations. This will clear students' doubts about questions and improve their application skills while preparing for board exams.
Further, we at Shaalaa.com provide such solutions so students can prepare for written exams. Avichal textbook solutions can be a core help for self-study and provide excellent self-help guidance for students.
Concepts covered in Computer Applications [English] Class 10 ICSE chapter 6 Class as the Basis of all Computation (Objects and Classes) are Introduction to Object Oriented Programming (OOP), Class & Objects, Different types of Variables, Different Types of Methods, This Keyword.
Using Avichal Computer Applications [English] Class 10 ICSE solutions Class as the Basis of all Computation (Objects and Classes) exercise by students is an easy way to prepare for the exams, as they involve solutions arranged chapter-wise and also page-wise. The questions involved in Avichal Solutions are essential questions that can be asked in the final exam. Maximum CISCE Computer Applications [English] Class 10 ICSE students prefer Avichal Textbook Solutions to score more in exams.
Get the free view of Chapter 6, Class as the Basis of all Computation (Objects and Classes) Computer Applications [English] Class 10 ICSE additional questions for Mathematics Computer Applications [English] Class 10 ICSE CISCE, and you can use Shaalaa.com to keep it handy for your exam preparation.