OOD - 2021 Spring - Final Review

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following is not a comparison operator in C#? (a)>= (b)=< (c)> (d)<

B

What is true about encapsulation of data in object-oriented programming? (a)When we design classes, we want to make sure that all the necessary data is available to the methods that will operate on this data. (b)We just want the relevant information to be visible to the users of our classes that will create instances, change values of accessible attributes or properties, and call the available methods. (c)All others answers are correct (d)We want to hide or protect some data that is just needed for internal use. We do not want accidental changes to sensitive data.

C

What happens when you create a new instance of a class? (a)the programming language runtime creates a new instance of the specified type (b)the constructor code is executed (c)memory is allocated for the instance (d)all of the above

D

Which of the follow can be declared in a C# interface? (a)constructors (b)constants (c)fields (d)none of the above

D

A multiple inheritance defines properties and methods that a class must implement in order to be considered a member of a group identified with the multiple inheritance name. True False

F

A subclass can inherit from just one class and only implement just one interface in C#. True False

F

All programming languages support the same mechanisms introduced in the classic object-oriented programming approach. T or F

F

All programming languages support the same mechanisms introduced in the classic object-oriented programming approach. True False

F

An abstract base class can only implement one interface. True False

F

C# supports several loops, including for, foreach, while, and while do. True False

F

Each folder you navigate to in the organizational hierarchy is represented in the namespace by the (,) character. True False

F

Garbage-reduction is a mechanism in C# that automatically deallocates memory used by instances that aren't referenced anymore. True False

F

Getters allow you to control how values are returned. Setters do not change the values of the underlying attributes. True False

F

In .NET, an assembly can contain types in multiple namespaces, but a single namespace cannot be spread across multiple assemblies. T or F

F

In some cases, multiple inheritance is not convenient because similar subclasses might have methods with the same name. True False

F

In the textbook example, the Shape class is considered a concrete class, in that we do not want to be able to create instances of that class. True False

F

Mechanisms to protect and hide data are the same across programming languages. True False

F

Mutability is not very important in object-oriented programming. True False

F

Namespaces are not often used to organize C# interfaces and classes. True False

F

Parametric polymorphism is not possible in C#. True False

F

Some programming languages allow you to define a method with the same name multiple times by passing different arguments. This feature is known as method overriding. True False

F

There are many ways to have multiple inheritance in C#. T or F

F

Unlike when you declare a class as a subclass, when declaring that a class will implement an interface, you use the "-" character instead of the ":" character. True False

F

Visual Studio will not use the folder names in which you add an interface file to automatically generate a default namespace name. True False

F

When a class inherits from another class, it inherits all the elements that compose the parent class, also known as subclass. True False

F

When referring to interfaces and classes, we say that interface X implements class Y. True False

F

When we inherit to a class, we also inherit its constructor; therefore, we can call the inherited constructor to run the initialization code for the subclass. True False

F

When we work with concurrent code, it is best to use mutable objects. True False

F

You can define at most three constructors for a class. True False

F

You can specify accessibility modifiers in members of interfaces. T or F

F

You can use a destructor to perform any necessary cleanup before the object is destroyed and removed from memory. True False

F

You cannot specialize a blueprint in C#. True False

F

You only need inheritance to define a generic type. True False

F

Your code can still compile, even if you do not implement all members specified in the interface being used. True False

F

void indicates that a method returns a value. True False

F

A common convention in object-oriented programming is to use a dot (.) to access available attributes and methods of an object. True False

T

A primary goal of writing code using generic types is the maximization of code reuse. T or F

T

A primary goal of writing code using generic types is the maximization of code reuse. True False

T

A property is used like a field, but works like a method. True False

T

An interface is like a special case of an abstract class. T or F

T

An interface is like a special case of an abstract class. True False

T

Arrays and .NET collections are 0-based. T or F

T

As long as we implement all the members declared in the interface or interfaces listed in the class declaration, we can add any desired additional member to this class. True False

T

C# allows you to use namespaces to declare a scope that contains a set of related elements. True False

T

C# does not support multiple inheritance of classes, but you can use multiple inheritance with interfaces or combine interfaces with classes. T or F

T

C# works with namespaces, and you can match them with the location of all the source code files within folders in the project structure. True False

T

Creating a superclass also represents a specialization of the parent class to the child class. True False

T

Each class inherits from one class; therefore, each new class that we will define has just one superclass. In this case, we will always work with single inheritance. True False

T

Each instance has its own independent value for the attributes or fields defined in the class. True False

T

Each programming language provides different features that allow you to generate and organize blueprints for objects. True False

T

Events allow instances to notify other objects when an event takes place. True False

T

Generics are very important to maximize code reuse in C#. True False

T

Given the code: int val = int.Parse("260"); The "Parse" method will convert the string "260" to an integer 260, if the string represents a valid int value. T or F

T

In C#, classes are the blueprints or building blocks that you can use to generate instances. True False

T

In C#, exception handling is us manged via the try and catch keywords, also known as a try-catch block. True False

T

In C#, we can declare an interface to specify requirements and write generic code that works with any class that implements the interface. T or F

T

In an interface and class are declared in the same namespace, you can reference the interface name in the class declaration without a namespace prefix. T or F

T

In some languages, a similar effect to method overloading can be achieved with optional parameters or default values for specific arguments. T or F

T

In the textbook example, the Shape class is created to generalize the following classes: Square, Rectangle, Circle, and Ellipse. T or F

T

Instead of objects, you will organize classes, interfaces, constructor functions, and prototypes. T or F

T

Interface names, as a convention, start with a capital "I" letter. True False

T

It is possible and sometimes necessary to apply access restrictions to class members. True False

T

Objects relate to real-world situations. T or F

T

Once we define an interface, we can use them to specify the required type for an argument. This way, instead of using classes as types, we can use interfaces as types and an instance of any class that implements the specific interface as the argument. True False

T

Parametric polymorphism allows you to write generic and reusable code that can work with values without depending on the type while keeping the full static type safety. True False

T

Some attributes will be initialized by the class, while others will be specific to the instance. True False

T

The "where" keyword in a class definition indicates that the generic type parameter T has to be of a type that implements the interface specified after the colon. True False

T

The && and || operators in C# perform "short-circuit" operations. True False

T

The redefinition of operators to work in a specific way when applied to instances of specific classes is known as operator overloading. True False

T

The virtual keyword in C# is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class. T or F

T

The virtual keyword in C# is used to modify a method, property, indexer, or event declaration and allow for it to be overridden in a derived class. True False

T

To implement IEquatable, you must implement the Equals method. T or F

T

Very well written object-oriented code can generate a maintenance headache if it isn't organized in an effective way. T or F

T

Visual Studio will automatically include a namespace declaration, based on where in the organizational folder structure you create the new file. True False

T

When you use the using directive in C#, you are referencing namespaces that will be used in your code file. T or F

T

When you use the using directive in C#, you are referencing namespaces that will be used in your code file. True False

T

XML tags are comments used for documentation in .NET. True False

T

You can declare classes that inherit from a superclass and implement one or more interfaces. True False

T

You can declare properties, methods, events, and indexers as members of any interface. True False

T

You must take access modifiers into account to determine the inherited members that we will be accessible in subclasses. True False

T


Ensembles d'études connexes

M4 practice assignment (connect quiz practice)

View Set

Unit 3: Session 2: Methods of Quantitative Analysis

View Set

NURS 232 Unit 5 Wk 1 and Wk 2 NCLEX Review Questions - Tested on Final Exam (5/2/22)

View Set

Chapter 47: Lipid-Lowering Agents

View Set

American History: Era of Good Feelings - Seneca Falls Convention (2)

View Set

Exposition,Rising action,Climax,Falling action,Resolution

View Set