ITRevise.in

Chapter library

Object-oriented Programming and Class Design · Class XII · Part B

Open an answer to check your recall, or turn this topic into an MCQ quiz.

Fundamentals of Java Programming

Object-oriented Programming and Class Design

Practice this chapter
1 Explain “Class” with an example.

Class defines the structure and behaviour of a type.

Trace Java code in the order it executes. Keep track of the type and value of each variable, which condition is evaluated and how the result is returned or shown. Object is an instance of a class. Constructor initialises newly created objects. Encapsulation controls access to internal state.

Example. A student creates a small marks calculator. It takes two numbers, chooses an action based on the input and displays a result. The student tests normal numbers and invalid text separately to see which part of the program handles each case.

The important point is what “Class” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.

164 words

2 Explain “Object” with an example.

Object is an instance of a class.

Trace Java code in the order it executes. Keep track of the type and value of each variable, which condition is evaluated and how the result is returned or shown. Constructor initialises newly created objects. Encapsulation controls access to internal state. Getter lets you access a value.

Example. A student creates a small marks calculator. It takes two numbers, chooses an action based on the input and displays a result. The student tests normal numbers and invalid text separately to see which part of the program handles each case.

The important point is what “Object” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.

161 words

3 Explain “Constructor” with an example.

Constructor initialises newly created objects.

Trace Java code in the order it executes. Keep track of the type and value of each variable, which condition is evaluated and how the result is returned or shown. Encapsulation controls access to internal state. Getter lets you access a value. Setter can update a field after checking the supplied value.

Example. A student creates a small marks calculator. It takes two numbers, chooses an action based on the input and displays a result. The student tests normal numbers and invalid text separately to see which part of the program handles each case.

The important point is what “Constructor” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.

164 words

4 Explain “Encapsulation” with an example.

Encapsulation controls access to internal state.

Trace Java code in the order it executes. Keep track of the type and value of each variable, which condition is evaluated and how the result is returned or shown. Getter lets you access a value. Setter can update a field after checking the supplied value. Private modifier limits access to the declaring class and its nested scope.

Example. A student creates a small marks calculator. It takes two numbers, chooses an action based on the input and displays a result. The student tests normal numbers and invalid text separately to see which part of the program handles each case.

The important point is what “Encapsulation” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.

171 words

5 Explain “Getter” with an example.

Getter lets you access a value.

Trace Java code in the order it executes. Keep track of the type and value of each variable, which condition is evaluated and how the result is returned or shown. Setter can update a field after checking the supplied value. Private modifier limits access to the declaring class and its nested scope. Class defines the structure and behaviour of a type.

Example. A student creates a small marks calculator. It takes two numbers, chooses an action based on the input and displays a result. The student tests normal numbers and invalid text separately to see which part of the program handles each case.

The important point is what “Getter” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.

174 words

6 Explain “Setter” with an example.

Setter can update a field after checking the supplied value.

Trace Java code in the order it executes. Keep track of the type and value of each variable, which condition is evaluated and how the result is returned or shown. Private modifier limits access to the declaring class and its nested scope. Class defines the structure and behaviour of a type. Object is an instance of a class.

Example. A student creates a small marks calculator. It takes two numbers, chooses an action based on the input and displays a result. The student tests normal numbers and invalid text separately to see which part of the program handles each case.

The important point is what “Setter” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.

175 words

7 Explain “Private modifier” with an example.

Private modifier limits access to the declaring class and its nested scope.

Trace Java code in the order it executes. Keep track of the type and value of each variable, which condition is evaluated and how the result is returned or shown. Class defines the structure and behaviour of a type. Object is an instance of a class. Constructor initialises newly created objects.

Example. A student creates a small marks calculator. It takes two numbers, chooses an action based on the input and displays a result. The student tests normal numbers and invalid text separately to see which part of the program handles each case.

The important point is what “Private modifier” does in a specific situation. To see the difference between this idea and the others in this chapter, compare what each one affects and which result would show that it had been used correctly. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.

171 words

8 Distinguish between Class and Object.

Class defines the structure and behaviour of a type. Object is an instance of a class.

Trace Java code in the order it executes. Keep track of the type and value of each variable, which condition is evaluated and how the result is returned or shown. Constructor initialises newly created objects. Encapsulation controls access to internal state. Getter lets you access a value.

Example. A student creates a small marks calculator. It takes two numbers, chooses an action based on the input and displays a result. The student tests normal numbers and invalid text separately to see which part of the program handles each case.

Compare the two ideas using the same situation. Describe which part of the situation each idea explains and how the result would differ if you used the other one. This gives the distinction a clearer basis than listing two definitions in isolation. Use one concrete detail, such as a number, file name, message or action, to show exactly what you mean and how someone could check it.

172 words

Reference book: 802-Information Technology Class- XII_PART_B.pdf