test 2 Flashcards

1
Q

for each loop array

A

static void Main( )
{
int[] fibarray = new int[] { 0, 1, 2, 3, 5, 8, 13 };

        foreach (int i in fibarray)
        {
            Console.WriteLine(i);
        }
    }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

class

A

a program construct used to represent an entity type in the real world… used as a templit to create objects… classes contain both data and procedural information

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

object

A

an instance of a class… reps a real-world occurrence of an entity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

attribute

A
characteristic of a class.
In-line attributes are ones that are declared within the class
Associated attributes are contained in another class.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Method

A

procedure that applies to the data in a class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Inheritance

A

a class association that allows the attributes and methods of a parent class to be available to the child classes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

class visibility modifiers

A

Public (+)
Protected (#)
Package (~)
Private (-)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

static

A
means that the class component is
    associated with the class
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

UML Class Diagrams

A

Class name – Starts with capital, camel case thereafter.
Attributes – Characteristics of the class (i.e., variables and constants).
Methods – Behaviors of the class (i.e., procedures).
Inheritance links – Associations between classes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

CASE Selection Structure

A
SELECT CASE light-color
CASE “red”
Print “stop light”
CASE “yellow”
Print “caution light”
CASE “green”
Print “go light”
CASE Else
Print “broken light”
ENDSELECT
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Iteration Constructs

A

DO WHILE - Test at top, 0 or more loops

DO UNTIL - Test at bottom, 1 or more loops

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Access Modifiers

A

Protected
Internal
Protected Internal
Public

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

single dimension array

A

decimal[] money = new decimal[100];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

rectangular 2-D

A

type[ , ] identifier = new type [intValue, intValue];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

jagged 2-D

A

type[][] identifier = new type [intValue] [];

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Enumerations

A
a convenient way to create a set of symbolic names that map to known numeric values.
enum StudentType
	 {
	  Freshman,  //=0
 	  Sophomore, //=1
 	  Junior,    //=2
 	  Senior     //=3
 	 }
using enum.
StudentType.Freshman
17
Q

structs

A
are data structures composed of several pieces of data.
public struct Product
	{
 	 public string Code;
 	 public string Description;
 	 public decimal Price;
	}
18
Q

sealed vs abstract

A

abstract–cannot be instantiated, only derived from.

sealed–cannot be derived from, only instantiated.

19
Q

encapsulation

A

classes and objects can hide information from the outside world

20
Q

Polymorphism

A

The fact that child classes can override the methods and attributes of the super class

21
Q

data members

A

store data associated with the class or instance of the class.

22
Q

Function members

A
execute code and model the actions of the
real-world object that the class represents.
23
Q

creating objects

A

Car myCar= new Car();

24
Q

adding field values to an object

A

ObjName.fieldName = “value”

25
Q

custom constructor

A
public ObjName(int myInt)
  {
    Console.WriteLine(“Custom code here”);
  }
26
Q

override methods

A

takes an existing inherited method and provides a new implementation of that method.

27
Q

hiding methods

A

classes or structs redeclare names that were inherited from base classes

28
Q

TryParse

A

is used to convert text data to numeric without causing a run-time exception
int.TryParse(input, out val);

29
Q

try-catch-finally

A

try{ // Statement(s) which can cause an exception
}catch(type x){ // Statement(s) for handling the exception}
finally{ // Cleanup code (if needed)}

30
Q

params

A

create a parameter array which allows you to pass an indefinite number of arguments.

31
Q

out

A

requires the called function to give the parameter a value. Allows functions to pass data back to calling routine.

32
Q

ref

A

value is initially assigned by the calling routine, but may be changed within the function. Allows values to be passed back