English

Avichal solutions for Computer Applications [English] Class 10 ICSE chapter 6 - Class as the Basis of all Computation (Objects and Classes) [Latest edition]

Advertisements

Chapters

Avichal solutions for Computer Applications [English] Class 10 ICSE chapter 6 - Class as the Basis of all Computation (Objects and Classes) - Shaalaa.com
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.


Review InsightEXERCISES
Review Insight [Pages 380 - 381]

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]

Review Insight | Q 1. | Page 380

What is meant by private member method? 

Review Insight | Q 2. | Page 380

Differentiate between private and protected visibility modifiers.

Review Insight | Q 3. (i) | Page 380

Name the keyword that informs that an error has occurred in an input/ output operation. 

Review Insight | Q 3. (ii) | Page 380

Name the keyword that distinguishes between instant variables and class variables. 

Review Insight | Q 4. | Page 380

Differentiate between public and private modifiers for the members of a class. 

Review Insight | Q 5. | Page 380

In the program given below, state the name and the value of the

  1. method argument or argument variable
  2. class variable
  3. local variable
  4. 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);
  }
}
Review Insight | Q 6. (i) | Page 380

Name the keyword which: indicates that a method has no return type.

Review Insight | Q 6. (ii) | Page 380

Name the Java keyword that stores the address of the currently calling object.

Review Insight | Q 7. (i) | Page 381

Identify the statement given below as assignment, increment, method invocation or object creation statement.

System.out.println(“Java”); 

Review Insight | Q 7. (ii) | Page 381

Identify the statement given below as assignment, increment, method invocation or object creation statement.

costPrice = 457.50; 

Review Insight | Q 7. (iii) | Page 381

Identify the statement given below as assignment, increment, method invocation or object creation statement. 

Car hybrid = new Car(); 

Review Insight | Q 7. (iv) | Page 381

Identify the statement given below as assignment, increment, method invocation or object creation statement. 

petrolPrice++;

Review Insight | Q 8. | Page 381

List the variables from those given below that are composite data types:

  1. static int x;
  2. arr[i]=10;
  3. obj.display();
  4. boolean b;
  5. private char chr;
  6. String str; 
Review Insight | Q 9. | Page 381

Consider the following class: 

public class MyClass 
{ 
public static int x - 3, y = 4; 
public int a = 2, b = 3; 
}
  1. Name the variables for which each object of the class will have its own distinct copy.
  2. Name the variables that are common to all objects of the class.
Review Insight | Q 10. | Page 381

The access specifier that gives the most accessibility is _______ and the least accessibility is ________.

Review Insight | Q 11. | Page 381

Name the keyword which is used to resolve the conflict between method parameter and instance variables/fields. 

Review Insight | Q 12. | Page 381

Name any two types of access specifiers.

Review Insight | Q 13. | Page 381

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:

  1. An object is also called ______ of a class.
    1. substance
    2. instance
    3. resonance
    4. None
  2. The data members declared within a class is also termed as:
    1. instance variables
    2. local variables
    3. global variables
    4. temporary variables
  3. What type of data is accessible only within the scope of a class? 
    1. public
    2. protected
    3. private
    4. secure
  4. Name the keyword which distinguishes current object and the object passed to the method.
    1. new
    2. final
    3. static
    4. this
EXERCISES [Pages 382 - 389]

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:

EXERCISES | Q I. 1. | Page 382

Which keyword makes class members accessible outside the class in which they are declared?

  • Private

  • Protected

  • Public

  • Hidden

EXERCISES | Q I. 2. | Page 382

Find the access specifier which prohibits a class member from being used outside a class: 

  • Private

  • Public

  • Protected

  • None 

EXERCISES | Q I. 3. | Page 382

A class object is also known as:

  • Identifier

  • Instance variable

  • Specifier

  • Modifier 

EXERCISES | Q I. 4. | Page 382

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. 

EXERCISES | Q I. 5. | Page 382

Which of the following keywords are used to control access to a class member? 

  • Default

  • Abstraction

  • Protected

  • Interface

EXERCISES | Q I. 6. | Page 382

Which of the members can be accessed globally?

  • Private

  • Public

  • Protected

  • All of the above

EXERCISES | Q I. 7. | Page 382

The maximum number of objects of a class can be created as:

  • 1

  • 2

  • On the user's choice

  • Number of variables

EXERCISES | Q I. 8. | Page 382

A class contains: 

  • Attributes and methods.

  • A number of object of same types.

  • Data and member function.

  • All of the above.

EXERCISES | Q I. 9. | Page 382

Which of the following features is not the principle of OOP?

  • Encapsulation

  • Transparency

  • Inheritance

  • Polymorphism

EXERCISES | Q I. 10. | Page 382

A package is a:

  • Collection of data.

  • Collection of functions.

  • Collection of classes.

  • A nested class.

Fill in the blanks with appropriate words:

EXERCISES | Q II. 1. | Page 382

Primitive data types are also called as ______ data types. 

EXERCISES | Q II. 2. | Page 382

A user defined data type can be created by using a/an ______.

EXERCISES | Q II. 3. | Page 383

______ keyword represents the current object in the member method.

EXERCISES | Q II. 4. | Page 383

______ members are accessible from anywhere in the program. 

EXERCISES | Q II. 5. | Page 383

If no access specifier is mentioned then ______ specifier is referred by default.

EXERCISES | Q II. 6. | Page 383

______ members are accessible only within the same class. 

EXERCISES | Q II. 7. | Page 383

______ members are accessible in its own class as well as in a sub class. 

Case-Study based question:

EXERCISES | Q III. | Page 383

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:

  1. What will be keyword/ expression filled in place of ?1?
  2. What will be keyword/expression filled in place of ?2?
  3. What will be keyword/expression filled in place of ?3?
  4. What will be keyword/expression filled in place of ?4? 

Answer the following questions:

EXERCISES | Q IV. 1. | Page 383

Why is a class known as composite data type?

EXERCISES | Q IV. 2. | Page 383

Name the types of data used in a class.

EXERCISES | Q IV. 3. | Page 383

What is the purpose of the new operator?

EXERCISES | Q IV. 4. | Page 383

Can a class be referred to as user defined data type? Comment.

EXERCISES | Q IV. 5. | Page 384

What is public access of a class?

EXERCISES | Q IV. 6. | Page 384

How are private members of a class different from public members?

EXERCISES | Q IV. 7. | Page 384

Mention any two attributes required for class declaration. 

EXERCISES | Q IV. 8. (i) | Page 384

Explain instance variables. 

EXERCISES | Q IV. 8. (ii) | Page 384

Give an example of instance variables.

EXERCISES | Q IV. 9. | Page 384

Explain any two types of access specifiers. 

EXERCISES | Q IV. 10. | Page 384

What is meant by private visibility of a method? 

Answer the questions given below (Long answer type):

EXERCISES | Q V. 1. | Page 384

'Object is an Instance of a class.' Explain this statement. 

EXERCISES | Q V. 2. | Page 384

Differentiate between built-in data types and user defined data types. 

EXERCISES | Q V. 3. | Page 384

Which of the following declarations are illegal and why? 

  1. class abc(...)
  2. public class NumberOfDaysWorked(...)
  3. private int x;
  4. private class abc(...)
  5. default key getkey(...)
EXERCISES | Q V. 4. | Page 384

Why can't every class be termed as user defined data type?

EXERCISES | Q V. 5. | Page 384

Differentiate between static data members and non-static data members. 

EXERCISES | Q V. 6. | Page 384

Differentiate between private and protected visibility modifiers.

EXERCISES | Q V. 7. | Page 384

State any one difference between instance variable and class variable.

Unsolved Programs based on Class:

EXERCISES | Q VI. 1. | Page 384

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. 

EXERCISES | Q VI. 2. | Page 384

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.

EXERCISES | Q VI. 3. | Page 384

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
  ................... ................... ................... ...................
  ................... ................... ................... ...................
  ................... ................... ................... ...................
  ................... ................... ................... ...................
EXERCISES | Q VI. 4. | Page 385

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
  ........................... ........................... ...........................
  ........................... ........................... ...........................
  ........................... ........................... ...........................
EXERCISES | Q VI. 5. | Page 385

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
  ........................... ........................... ...........................
  ........................... ........................... ...........................
EXERCISES | Q VI. 6. | Page 386

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)

EXERCISES | Q VI. 7. | Page 386

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 
EXERCISES | Q VI. 8. | Page 387

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. 

EXERCISES | Q VI. 9. | Page 387

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 

EXERCISES | Q VI. 10. | Page 387

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
EXERCISES | Q VI. 11. | Page 388

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.

EXERCISES | Q VI. 12. | Page 388

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. 

EXERCISES | Q VI. 13. | Page 388

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. 

EXERCISES | Q VI. 14. | Page 388

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:

  1. number of letters
  2. number of digits
  3. number of uppercase characters
  4. number of lowercase characters
  5. number of special characters
EXERCISES | Q VI. 15. | Page 389

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.

EXERCISES | Q VI. 16. | Page 389

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.

EXERCISES | Q VI. 17. | Page 389

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)

Review InsightEXERCISES
Avichal solutions for Computer Applications [English] Class 10 ICSE chapter 6 - Class as the Basis of all Computation (Objects and Classes) - Shaalaa.com

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.

Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×