1
(a) Define abstraction.
Show SolutionHide Solution↓
Abstraction refers to the act of representing essential features without including the background details or explanation.
(b) Differentiate between searching and sorting.
| Searching | Sorting |
|---|---|
| Searching means to search for a term or value in an array. | Sorting means to arrange the elements of the array in ascending or descending order. |
| Linear search and Binary search are examples of search techniques. | Bubble sort and Selection sort are examples of sorting techniques. |
(c) Write a difference between the functions isUpperCase( ) and toUpperCase( ).
| isUpperCase( ) | toUpperCase( ) |
|---|---|
| isUpperCase( ) function checks if a given character is in uppercase or not. | toUpperCase( ) function converts a given character to uppercase. |
| Its return type is boolean. | Its return type is char. |
(d) How are private members of a class different from public members?
private members of a class can only be accessed by other member methods of the same class whereas public members of a class can be accessed by methods of other classes as well.
(e) Classify the following as primitive or non-primitive datatypes:
- char
- arrays
- int
- classes
- Primitive
- Non-Primitive
- Primitive
- Non-Primitive