Midterm Flashcards
What is object-oriented programming?
A programming methodology where programmers create software objects that model things.
Why do people like OOP?
It enhances programmer productivity and reduces software costs.
Machine vs assembley vs high level languages.
Machine language is directly understood by computers.
Assembly language uses English like abbreviations to represent elementary operations.
High-level languages are translated to machine language using compiler programs.
What are objects and methods used for?
Objects are reusable software components and methods are used to perform a task in a program.
How are objects created?
Objects are created with attributes and behaviors.
What are the characteristics of the C# language?
C# is event-driven and a visual programmin glanguage that allows for multiple tasks to be performed at the same time.
What is the Common Language Runtime (CLR) and platorm independence?
CLR provides functionality that makes .NET programs easier to develop and debug.
What is an IDE used for?
An IDE (integrated development environment) provides programmers with tools to aid in software development and allows you to write, run, test, and debug C# programs quickly.
What are namespaces and code blocks?
Namespaces are named collections of classes.
Code blocks are defined by curly brackets ({ }).
C# comments
’//’ comments out a single-line
‘/…/’ comments out multiple lines.
Naming Conventions
Cannot use keywords, pick a name that is descriptive, but not too long, class names should have each new word capitalized, identifiers should use camelBack casing.
How do you write to the console?
Conosle.WriteLine( ) or Console.Write( )
What is a variable and how do you declare one?
A memory location where a value can be stored for use later in an app.
Declared with a name and type.
Characteristics of C# integers and types.
32 bit integer value
Integer Math
Follows order of operations (PEMDAS)
What are the main categories of structured programming?
Sequence statements, repetition statements, selection statements.
Conditions
An expression that can be classified as true or false.
Three types of selection statements.
if statement
if else statement
else if statement
C# Error Types
Dangling-else: which if is the else associated with?
Logic Errors: only effect resulting output
Syntax Errors
The four types of repetition statements
While loop
do while loop
for loop
infinite loop
Control/Counter variables
Control: typing in something that matches with the control variable to end the loop
Counter: adding a value to a variable till it matches the number you want to reach
Assignment Operator
A variable is definitely assigned when its guaranteed to be assigned a value before being used.
Sentinel vs counter controlled repetitions
Sentinel: values that signify the end of data entry
Counter: counts till it reaches a number to end the loop
Variable Scope
Defines where the variable can be use in an application
Break vs Continue
Break: causes an immediate exit from the statement
Continue: skips the remaining statements in the loop body and proceeds with the next iteration
Characteristics of C# arrays
Fixed-length
Elements must all be the same type
Indexing starts at 0
c.Length gets the length of array c
Array-access and creation expressions
Need to specify a type and length
C# Constants
const declares a constant
Muse be initialized when declared and cannot be modified
Should be written in capital letters
Jagged Arrays
Maintained as a 1D array referring to another 1D array’s elements
More flexible than other arrays
Length of the arrays DO NOT need to be the same
Each 1D array needs to be initialized separately
Rectangular Arrays
Each row has the same number of rows and columns
Can be accessed with arrayName[row,column]