• Post Reply Bookmark Topic Watch Topic
  • New Topic

Certfication Question  RSS feed

 
Honey
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Polygon is drawable and it has several vertices. colors that can be stored by a vector and a flag of boolean type. What can you use to declare the member variables of this class?
a.) Object
b.) boolean
c.) vertice
d.) Vector
e.) Polygon
From my point of view the answer should be b,d.
Any comments.
 
Divakar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think a and e.
All the classes are subclasses of Object .
So we can write Object o=new Polygon();
We can as well create object of Polygon.
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Polygon is drawable and it has several vertices. colors that can be stored by a vector and a flag of boolean type. What can you use to declare the member variables of this class?
a.) Object //No
b.) boolean //Yes ,Since the qstn says it has a boolean type member var
c.) vertice //may or may not be
d.) Vector // Yes, because the qstn particularly asks to store the vertices and color in a Vector object
e.) Polygon //NO
I think the qstn is not very clear in what it says so. What I understand is the Polygon object has many vertices (x1,y1) , (x2,y2).....(xn,yn) and it has a Color as a member var using which the Polygon is drawn. It also implements an interface drawable (it may be the name of the interface).This info can be stored in many ways in a Vector. The storing and retriving mechanism must be compatible. For color, A new Color object may be created and added to the Vector object. For the vertices there can be int[n][2] array which has the (x,y) coordinates. For storing the vertices we may have to create an int[n][2] where n is total no of vertices to be drawn. In this case the 3rd answer comes as just a var name 'vertice' not a Type. So we CAN use this vertice as a var name. Otherwise there may be a class named 'vertice' which has x,y as instance member vars. In that case, to store the vertices of the Polygon we may have to create an array of type 'vertice' and add this array to the Vector object. Or we can directly create this 'vertice' class type object and add to Vector object without creating as an array as a member var. Since the qstn asks about member var of the Polygon we have to ignore the last one which i just described. Generally we use CAPITALIZED FIRST letter for class Types and LOWERCASE first letter for var/methodNames etc. If we see in that angle the 3rd ans 'vertice' more likely a member var name which we CAN USE for declare the members.
This is my thought.
Others can add to this.
regds
maha anna

 
Saritha Pilla
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question must be...
A Polygon is Drawable.Polygon has several vertices which are stored in a vector,Color for filling and a flag which is of type boolean.
and hence the memeber variables used in Class Polygon are of type Color, Vector and boolean
So, the answer is b and d.

[This message has been edited by Saritha Pilla (edited March 09, 2000).]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I got this question in my exam. Althouh i do not remember the first line,it wasn't like that.
Correct answers : b,c
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops..! sorry
b,d
 
maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shanifa,
You got this in one of MOCK EXAMS in the internet right? No ACTUAL EXAM qstns discussions please... Not even the word..
regds
maha anna
 
Rolf Weasel
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody rephrase the question so it is clearer?
From what i understand:
A Polygon is Drawable, it has a number of vertices, a number of colors and a boolean flag. What are the types that you will need to use for the member variables of a Polygon?
is that what the question is?
 
Divakar
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again carelesness .I didn't notice "member variable" . So gone ahead with objects.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!