Can anyone explains why this one is true or false? True/ False 5. A process that
ID: 3741766 • Letter: C
Question
Can anyone explains why this one is true or false?
True/ False
5. A process that involves recognizing and focusing on the important characterisitics of a situation or objext is known as inheitance.
7. Consider the following code segment :
...
Rectangle r1 = new Rectangle ();
r1.setColor(Color.blue);
Rectangle r2 = r1;
r2.setColor(Color.red);
8. The correct order of the declarations in a Java program is import statement, package declaraion, class declaration.
9. An overloaded method consists of the same method name and same number and type of parameters with different return type.
13. B is a sub class of A. C is a sub class of B. This statement is legal: C c = new A();
14. An abstract Data Type (ADT) must obviously have some kind of representation for its data. We often make this presentation public so that a user can change it to improve our coding.
15. Consider the statement "x=(a>)? a: b"; then the value of x is 27, if a = 18 and b = 27.
Explanation / Answer
5. false
A process that involves recognizing and focusing on the important characteristics of a situation or object is data abstraction.
inheritance: acquiring the properties for another class(ie base class) is known as inheritance.
7. true
Rectangle r1 = new Rectangle (); //creates the object
r1.setColor(Color.blue); //sets the color for rectangle r1
Rectangle r2 = r1; //creates another object r2 of rectangle type and holds the attributes of r1
r2.setColor(Color.red); // //sets the color for rectangle r2
8. false
declaration should be as:
Package declaration
import statement
class declaration
9. false
an overloaded methods have same method name, but different argument list with different types
example:
int sum(int, int)
int sum(int, int, int)
float sum(float, int)
13. false
A super class cannot be converted to subclass object
14. false
the member can be accessed from outside of the class when the ADT is public type.
15.
x=(a>)?a:b is an illegal expression. a>? (relational operator must have two variables)
if x=(a>b)?a:b then x will have b value (x=27) ie a>b is false so the b value will be stored in x