Question: C# 1. An unsorted array of 15 items is being used to store some information. How many items in the array would have to be

C#

1. An unsorted array of 15 items is being used to store some information. How many items in the array would have to be checked in order to find the smallest item in the array?

2

3

5

8

15

2. How could you make this code display "FruitBanana"?

class Fruit
{
 public void Show() { Console.Write("Fruit"); }
}
class Banana : Fruit
{
 public void Show() { base.Show(); Console.Write("Banana"); }
}
Fruit f = new Banana();
f.Show();

It already will

Label Fruit's Show as virtual

Label Banana's Show as virtual

Label Fruit's Show as static

none of the others

3. What kind of class methods cannot use the "this" keyword?

none of them can

all of them can

static

this

constructors

properties

4. For C#, what's the preferred naming convention for fields?

camelCasing

PascalCasing

_camelCasing

_PascalCasing

5. What will the following code display?

string text = "I am Batman!";
string[] splits = text.Split(' ');
 
Console.Write(splits[2][2]);

m

Batman!

t

a

nothing

6. Which is true of overrides?

The function header must match the header from the parent version

The return types can be different

The function signatures can be different

They can be done on non-virtual methods

All methods from the parent class must be overridden

7. in C#, Arrays and Lists, store their objects in what order in memory?

Contiguous

First in, first out order

Last in, last out order

Random

8. A key concept of object-oriented programming is the __________ Responsibility Principle.

Single

Double

Triple

Inheritance

9. Values stored in a dictionary must be unique.

True

False

10. What function modifier can be put on a method in a base class to allow the child to override it?

virtual

static

const

new

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!