CIS 199 Test 01 Review. Computer Hardware Central Processing Unit (CPU) Brains Operations...

31
CIS 199 Test 01 Review

Transcript of CIS 199 Test 01 Review. Computer Hardware Central Processing Unit (CPU) Brains Operations...

Page 1: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

CIS 199 Test 01 Review

Page 2: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Computer Hardware Central Processing Unit (CPU)

Brains Operations performed here

Main Memory (RAM) Scratchpad Work area for programs, process, temporary data

Secondary Storage Hard drive Flash drive CD, DVD

Page 3: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Input, Output Devices Input

Takes data IN Keyboard, Mouse, Game Controller, Microphone

Output Pushes, places data OUT Display, Speakers, Printers

Page 4: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Programs and Digital Data Programs

Operating Systems. Microsoft Office, Web browsers Instructions read by CPU and processed

Digital Data 1’s 0’s …forms binary (base 2)

Page 5: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Built-In Types

Page 6: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

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 7: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.
Page 8: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

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 9: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

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 10: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Named Constants AVOID MAGIC NUMBERS! Allows for reference across similar scope Change once, changes everywhere

Page 11: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Conditional Logic if(expression)

If ‘expression’ is true If not true, skipped

else if(expression) Can be used to ‘chain’

conditions Code runs if ‘expression’ is

true else

Code to execute if ‘expression’ false

Statements can be nested

Page 12: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Relational Operators >

Greater than <

Less than >=

Greater than OR equal to <=

Less than OR equal to ==

Equal to !=

NOT equal to

X > Y

X >= Y

X < Y

X <= Y

X == Y

X != Y

Page 13: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Operator Precedence (Highest) ++, --, ! * / % + - < > <= >= == != && || = *= /= %= += -= (Lowest)

Detailed from:http://msdn.microsoft.com/en-us/library/2bxt6kc4%28v=vs.100%29.aspx

Page 14: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Comparing Strings You can use

==, !=

You cannot use >, >=, <, <=

You SHOULD use: String.Compare(s1, s2)

s1 > s2 Returns positive Number

s1 = s2 Returns zero

s1 < s2 Returns negative number

Compares the unicode value of EACH character

Page 15: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

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 16: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.
Page 17: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.
Page 18: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Sample Questions

Page 19: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

What does ‘WYSIWYG’ stand for? What You See Is What You Get

Page 20: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

What is the difference between a high-level and a low-level language? Low-Level

Little to no ‘abstraction’ from the hardware or computer “Close to the hardware” Simple, but Difficult to use Machine code, assembly, C (in some cases)

High-Level Very strong ‘abstraction’ from the hardware or computer “Far from the hardware” Easier to use, abstraction adds complexity C++, Java, C#, Python

Page 21: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

How is the lifetime of a FIELD different from a lifetime of LOCAL variable? Fields are members of their

containing type Fields can be used

everywhere with appropriate scope

Local variables can be used only in their “local” environment

Page 22: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

What two things does a variable declaration specify about a variable? Type Identifier

TYPE IDENTIFIER

Page 23: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Describe ‘&&’ and ‘||’ and how they work. && (AND)

Returns true if conditions are ALL true

“If you do well on the test AND the quiz, you will earn a great grade!”

|| (OR) Returns true if ANY

conditions are true “You can run a mile OR

walk two miles (possible do both!)”

Page 24: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Why is ‘TryParse’ more effective than ‘Parse’?

Less code No try / catch required

Page 25: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

What is the difference between a SIGNED an UNSIGNED int?

Page 26: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

What is the difference between syntax errors and logic errors? Syntax Errors – Errors that prevent compilation or other

factors that prevent successful compilation striing myString = string.Empty; // Won’t compile, syntax error

Logic Errors – Errors that occur during runtime, such as incorrect comparison or other unexpected behavior If(grade > 60) { Code if grade is F } // Incorrect operator used

Page 27: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

What are the “Five logical units”? CPU – Processing, instructions Memory – Scratch pad, working space (Temporary) Secondary Storage – Hard drives, storage (Long term) Input – Keyboards, Mice, Controllers Output – Monitors, Speakers, Printers

Page 28: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Explicit type conversion? Why and how? Variables must be used for a single type never change Move from one type to another, must cast EXPLICIT cast / type conversion

Aware of information loss

Page 29: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Write a code fragment that will display “Good Job” when int variable score is 80 or more, “OK” when score is 70 – 79, and “Needs Work” for any score under 70.

Page 30: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

Write a code fragment that will apply a 10% discount to the value in double variable total when int variable numItems is 5 or more and int variable zone is 1, 3 or 5.

Page 31: CIS 199 Test 01 Review. Computer Hardware  Central Processing Unit (CPU)  Brains  Operations performed here  Main Memory (RAM)  Scratchpad  Work.

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)

Monday-Thursday8:00am – 8:00pm

Friday8:00am – 4:00pm

Sunday12:00pm – 2:00pm (CRC Only)