Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C# The interface object cannot method members, just member data. True False 1 points QUESTION 7 Given the following code snippet, public class AnyClass

In C#

The interface object cannot method members, just member data.

True

False

1 points

QUESTION 7

Given the following code snippet, public class AnyClass { private T[ ] items; private int loc = 0; public AnyClass (int size) { items = new T[size]; } public T RemoveItem( ) { return items[--loc]; } public void AddItem(T anItem) { items[loc] = anItem; loc++; } } if an object named gs had been instantiated of AnyClass, how would you invoke the RemoveItem( ) method if the T is a string?

WriteLine(gs.Remove( ));

WriteLine(gs.Remove(string));

WriteLine(string.Remove(gs));

string aValue = gs.Remove(string);

1 points

QUESTION 8

Given the following code snippet, public class AnyClass { private T[ ] items; private int loc = 0; public AnyClass (int size) { items = new T[size]; } public T RemoveItem( ) { return items[--loc]; } public void AddItem(T anItem) { items[loc] = anItem; loc++; } } if an object named gs had been instantiated of AnyClass, how would you invoke the AddItem( ) method if the T is a string?

gs.AddItem(string someValue);

gs.AddItem(an example);

string someValue = gs.AddItem( );

gs.AddItem(45);

1 points

QUESTION 9

Given the following code snippet, public class AnyClass { private T[ ] items; private int loc = 0; public AnyClass (int size) { items = new T[size]; } public T RemoveItem( ) { return items[--loc]; } public void AddItem(T anItem) { items[loc] = anItem; loc++; } } what best describes the code snippet?

AnyClass is a generic class

T is a placeholder indicating any type can be used

AnyClass can not be instantiated without given a value for its size

All of the above are correct

1 points

QUESTION 10

Which of these names must be used as a type indicator for a generic class?

K

N

T

none of the above

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+ How does the intent of the several policies differ?

Answered: 1 week ago