cis 200 test 01 review
DESCRIPTION
CIS 200 Test 01 Review. Built-In Types. Properties. Exposed “Variables” or accessible values of an object Can have access controlled via scope modifiers When thinking of properties: Values and definitions “get” – Code to run before returning a value - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/1.jpg)
CIS 200 Test 01 Review
![Page 2: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/2.jpg)
Built-In Types
![Page 3: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/3.jpg)
Properties Exposed “Variables” or accessible values of an object Can have access controlled via scope modifiers When thinking of properties: Values and definitions “get” – Code to run before returning a value “set” – Code to run before updating a value
Can be used for validation and other processing actions “value” is a keyword in “set”
![Page 4: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/4.jpg)
![Page 5: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/5.jpg)
Methods Actions, code to be executed May return a value, may take value (not required) Can be controlled via scope keywords Can be static
![Page 6: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/6.jpg)
Memory Management C, C++ - Have to “allocate” memory
Forgetting to “free” results in memory leaks
“Garbage Collector” Rounds up and “reclaims” memory Variables that drop out of “scope” will be collected
Temporary values inside methods reclaimed on method exit Generally uncontrolled by the developer
![Page 7: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/7.jpg)
LINQLanguage Integrated Query Perform Queries Against Objects, Data
![Page 8: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/8.jpg)
LINQ Keywords “from” - Data Source “where” – Filters the source elements with Boolean
expressions “select” – Choosing the data type to work with “group” – Groups results according to a desired key value “orderby” – Sorts the query results in ascending or
descending order based on a comparer “let” – Introduce a variable for query use
![Page 9: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/9.jpg)
![Page 10: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/10.jpg)
PreconditionsPostconditions Preconditions:
What must be TRUE before calling a method
Postconditions: What will be TRUE after a method completes
![Page 11: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/11.jpg)
![Page 12: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/12.jpg)
Namespaces, Scope Classes, often with common functionality, bundled together
System.Console System.Collections.Generic System.Linq
Scope “private” – Can only be accessed by the class, object itself “protected” – Can only be accessed by the class, object, or any
child classes, objects “public” – Available access for all
![Page 13: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/13.jpg)
Constructors C#, .NET compiler provides a ‘free’ constructor
No parameters
When a new constructor is created, ‘free’ constructor goes away
Constructors can be “connected” with “this”
![Page 14: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/14.jpg)
![Page 15: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/15.jpg)
Interfaces Object used for creating “interfaces”, common code Classes “include” an interface All methods, properties are “abstract” in an interface Objects that implement interface can be grouped
List<IPayable>
IPayable, IDisposable, etc
![Page 16: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/16.jpg)
![Page 17: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/17.jpg)
Inheritance Classes with child or children classes Can be used to “share” common code properties Allows for “unique” objects, while reducing code Object -> Person -> Student Object -> Person -> Employee
![Page 18: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/18.jpg)
InheritanceKeywords “abstract” – Methods marked MUST be overridden
Class declared with abstract prevents creation with “new”
“virtual” – Methods marked CAN be overridden Controls “how” other classes inherit information from the
class Private, protected, public – Used to control what is
inheritance
![Page 19: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/19.jpg)
![Page 20: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/20.jpg)
![Page 21: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/21.jpg)
Casting Convert one type to another
Integer to String Decimal to Integer Byte to Integer
C#, .NET will know how to “box” and “unbox” types Decimal -> Object -> Integer
Remember back to the Person – Student relationship We can “cast” Person to Student both ways
![Page 22: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/22.jpg)
Will compile,But will throw an
EXCEPTION at runtime
Will cast to student just fine
![Page 23: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/23.jpg)
Exceptions andException Handling Exceptions are…
“Exceptional” events Unexpected events, errors during runtime Unhandled exceptions? Stack trace and application death
Handled with try/catch/finally blocks Try block “attempts” to run the code in question Catch block handles the exception(s) that may occur Finally block, optional, always executes
![Page 24: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/24.jpg)
![Page 25: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/25.jpg)
![Page 26: CIS 200 Test 01 Review](https://reader036.vdocuments.mx/reader036/viewer/2022062409/5681502f550346895dbe2713/html5/thumbnails/26.jpg)
How can REACH further help you today?
Ask Questions Now! Need to see an Example? Need to see a concept again? Need additional help?
Visit us at: iTech Zone CRC (Ekstrom Library)
M-Thur 8:00am – 8:00pm Friday 8:00am – 4:00pm Sunday 12:00pm – 2:00pm
(CRC Only)