Computer Science Programming MCQ

1. When using encapsulation how should data be shared with the external code?                                  a.)  Eventsb.)  Methodsc.)  Propertiesd.)  Private variablese.)  Public variables
Answer: c

(adsbygoogle = window.adsbygoogle || []).push({});

2. Which statement is true?a.)  A base class inherits some of the properties of a derived class.b.)  A base class inherits all of the properties of a derived class.c.)  A derived class inherits some of the properties of a base class.d.)  A derived class inherits all of the properties of a base class.e.) None of the above.
Answer: d
3. When a base class is changed:a.)  there is no effect on the derived class.b.)  the derived class changes when the keyword Overridden is used.c.)  only the methods of the derived class change.d.)  only the properties of the derived class change.e.)  the derived class automatically changes.
Answer:  e
4. Polymorphism can apply to:a.)  math operators.b.)  method names.c.)  object names.d.)  Both a and b.e.)  All of the above. 
Answer:  d
5. With polymorphism:a.)  one method can have multiple names.b.)  one object can have multiple names.c.)  many methods can share the same name.d.)  many objects can share the same name.e.)  None of the above statements are true.
Answer:  c
6. Which element of a class is optional?                                 a.)  Constructsb.)  Fieldsc.)  Methodsd.)  Propertiese.)  All of the above. 
Answer: e
7. What is the suggested order for the definition of class elements from first to last?a.)  Constructs, fields, methods, propertiesb.)  Properties, constructs, fields, methodsc.)  Fields, properties, constructs, methodsd.)  Constructs, properties, fields, methodse.)  Methods, constructs, properties, fields
Answer: c
8. The standard for designing a field is that it be defined as a:a.)  private method.b.)  public method.c.)  private variable.d.)  public variable.e.)  None of the above.
Answer: c

(adsbygoogle = window.adsbygoogle || []).push({});

9. What is the syntax for making a property read-only?a.)  Property Read propertyname As datatypeb.)  Read Property propertyname As datatypec.)  ReadOnly Property propertyname As datatyped.)  Read-Only Property propertyname As datatypee.)  RO Property propertyname As datatype
Answer: c
10. The Get procedure of a property acts like:a.)  an event.b.)  a function.c.)  a variable.d.)  Both a and b.e.)  All of the above. 
Answer: b
11. A method in a class is:                                 a.)  a sub procedure.b.)  a function.c.)  an event.d.)  Both a and b.e.)  All of the above. 
Answer: d
12. How many constructors can a class have?a.)  0b.)  1c.)  2d.)  3e.)  All of the above.   Answer:  e
13. A constructor is a special type of:a.)  class.b.)  field.c.)  method.d.)  property.e.)  variable.   Answer:  c
14. Which is true for constructors in a class?a.)  All constructors must have the same number of parameters.b.)  All constructors must be the same parameter data type.c.)  Some constructors can have the same list of parameters.d.)  Only two constructors in a class can have the same list of parameters.e.)  No two constructors in a class can have the same list of parameters.  Answer: e

(adsbygoogle = window.adsbygoogle || []).push({});

15. Which statement will call a constructor of a base class?a.)  Base.New( )b.)  BaseConstructor.New ( )c.)  CallBase.New( )d.)  Constructor.New ( )e.)  MyBase.New( )  Answer: e