Deck 4: Creating Your Own Classes
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/75
العب
ملء الشاشة (f)
Deck 4: Creating Your Own Classes
1
ToString( ),Equals( ),GetType( ),and GetHashCode( )are all methods of the object class.
True
2
A standard naming convention in C# for properties is to use the same name as the instance variable or field,except begin the identifier using an uppercase character.
True
3
The keyword new is used as an operator to call constructor methods.
True
4
A standard convention used by C# programmers is to use camel case style for property identifiers;Camel case style convention is also used for data member identifiers.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
5
A private access modifier is always associated with data members,methods,and constructors of a class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
6
When you define a property,you can define the set without the get,but you must define a get.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
7
When you define methods of a class,you are defining its behaviors,in terms of what kinds of things it can do.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
8
If you overwrite the ToString( )method,you should also override the other methods of the object class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
9
Three of the contextual keywords associated with properties are get,set,and value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
10
A class is an instance of an object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
11
The return type for constructors is always the type of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
12
When you define a class method,you define its characteristics or fields in terms of the data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
13
A property looks like a method because it directly represents a storage location.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
14
A constructor is used to instantiate a class from an object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
15
Mutators are special types of methods used to create objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
16
With the object-oriented approach,objects send messages to other objects and receive messages from objects.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
17
The ToString( )method of the Console class should be overwritten.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
18
An object is like a class template.The object is used to define the structure for the different classes that are going to be of that type.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
19
A class named River will have a constructor named River.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
20
When you define a class and determine what data members it should have,you are declaring instance variables or fields that will represent the state of an object.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
21
Constructors differ from other methods in that constructors ____.
A) are not defined by the programmer
B) always return a value
C) are defined outside of the class
D) use the same identifier as the class
A) are not defined by the programmer
B) always return a value
C) are defined outside of the class
D) use the same identifier as the class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
22
Local variables ____.
A) are defined inside Main( ) and other methods
B) must be defined as private
C) are defined in classes
D) determine the data characteristics for the class
A) are defined inside Main( ) and other methods
B) must be defined as private
C) are defined in classes
D) determine the data characteristics for the class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
23
A property resembles a(n)____,but is more closely aligned to a(n)____.
A) data field, method
B) method, data field
C) object, mutator
D) mutator, accessor
A) data field, method
B) method, data field
C) object, mutator
D) mutator, accessor
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
24
A class is normally associated with a(n)____,which often describes a person,place,or thing and is normally a noun.
A) method member
B) behavior
C) data member
D) entity
A) method member
B) behavior
C) data member
D) entity
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
25
Use a type prefix,such as C for class name.For example,a student class should be named CStudent.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
26
Constructors are methods.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
27
All data types are initialized to 0 when an object is constructed.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
28
Accessors are special types of methods in C# used to instantiate an object of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
29
Instance methods must have the static keyword in their heading.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
30
To add full functionality to your classes,____.
A) write more than one constructor
B) write a default constructor
C) write at least five constructors for each class
D) omit writing a constructor so that the default one will be created for you
A) write more than one constructor
B) write a default constructor
C) write at least five constructors for each class
D) omit writing a constructor so that the default one will be created for you
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
31
The ToString( )method is automatically invoked when the Write( )or WriteLine( )methods are called.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
32
The default constructor normally has an empty body.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
33
To program an object-oriented solution begin by determining what ____ are needed in the solution.
A) data
B) objects
C) processes
D) methods
A) data
B) objects
C) processes
D) methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
34
C# is an object-oriented language.All the code for an application must be placed in a(n)____.
A) file
B) object
C) class
D) method
A) file
B) object
C) class
D) method
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
35
Design your classes to be as flexible and full-featured as possible.One way to do this is to include multiple instance data members.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
36
Accessors are also referred to as ____.
A) mutators
B) properties
C) getters
D) classes
A) mutators
B) properties
C) getters
D) classes
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
37
When you define the class,you describe its ____ in terms of data and its behaviors,or methods,in terms of what kinds of things it can do.
A) attributes
B) fields
C) characteristics
D) all of the above
A) attributes
B) fields
C) characteristics
D) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
38
Since the data members of the class are defined as private,their public property counterpart must be used to assign new values to the data members.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
39
When you create an application that has two files,both must have a Main( )method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
40
Constructors should be defined with a ____ access modifier.
A) public
B) private
C) protected
D) static
A) public
B) private
C) protected
D) static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
41
The ToString( )method is automatically invoked when an object reference is made in the ____.
A) class constructor
B) Write( ) method
C) mutator method
D) object class
A) class constructor
B) Write( ) method
C) mutator method
D) object class
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
42
Which of the following is NOT one of the inherited member methods of the object class?
A) ToString( )
B) Equals( )
C) GetType( )
D) Main( )
A) ToString( )
B) Equals( )
C) GetType( )
D) Main( )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
43
Variables declared in the Main( )method are ____.
A) visible inside any method in the class.
B) are automatically initialized to zero.
C) must be defined as private data members.
D) only visible inside Main( ).
A) visible inside any method in the class.
B) are automatically initialized to zero.
C) must be defined as private data members.
D) only visible inside Main( ).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
44
Instance methods manipulate data by ____.
A) directly accessing private data members.
B) passing information as arguments through parameters.
C) using constructors and accessors.
D) sending visible data in the Main( ) method.
A) directly accessing private data members.
B) passing information as arguments through parameters.
C) using constructors and accessors.
D) sending visible data in the Main( ) method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
45
Normally data members are defined to have ____ access.
A) public
B) private
C) protected
D) internal
A) public
B) private
C) protected
D) internal
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
46
Constructors ____.
A) can be overloaded.
B) do not have to be written.
C) do not return a value.
D) all of the above.
A) can be overloaded.
B) do not have to be written.
C) do not return a value.
D) all of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
47
Accessors,mutators,and other instance methods are normally defined with what type of access modifier?
A) private
B) protected
C) internal
D) public
A) private
B) protected
C) internal
D) public
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
48
Instance methods are ____.
A) nonstatic methods.
B) also called class methods.
C) defined in the Main( ) method.
D) defined outside of the class.
A) nonstatic methods.
B) also called class methods.
C) defined in the Main( ) method.
D) defined outside of the class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
49
____ are special methods used to read the current state or value of an object member's data.
A) Accessors
B) Mutators
C) Constructors
D) Setters
A) Accessors
B) Mutators
C) Constructors
D) Setters
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
50
What will be displayed from the above line?
A) Value = 12,346
B) Value = 12346
C) Value = 12,345
D) Value = 12,346.0
A) Value = 12,346
B) Value = 12346
C) Value = 12,345
D) Value = 12,346.0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
51
When you define a class,you can use ____ to display all public members of the class (once an object is instantiated).
A) constructors
B) intellisense
C) instance methods
D) class diagrams
A) constructors
B) intellisense
C) instance methods
D) class diagrams
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
52
If proper naming conventions were used in the above statement,which of the following statements is true?
A) PricePerSqYard is a property
B) plush is an object
C) 40.99 is a numeric literal
D) all of the above
A) PricePerSqYard is a property
B) plush is an object
C) 40.99 is a numeric literal
D) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
53
Class methods manipulate data by ____.
A) directly accessing private data members.
B) passing information as arguments through parameters.
C) using constructors and accessors.
D) sending visible data in the Main( ) method.
A) directly accessing private data members.
B) passing information as arguments through parameters.
C) using constructors and accessors.
D) sending visible data in the Main( ) method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
54
Which of the following is true regarding methods of a class?
A) You must use the keyword static.
B) They are called instance methods.
C) To call methods of the class in the class, you must prefix the method name with the class name.
D) No return type is used when you define a class method.
A) You must use the keyword static.
B) They are called instance methods.
C) To call methods of the class in the class, you must prefix the method name with the class name.
D) No return type is used when you define a class method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
55
To design a class that is flexible and full-featured,____.
A) define a constructor for every possible combination of data members.
B) define a default constructor.
C) define at least three constructors.
D) include multiple constructors.
A) define a constructor for every possible combination of data members.
B) define a default constructor.
C) define at least three constructors.
D) include multiple constructors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
56
In order to provide a new definition for the ToString( )method,____.
A) it must be defined using the new operator.
B) there must be at least one constructor defined.
C) use the keyword override in the heading
D) both mutators and accessors must have been defined.
A) it must be defined using the new operator.
B) there must be at least one constructor defined.
C) use the keyword override in the heading
D) both mutators and accessors must have been defined.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
57
Which of the following is NOT a true statement relating to constructors?
A) To add full functionality to your classes, write multiple constructors
B) If you write one constructor, you lose the default one that is created automatically.
C) The default constructor must be the first one written for the class.
D) Constructors are used to provide values to the object's data members.
A) To add full functionality to your classes, write multiple constructors
B) If you write one constructor, you lose the default one that is created automatically.
C) The default constructor must be the first one written for the class.
D) Constructors are used to provide values to the object's data members.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
58
The static keyword must not be used with ____.
A) data members
B) instance methods
C) class methods
D) all of the above
A) data members
B) instance methods
C) class methods
D) all of the above
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
59
To define a property to change a data member of a class include a ____ clause.
A) mutator
B) get
C) set
D) value
A) mutator
B) get
C) set
D) value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
60
In order to test a class,____.
A) a different class is needed.
B) invoke instance methods using the objects you construct.
C) use the properties to assign and retrieve values.
D) all of the above.
A) a different class is needed.
B) invoke instance methods using the objects you construct.
C) use the properties to assign and retrieve values.
D) all of the above.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
61
After the class diagram is created,add the names of data members or fields and methods
using the_________________ section.
using the_________________ section.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
62
After a project has been created and a new class added to your application,you can use the ____________ Window in Visual Studio to create a class diagram.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
63
The ____________ constructor does not have any parameters and normally has no body,just opening and closing curly braces.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
64
The body of the constructor methods consist primarily of ____________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
65
Fields or data members are also called ____________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
66
Accessor and mutators are ____________ methods
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
67
As with overloaded methods,____________ must differ for constructors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
68
By abstracting out the attributes (data)and the behaviors (processes on the data),you can create a(n)____________ to serve as a template from which many objects of that type can be instantiated.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
69
Data members should be defined with an access mode of ____________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
70
C# is an object-oriented language as such all the code that you write has to be placed in a(n)____________.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
71
During the design phase,it is important to develop a(n)____________ illustrating what the desired final output should be.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
72
____________ access modifier is always associated with constructors.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
73
Constructors are used to ____________ a class.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
74
When you define the class,you describe its ____________,or characteristics or fields,in terms of data.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck
75
If berber is an object,the statement Console.Write(berber);automatically invokes the ____________ method.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 75 في هذه المجموعة.
فتح الحزمة
k this deck