Question

Answer question for C# 1 of 10 When items are added or removed, a list resizes...

Answer question for C#

1 of 10

When items are added or removed, a list resizes itself.

True
False

Question

2 of 10

What happens when you assign one list to another using the assignment operator?

An error message generates.
Elements copy to new memory locations.
Both lists become value-type data elements.
Both lists reference the same memory locations.

Question

3 of 10

Which of the following is a valid example of calling a method and sending it an array argument?

DisplayArrayContents(iList aList;
DisplayArrayContents(aList);
DisplayArrayContents(aList[10]);
DisplayArrayContents(int [ 10] aList);

Question

4 of 10

Given the following code, how would you access the third value in the array?

List<int> list = new List<int> { 5, 10, 15, 20 };

Console.WriteLine(list[2]);

Console.ReadLine();

list[3]
list[2];
A compile-time error occurs.
A run-time error occurs.

Question

5 of 10

Just like arrays, lists contain a Length property.

True
False

Question

6 of 10

A ___ works similarly to an array; however, when you add or remove items it resizes itself.

list
queue
stack
dictionary

Question

7 of 10

You declare a list with code like below:

List<int> items = new List<int>();

You try to access the value using the code below, without adding items first:

int listValue = items[10];

What will happen?

A compilation error generates.
A run-time error generates.
The variable arrayValue sets to the 11th element in the array.
The variable arrayValue sets to the 10th element in the array.

Question

8 of 10

The key and value in a dictionary must be of the same type.

True
False

Question

9 of 10

A ____ is a data structure that uses a first-in-first-out order of accessing items.

list
queue
stack
dictionary

Question

10 of 10

Given the code below, what type is the key of this dictionary?

Dictionary<int, string> students = new Dictionary<int, string>();

string
int
Dictionary
None of the above

Homework Answers

Answer #1

Answer 1:true
list grows dynamically
Answer 2: Both lists reference the same memory locations.
both will point same reference as both are pointing to same object
Answer 3:DisplayArrayContents(aList);
when we are passing array we will just send the name of the array
Wrong Answers:
we dont write size while passing as argument
we dont use [] while passing as argument

Answer 4:list[2];
indexes starts from 0 so 3rd element index will be 2
Wrong Answer:
index 3 means it will give 4th value
Console.ReadLine() to read input from the user

As per policy we can answer 1 question per post. Please post the remianing questions as separate post.Thanks

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Stack Queue Program Implement a Stack class using the List Class you developed earlier. Test your...
Stack Queue Program Implement a Stack class using the List Class you developed earlier. Test your Stack class by determining if the following strings have matching open and closing ( ) and/or [ ] and/or { }. To test matches, push open (, [, { onto the stack. Input a close char, pop off the stack and see if input matches symbol form stack.   Use the following data to test your code:                               ( )                               [ ] ( )...
C++ questions QUESTION 1 What kind of linked list begins with a pointer to the first...
C++ questions QUESTION 1 What kind of linked list begins with a pointer to the first node, and each node contains a pointer to the next node, and the pointer in the last node points back to the first node? A. Circular, singly-linked list. B. Circular, doubly-linked list. C. Singly-linked list. D. Doubly-linked list. E. None of the above.    QUESTION 2 _________ is not an advantage of linked lists when compared to arrays. A. Dynamic memory allocation. B. Efficient...
In the following C code, Which variable if NOT of primitive data type? A. a B....
In the following C code, Which variable if NOT of primitive data type? A. a B. b C. c D. d int a = 10; double b = 20.0; float c = false; char d[5] = "Hello"; // here we define a string In programming language C, the implementation of a string data type is limited dynamic length, which means the length of a string variable is fixed once it has been defined. A. True B. False In C# programming...
Data Structures using C++ Consider the classes QueueADT and ArrayQueueType: QueueADT: #ifndef QUEUEADT_H #define QUEUEADT_H template...
Data Structures using C++ Consider the classes QueueADT and ArrayQueueType: QueueADT: #ifndef QUEUEADT_H #define QUEUEADT_H template <class ItemType> class QueueADT { public:        // Action responsibilities        virtual void resetQueue() = 0;           // Reset the queue to an empty queue.           // Post: Queue is empty.        virtual void add(const ItemType& newItem) = 0;           // Function to add newItem to the queue.           // Pre: The queue exists and is not full.          ...
c++ just one file for all of it. You are to implement a 'list' class to...
c++ just one file for all of it. You are to implement a 'list' class to handle a list with general operations. That means you can insert and delete any element anywhere in the list. your list will be an array. the list has no order, except for the order you insert or delete. The methods you are to implement are as given: constructor methods (two, default and copy constructor, a list to a newly defined list, ie 'list listA(listB)')...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as...
Java question, Please answer everything. Thank you Answer the following questions as briefly (but completely) as possible: What is a checked exception, and what is an unchecked exception? What is NullPointerException? Which of the following statements (if any) will throw an exception? If no exception is thrown, what is the output? 1: System.out.println( 1 / 0 ); 2: System.out.println( 1.0 / 0 ); Point out the problem in the following code. Does the code throw any exceptions? 1: long value...
Java Please [(1)] A palindrome is a string that reads the same forwards as backwards. Using...
Java Please [(1)] A palindrome is a string that reads the same forwards as backwards. Using only a fixed number of stacks and queues, the stack and queue ADT functions, and a fixed number of int and char variables, write an algorithm to determine if a string is a palindrome. Assume that the string is read from standard input one character at a time. The algorithm should output true or false as appropriate [(2)] Let Q be a non-empty queue,...
Please answer the following C question: There is a documented prototype for a function called get_a_line...
Please answer the following C question: There is a documented prototype for a function called get_a_line in the code below. Write a definition for get_a_line—the only function called from that definition should be fgetc. #include <stdio.h> #include <string.h> #define BUFFER_ARRAY_SIZE 10 int get_a_line(char *s, int size, FILE *stream); // Does what fgets does, using repeated calls to fgetc, but // provides a more useful return value than fgets does. // // REQUIRES // size > 1. // s points to...
The language is Java. Using a singly-linked list, implement the four queue methods enqueue(), dequeue(), peek(),...
The language is Java. Using a singly-linked list, implement the four queue methods enqueue(), dequeue(), peek(), and isEmpty(). For this assignment, enqueue() will be implemented in an unusual manner. That is, in the version of enqueue() we will use, if the element being processed is already in the queue then the element will not be enqueued and the equivalent element already in the queue will be placed at the end of the queue. Additionally, you must implement a circular queue....
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n ==...
QUESTION 1 For the following recursive function, find f(5): int f(int n) { if (n == 0)    return 0; else    return n * f(n - 1); } A. 120 B. 60 C. 1 D. 0 10 points    QUESTION 2 Which of the following statements could describe the general (recursive) case of a recursive algorithm? In the following recursive function, which line(s) represent the general (recursive) case? void PrintIt(int n ) // line 1 { // line 2...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT