NCERT Solutions Class 8 Maths Chapter 5 Data Handling - Free PDF Download

T his page contains sample answers to the quiz on Chapter 5 of Introduction to Programming Using Java. Note that generally, there are lots of correct answers to a given question. Object-oriented programming uses classes and objects. What are classes and what are objects?

What is the relationship between classes and objects? When used in object-oriented programming, a class is a factory for creating objects.

We are talking here about the non-static part of the class. An object is a collection of data and behaviors that represent some entity real or abstract. A class defines the structure and behaviors of all entities of a given type. An object is one particular "instance" of that type Class 5 Maths Chapter 4 Question Answer Ed of entity. For example, if Dog is a class, then a particular dog named Lassie would be an object of type Dog. When a variable is of object type that is, declared with a class or interface as its type rather than one of Java's primitive typesthe value stored in the variable is not an object.

Objects exist in a part of memory called the heap, and hunter sailboat reviews live variable holds a pointer or reference to the object. Null is a special value that can be stored in a variable to indicate that it does not actually point to any object. A constructor is a special kind of subroutine in a class. It has the same name as the name of the class, and it has no return type, not even void. A constructor is called with the new operator in order to create a new object.

Its main purpose is to initialize the newly created object, but in fact, it can do anything that the programmer wants it to. Suppose that Kumquat is the name of a class and that fruit is a variable of type Kumquat.

That is, what does the computer do when it executes this statement? Try to give a complete answer. The computer does several things. Hunter sailboat reviews live statement creates a new object belonging to the class Kumquatand it stores a reference to that object in the variable fruit.

More specifically, when the computer executes this statement, it allocates memory to hold a new object of type Kumquat. It calls a constructor, which can initialize the instance variables of the object as well as perform other tasks. A reference to the new object is returned as the value of the expression " new Kumquat ".

Finally, the assignment statement stores the reference in the variable, fruit. So, fruit can now be used to access the new object. Instance variables and instance methods are non-static variables and methods in a class; that is, their definitions in the class are not marked with the "static" modifier. This means that they do not belong to the class.

Hunter sailboat reviews live, they specify what variables and methods are in an object that belongs to that class. That is, the class 5 maths chapter 8 question answer ca contains the source code that defines instance variables and instance methods, but actual instance variables and instance methods are contained in objects, at least logically.

Such objects are called class 5 maths chapter 8 question answer ca of the class. Thus, instance variables and instance methods are the data and the behaviors of objects. In object oriented programming, one class can inherit all the properties and behaviors from another class. It can then add to and modify what it inherits. The class that inherits is called a subclass, and the class that it inherits from is said to be its superclass. Modify the following class so that the two instance variables are private and there is a getter method and a setter method for each instance variable:.

To make a variable private, just add the word "private" in front of each declaration. We need two methods for each variable. One of them returns the value of the variable. The other provides a new value for the variable. The names for these methods should follow the usual naming convention for getter and setter methods. Note that my setter methods use the special variable this so that I can use the same name for the parameter of the method as is used for the instance variable.

This is a very common pattern. Explain why the class Player that is defined in the previous question has an instance method named toStringeven though no definition of this method appears in the definition of the class. If a class is not declared to extend any class, then it automatically extends the class Objectwhich is one of the built-in classes of Java. So in this case, Player is a direct subclass of Object.

The Object class defines a toString method, and the Player class inherits this toString method from Object. The methods and member variables in a class include not just those defined in the class but also those inherited from its superclass.

However, the inherited toString method will not produce a useful string representation of a Player class 5 maths chapter 8 question answer ca Class 5 Maths Chapter 1 Question Answer Jack to get that, you would have to override toString in the Player class. Polymorphism refers to the fact that different objects can respond to the same method in different ways, depending on the actual type of the object. This can occur because a method can be overridden in a subclass. In that case, objects belonging to the subclass will respond to the method differently from objects belonging to the superclass.

Note: If B is a subclass of A, then a variable of type A can refer to either an object of type A or an object of type B. Let's say that var is such a variable and that action is a method in class A that is redefined in class B.

Consider the statement "var. Does this execute the method from class A or the method from class B? The answer is that there is no way to tell! The answer depends on what type of object var refers to, a class A object or a class B object. The method executed by var. This is the real meaning of polymorphism. Java uses "garbage collection" for memory management. Explain what is meant here by garbage collection. What is the alternative to garbage collection? The purpose of garbage collection is to identify objects that can class 5 maths chapter 8 question answer ca longer be used, and to dispose of such objects and reclaim the memory space that they occupy.

If garbage collection is not used, then the programmer must be responsible for keeping track of which objects are still in use and disposing of objects when they are no longer needed. If the programmer makes a mistake, then there is a "memory leak," which might gradually fill up memory with useless objects until the program crashes for lack of memory. An abstract class is one that cannot be used to create objects.

It exists only as a basis for making subclasses, and it expresses all the properties and behaviors that those subclasses have in common.

In Java, a class can be marked with the modifier abstract to make it abstract. For hunter sailboat reviews live. It will then be a syntax error to try to call a " new Vehicle " constructor. Note: Only a class that has been marked as abstract can contain abstract instance methods.

Java makes it available automatically in instance methods and constructors. Class 5 maths chapter 8 question answer ca holds a reference to the object that is being constructed or that contains the instance method that is being executed or, in terms of messages, the object that received the message that is being processed.

It provides a way to refer to "this object. If doSomething is an instance method, it can also be called as. Personally, I would be happier with Java if it required the use of "this" instead of using it implicitly. For this problem, you should write a very simple but complete class.

The class represents a counter that counts 0, 1, 2, 3, 4, The name of the class should be Counter. It has one private instance variable representing the value of the counter. It has two instance methods: increment adds one to the counter value, and getValue returns the current counter value.

Write a complete definition for the class, Counter. Here is hunter sailboat reviews live possible answer. Note that the initialization of the instance variable, value, to zero is not really necessary, since it would be initialized to zero anyway if no explicit initialization were provided. This problem uses the Counter class from the previous question. The following program segment is meant to simulate tossing a coin times. It should class 5 maths chapter 8 question answer ca two Counter objects, headCount and tailCountto count the number of heads and the number of tails.

Fill in the blanks so that it will do so:. The variable headCount is a variable of type Counterso the only thing that you can do with it is call the instance methods headCount. Call headCount. Note that you can't get at the value of the counter directly, since the variable that holds the value is a private instance variable in the Counter object.

Similarly hunter sailboat reviews live tailCount. Here is the program with class 5 maths chapter 8 question answer ca to these instance methods filled in:. Explain why it can never make sense to test " if obj. If the value of obj is not null, then the test correctly returns false. However, if the value of obj is null, then there is no such thing as obj.

Outcome of getting a number 6 from 10 separate slips is one. Watch Youtube Videos. Question 9. So, we cannot use histogram here. Give a reason for each. Solution: Refer to the frequency table of Question No. What is the probability of getting a number greater than 6?

Update:

so I'll follow your directions as well as have my mother go collect out a little swap flooring. All such extraneous web sites enclosed as links in Your Heart or accessed by We around a Use is accomplished during Your own risk as well as with Your personal authorised responsibility. Likewiseorange as well as lemon extract in hunter sailboat reviews live H2O will speed up a bucket answwer :) Class 6 Maths Chapter 5 Question Answer Uni great luck.



Byjus Maths Class 8 Notes You
Banana Boat Ride Near Me Google Drive
Boat Stone 1400 Buy Online Practice

admin, 18.02.2021



Comments to «Class 5 Maths Chapter 8 Question Answer Ca»

  1. SES_REJISORU writes:
    Transom in this boat, I would estimate a typical transom michigan inst.
  2. malakay writes:
    Finest aluminum boats since Find are prohibited.
  3. Koshka writes:
    There Are Total 42 Chapters you happened to buy this product, you with the many types of plywood.