Question 1 2 pts (TCO 1) The mechanism that allows you to combine data and the b
ID: 3854616 • Letter: Q
Question
Question 1
2 pts
(TCO 1) The mechanism that allows you to combine data and the behavior for that data into a single unit is called a(n) _____.
member
class
object
field
Question 2
2 pts
(TCO 1) Which of the following would be a more appropriate choice for a method in a Fork class?
Eat()
Color()
Material()
Bend()
Question 3
2 pts
(TCO 1) Which of the following statements is/are true?
C. The state of an object should not be hidden.
None are true
A. Objects communicate through message passing.
All are true
D. Implementation details should be visible through the interface of a class.
A and C
B. An object is necessary to be defined before you can create a class.
Question 4
2 pts
(TCO 1) Which of the following would be a more appropriate choice for a data member in a Button class?
width
show
click
resize
Question 5
2 pts
(TCO 1) The following is/are object-oriented programming feature(s).
Encapsulation
Abstraction
All of the above
Inheritance
None of the above
Question 6
2 pts
(TCO 8) Most professional coding standards use _____ for data members.
Attribute case
no specific naming convention
Pascal case
Camel case
Question 7
2 pts
(TCO 1) Examine the ClockType class definition. How many class members does it contain?
class ClockType
{
public :
void setTime(int, int, int);
int getTime();
void printTime();
private:
int hr;
int min;
int sec;
}
2
An average of 5 because (7 + 3) / 2 = 5
9
3
6
Question 8
2 pts
(TCO 1) Assume we have two objects of a class. How many copies of the class's attributes and methods exist in the instantiated objects?
Zero, the objects do not have attributes and methods
Three copies
Only one copy, both objects always share it
Two copies, each object has its own copy
Question 9
2 pts
(TCO 1) Both _____ and _____ allow for code reuse and the building of more complex systems.
None of the above
UML diagrams; serialization
messaging; object behaviors
inheritance; composition
Question 10
2 pts
(TCO 1) By default, all members of a class are _____.
private
internal
public
protected
unfriendly
Explanation / Answer
Question 1
2 pts
(TCO 1) The mechanism that allows you to combine data and the behavior for that data into a single unit is called a(n) _____.
member
class
object
field
------CLASS as the mechanism of binding of data and the behavior for that data into a single unit is Encapsulation and Class is a Example of Encapsulation.
------------------------------------------------------------------------------------------------------------------------------------------------------------
Question 2
2 pts
(TCO 1) Which of the following would be a more appropriate choice for a method in a Fork class?
Eat()
Color()
Material()
Bend()
-----Eat() as a class contains methods of a similar kind or behaviour.. And Eat() is the most appropriate one that relates to fork class.
------------------------------------------------------------------------------------------------------------------------------------------------------------
Question 3
2 pts
(TCO 1) Which of the following statements is/are true?
C. The state of an object should not be hidden.
None are true
A. Objects communicate through message passing.
All are true
D. Implementation details should be visible through the interface of a class.
A and C
B. An object is necessary to be defined before you can create a class.
------A and C are true .. B is wrong as you create the object after the class is created and object itself is the instance of a class.
D is also incorrect as if Implementation details are visible through the interface of a class it is against the OOPS concept of Abstraction.
---------------------------------------------------------------------------------------------------------------------------------------------------------
Question 4
2 pts
(TCO 1) Which of the following would be a more appropriate choice for a data member in a Button class?
width
show
click
resize
----the correct answer is WIDTH as it is only the data member or property.. other like show,click,resize are METHODS OF THE CLASS NOT DATA MEMBERS
---------------------------------------------------------------------------------------------------------------------------------------------------
Question 5
2 pts
(TCO 1) The following is/are object-oriented programming feature(s).
Encapsulation
Abstraction
All of the above
Inheritance
None of the above
ANSWER IS ALL OF THE ABOVE.. Abstraction,
Inheritance,Encapsulation are the base or pillars of the OOP paradigm.
----------------------------------------------------------------------------------------------------------------------------------------------------------Question 6
2 pts
(TCO 8) Most professional coding standards use _____ for data members.
Attribute case
no specific naming convention
Pascal case
Camel case
Answer is CamelCase... Java,C# etc use CamelCase for Datamembers.. Exapmle: int readData;
--------------------------------------------------------------------------------------------------------------------------------------------------
Question 7
2 pts
(TCO 1) Examine the ClockType class definition. How many class members does it contain?
class ClockType
{
public :
void setTime(int, int, int);
int getTime();
void printTime();
private:
int hr;
int min;
int sec;
}
2
An average of 5 because (7 + 3) / 2 = 5
9
3
6
ANSWER IS 3 . datamembers are private:
int hr;
int min;
int sec;
they store data ,so are called datamembers.
other options are methods of a class not datamembers.
----------------------------------------------------------------------------------------------------------------------------------------------------
Question 8
2 pts
(TCO 1) Assume we have two objects of a class. How many copies of the class's attributes and methods exist in the instantiated objects?
Zero, the objects do not have attributes and methods
Three copies
Only one copy, both objects always share it
Two copies, each object has its own copy
--Correct answer is two copies,each object has its own copy as object is created using the constructor and it initializes the datamembers and methods of a class and assigns them to the object being created.
-----------------------------------------------------------------------------------------------------------------------------------------------------
Question 9
2 pts
(TCO 1) Both _____ and _____ allow for code reuse and the building of more complex systems.
None of the above
UML diagrams; serialization
messaging; object behaviors
inheritance; composition
correct option is inheritance and compositon.
---------------------------------------------------------------------------------------------------------------------------------------------------------Question 10
2 pts
(TCO 1) By default, all members of a class are _____.
private
internal
public
protected
unfriendly
Correct answer can only be given on the basis of the language asked about..
In c++,data members are Private,by default.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.