• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/26

Click to flip

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;

26 Cards in this Set

  • Front
  • Back
what are value types?
contain their data directly.
on assignment data is copied from one variable to the other and stored in two different locations on the stack.

They are objects with methods. ex ToString. Derived from System.Object
name three general value types.
1. built in types (numeric boolean etc..)
2. user defined types
3. enumerations
name some built in numeric types
SByte/sbyte -128 to 127 1 byte
Byte/byte 0 to 255 1
Short/short -32768 to 32767 2
Integer/int -2147483648 to 42147483647
Uinteger/uint o to 4294967295 4
Long/long 8
Single/float 4
Double/double 8
Decimal/decimal 16
name the built in types that are optimized
Integer/int
Uinteger/uint
Double/double
name some built in value types that are non-numeric
Char/char 2 bytes
Boolean/bool 1 byte
IntPtr platform
Date/date 8 bytes
How to declare value types
Dim b as Boolean = False
bool b = false
What type of constructors do value tyes have?
Implicit constructors
so just declare and they are automatically instantiated.
Which .net language is not case sensitive?
vb.net

C# is case sensitive
How do you determine if a variable has been assigned to a value?
Declare is as nullable then use .hasValue
Dim b as Nullable(Of Boolean) = nothing
Nullable<bool> b = null; or bool? b = null;

If b.HasValue Then .. b.Value
i
How do you create user-defined types (structures) ?
Structure Cycle
Dim _val, _min, _max as Integer
Public Sub New(ByVal min as integer, ByVal max as Integer)
_val = min : _min= min : _max = max
End Sub
Public Property Value() as Integer
Get
return _val
End Get
Set (ByVal value as Integer)
if value > _max then me.Value = value
....
end Set
End Property
Public Overrides Function ToString() as String
return value.ToString
End Function
Difference between struct and class
Structure ->Class
class is allocated on the managed heap rather than as X bytes on the stack ( 4 for each private integer field) and assignments between variables results in both pointing to same instance.

Stuctures are more effecient
When should you use a structure over a class?
when a structure type can meet the following:
represents a single value logically
has an instance size less than 16 bytes
is not frequently changed after creation
is not cast to a reference type.
What are enumerations?
Enumerations related symbols that have fixed values.

often used to provide a list of choices to user
Ex:
Enum Titles
Mr
Mrs
Miss
End Enum
enum Titles { Mr, Ms, Mrs, Dr};
How are enumerations stored and outputed
Stored as integer
Outputed as string

Dim t as Titles = Titles.Dr
Console.WriteLine("{0}.", t)
'dislplays "Dr."
what are reference types?
reference types store addresses of data (pointer) stored in heap.

assigning on ref to another will create 2 ref pointing to same data.
how is garbage collection triggered?
automatically by runtime or by callig GC.Collect
what are some built in reference types?
system.object
system.string
system.text.stringbuilder
system.array
system.io.stream
system.exception
are system.strings mutable?
no. they are immutable any change to the string causes the runtime to create a new string.
name some methods of system.string
replace
concat
join
format
how do you create mutable strings?
use stringbuilder class

creates 16 byte buffer and grows as needed.
how to use stringbuilder ?
dim sb as new system.text.stringbuilder(30)

sb.append("x")
+or &
equality
inequality
assignment
how do you create and sort an array?
dim ar() as integer = {3,1,2}
array.sort(ar)
console.writelie ("{0},{1}", ar(0),ar(1))
name some common stream types?
FileStream
MemoryStream
StreamReader
StreamWriter
code reading and writing to a file.
dim sw as streamwriter = new streamwriter("x.txt")
sw.writeline("hi")
sw.close

dim sr as streamreader = new streamreader("x.txt")
console.writeline(sr.readtoend)
sr.close
how to handle exceptions
try
dim x as int
...
catch ex as Exception
console.writeline(ex.message)
end try
how to filter exceptions
try
...
catch ex as system.io.filenotfoudexception
...
catch ex as system.unauthorizedaccessexcetion
....
catch ex as exception
....
end try