C# ISYS 250

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Char data type

'\0'

What is the value of length after the code that follows is executed? int[][] nums = { new int [] {1, 2, 3}, new int [] {3, 4, 5, 6, 8}, new int [] {1}, new int [] {8, 8} }; int length = nums.GetLength(0);

...

What is the value of length after the code that follows is executed? int[][] nums = { new int [] {1, 2, 3}, new int [] {3, 4, 5, 6, 8}, new int [] {1}, new int [] {8, 8} }; int length = nums[2].Length;

1

3 types of validity

1- to make sure that a required entry has been made 2- to make sure that an entry had a valid numeric format 3- to make sure that an entry is within a valid range

When you declare and initialize the values in an array, you are actually creating an instance of what class?

Array

Which of the following statements sorts a one-dimensional array named values?

Array.Sort(values);

Code example 8-1 Queue<String> productQueue = new Queue<String>(); productQueue.Enqueue("Plate"); productQueue.Enqueue("Bowl"); productQueue.Enqueue("Cup"); productQueue.Enqueue("Saucer"); (Refer to code example 8-1.) What is the value of product after the following code is executed? string product = productQueue.Dequeue();

Plate

Code example 8-1 Queue<String> productQueue = new Queue<String>(); productQueue.Enqueue("Plate"); productQueue.Enqueue("Bowl"); productQueue.Enqueue("Cup"); productQueue.Enqueue("Saucer"); (Refer to code example 8-1.) What is the value of product after the following code is executed? string product = productQueue.Peek();

Plate

Stack LIFO

Last in, first out collection because its items are retrieved in the reverse order from the order in which they are added.

List<> class

System.Collections.Generic namespace. pg. 245

Boxing

The process of putting a value in an object . done automatically whenever a value type needs to be converted.

Which of the following defines unboxing correctly?

When an object type is converted to a value type

A queue provides

a Dequeue method for getting the next item in the collection

Delegate

an object that represents a method. C# uses the EventHandler delegate thats defined by the .NET Framework to wire events to methods.

Length property of an array

arrayName.Length

Untyped collection

could store any type of object in different collections.

Statement that passes three arguments

decimal futureValue = CalculateFutureValue(monthlyInvestment, monthlyInterestRate, months);

Access Modifier

indicates whether the method can be called from other classes.

Which of the following statements determines the number of strings in the array that follows? string[] customers = new string[55];

int size = customers.Length;

Dynamic plymorphism

is implemented by abstract classes and virtual functions

To refer to the ninth element in a one-dimensional array named sales, you code

sales[8]

You can use the BinarySearch method of the Array class to

search for a value in a sorted array and return the index of that value

Which of the following is not true about a SortedList collection?

some collections used indexs that starts with 1. Key values must be added to a sorted list in alphabetical order

Which of the following statements declares a valid rectangular array?

string[,] js = new string[4,4];

Which of the following statements declares a valid jagged array?

string[][] js = new string[4][];

The syntax for calling a method

this.MethodName([argumentList])

How to perform a calcuation

total = subtotal * (1 - this.GetDiscountPercent(subtotal));

How prevent NullReferenceException

use nested if statements. or null condition operators such as ?

Stack<T>

uses methods to add and remove elements.

What is the value of lists after the statements that follow are executed? string[,] names = new string[200,10]; int lists = names.GetLength(0);

200

What is the value of kilos[1] after the code that follows is executed? decimal[] kilos = {200, 100, 48, 59, 72}; for (int i = 0; i < kilos.Length; i++) { kilos[i] *= 2.2; }

220.0

What is the value of index after the code that follows is executed? int[] values = {2, 1, 6, 5, 3}; Array.Sort(values); int index = Array.BinarySearch(values, 5);

3

What is the value of times[2,1] in the array that follows? decimal[,] times = { {23.0, 3.5}, {22.4, 3.6}, {21.3, 3.7} };

3.7

Capacity/Count

Capacity- gets or sets the number of elements a list can hold Count- gets the number of elements in a list

Which of the following is not true about collections?

Some collections use indexes that start with 1.

Which of the following is not true for typed collections?

You need to cast any elements that are retrieved from the collection to the specified data type.

Public

call the method from another class

Private

can only be called within the class

To generate the event for the default event of a form or control

double-click the form or control in the Form Design

Jagged arrays

let you store data in a table that can have rows of unequal lengths.

StackTrace

list of the methods that were called before the exception occurred. These methods are listed in reverse order from the order in which they were called.

Which of the following method declarations is valid for a method that accepts an array of strings named customerNames?

private void ParseCustomerNames(string[] customerNames){}

Pass arguments

the arguments must be in the same order as the parameters in the parameter list defined by the method.

When you add or inset method to add elements to a list,

the capacity of the list is doubles each time its capacity is exceeded.h

To refer to the second column in the fourth row of a rectangular array named vendors, you code

vendors[3,1]


Set pelajaran terkait

NURS 3740 Quiz 4 Intro to EBP and Research; Home Health

View Set

life Policy Provisions & Options

View Set