Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
55 Cards in this Set
- Front
- Back
Give number of bytes, .NET structure, and description for the C# keyword: byte |
1 byte Byte Positive integer from 0 to 255 |
|
Give number of bytes, .NET structure, and description for the C# keyword: sbyte |
1 byte SByte Signed integer from -128 to 127 |
|
Give number of bytes, .NET structure, and description for the C# keyword: short |
2 bytes Int16 short integer from -32,768 to 32,767 |
|
Give number of bytes, .NET structure, and description for the C# keyword: ushort |
2 bytes UInt16 unsigned integer from 0 to 65,535 |
|
Give number of bytes, .NET structure, and description for the C# keyword: int |
4 bytes Int32 signed integer from ~ -2 billion to ~ + 2 billion |
|
Give number of bytes, .NET structure, and description for the C# keyword: uint |
4 bytes UInt32 unsigned integer from 0 to ~ + 4 billion |
|
Give number of bytes, .NET structure, and description for the C# keyword: long |
8 bytes Int64 signed integer from ~ -9 billion to ~ + 9 billion |
|
Give number of bytes, .NET structure, and description for the C# keyword: ulong |
8 bytes UInt64 unsigned integer from 0 to ~ +18 billion |
|
Give number of bytes, .NET structure, and description for the C# keyword: float |
4 bytes Single signed float w/ 7 sig figs |
|
Give number of bytes, .NET structure, and description for the C# keyword: double |
8 bytes Double signed float w/ 14 sig figs |
|
Give number of bytes, .NET structure, and description for the C# keyword: decimal |
16 bytes Decimal signed float w/ 28 sig figs |
|
Give number of bytes, .NET structure, and description for the C# keyword: char |
2 bytes Char single unicode character |
|
Give number of bytes, .NET structure, and description for the C# keyword: bool |
1 byte Boolean on or off |
|
keyword to declare a constant in C# |
const |
|
variable naming convention for C# |
camel case |
|
how do you identify a literal value as a float in C#? |
append f or F |
|
how do you identify a literal value as a decimal in C#? |
append m or M |
|
Naming convention for constants in C# |
Pascal case (not all upper) |
|
Order of precedence for arithmetic operators in C# |
1. Increment and decrement 2. Positive and negative 3. Multiplication, division, modulus 4. Addition, subtraction |
|
Does C# allow implicit casting for widening conversions? |
yes, it will automatically promote but will not automatically demote |
|
Syntax to explicitly cast for narrowing conversion |
(type)varName int grade = (int)myDecimal; |
|
Five static methods of the Math class in C#, including appropriate capitalization |
Math.Pow(int 1, int power); Math.Round(decimal [, precision [,roundingMode]]); Math.Sqrt(decimal); Math.{Min|Max}(decimal1, decimal2); |
|
Default rounding mode in C# |
banker's rounding: if you round a decimal that ends in 5, it is rounded to the nearest even decimal value |
|
create a new string that concatenates string1 and "a" |
string newString = string1 + "a"; |
|
Any difference in escape sequences for C#? |
no |
|
verbatim string literal |
lets you use characters that would normally require an escape sequence without using an escape sequence. Prepend with @ and enclose in double quotes string path = @"c:\c#\files"; |
|
How do you enter double quotes within a verbatim string literal? |
double double quotes string x = @"Enter ""x"" "; |
|
structure vs. class in C# |
structure: variables are value types. Each variable retains its own copy class: variables are reference types. Does not store the data itself. Each variable contains a reference to the area of memory where the reference is stored |
|
When you use a C# keyword like double or string, what are you actually doing? |
using an alias for the associated data structure or class |
|
is double a C# keyword for a structure or a class? Is it a value type or a reference type? |
.NET structure: Double value-type |
|
is string a C# keyword for a structure or a class? Is it a value type or a reference type? |
.NET class: String reference type |
|
can two or more variables refer to the same double object? What about the same string object? |
double: no. they each store their own copy string: yes. it's a reference type (class), not a value-type (structure) |
|
method to convert to a string |
myString.ToString([format]); //format is optional |
|
static method that converts the specific string to to an equivalent data value. If the string can't be converted, an exception occurs. |
Integer.Parse(myString); Double.Parse(myString); etc. |
|
static method that converts the specified string to an equivalent data value and stores it in the result variable. Returns a true value if the string is converted. Otherwise, returns a false value. |
bool wasConverted = Decimal.TryParse(myString, out resultVar) |
|
Conversion statements using the Convert class |
//static methods for converting to built-in types Convert.ToString(myDecimal); Convert.ToDecimal(myString); Convert.ToInt32(myString); Convert.ToInt16(myString); Convert.ToBool(value); |
|
Standard numeric formatting codes: Formats the number as current with the specific number of decimal places |
Currency C or c with number appended |
|
Standard numeric formatting codes: Formats the number as a percent with the specified number of decimal places |
Percent P or p with number appended |
|
Standard numeric formatting codes: Formats the number with thousands separators and the specified number of decimal places |
Number N or n with number appended |
|
Standard numeric formatting codes: Formats the number as a decimal with the specified number of decimal places: |
Float F or f with number appended |
|
Standard numeric formatting codes: Formats an integer with the specified number of digits |
Digit D or d with number appended |
|
Standard numeric formatting codes: Formats the number in scientific (exponential) notation with the specified number of decimal places |
Exponential E or e with number appended |
|
Standard numeric formatting codes: Formats the number as a decimal or in scientific notation depending on which is more compact |
General G or g with number appended |
|
Where can you declare variables with class scope? |
After the code that is generated for a form (After InitializeComponent()) |
|
enumeration |
set of related constants that define a value type where each constant is known as a member of the enumeration |
|
What are enumerations provided by the .NET framework generally used for? |
setting object properties and specifying the values passed to methods |
|
Give an example of a common enumeration provided by the .NET framework |
FormBorderStyle.FixedDialog FormBorderStyle.FixedSingle FormBorderStyle.Sizable this.FormBorderStyle = FormBorderStyle.FixedSingle; //normally you would use the properties window to code this |
|
When does it make sense to write your own enumeration? |
When a user needs to select one option from a group of related options. Create an enumeration to keep them together |
|
Syntax to create an enumeration of shorts. What is the default data type if you leave out short? What are the default values if you don't assign values? |
enum MyTerms : short { Net30Days = 30, Net60Days = 60, Net90Days = 90 } default data type: int default values: 0, 1, 2 (whatever indexes would be) |
|
How do you refer to an enumerator constant? |
EnumerationName.MemberName |
|
How do you refer to the name of the constant in the enumeration instead of its value? |
EnumerationName.MemberName.ToString(); |
|
In C#, can value types store null values? What about reference types? |
Value types: no, not by default. Must use nullable types References types: yes |
|
How do you declare a nullable type? |
Question mark after type double? myDouble = null; |
|
Once you've declared a nullable type, how do you check if it has a value? How to do you get the value? |
myNum.HasValue() myNum.Value() |
|
null coalescing operator |
?? Returns value of left operator if not null and value of right operator if it is int? quantity = null; quantity ?? = 52; |