Advanced Object-Oriented Programming MIDTERM

5.0(4)
studied byStudied by 29 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/123

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

124 Terms

1
New cards

C#

developed by Microsoft in the early 2000s

2
New cards

C#

known for its OOP features and simplicity

3
New cards

using Directives

used to import namespaces, containing classes and other types used in the program

4
New cards

Namespaces

to organize code into logical groups and prevent naming conflicts

5
New cards

class declaration

classes are blueprints for creating objects encapsulating data and behavior

6
New cards

Main Method and Program Execution Flow

contains the program's main logic

7
New cards

Additional Methods and Class Members

a class can contain additional methods and class members defining the behavior of the program

8
New cards

Console.Write() and Console.WriteLine()

are used to output text, variables, and other data to the console

9
New cards

Console.WriteLine()

appends a new line character at the end of the output, moving the cursor to the next line

10
New cards

Format Specifiers

used within the string to indicate how variables should be formatted

11
New cards

Escape Sequences

special character combinations that represent characters that cannot be printed using the normal way of printing

12
New cards

\n or New Line

Moves the cursor to the beginning of the next line

13
New cards

\t or tab

Inserts a horizontal tab

14
New cards

\" Double Qoute

Inserts a double quote character

15
New cards

\' Single Qoute

Inserts a single quote character

16
New cards

\\ or Backslash

Inserts a backslash character

17
New cards

\b or Backspace

Moves the cursor back one position

18
New cards

\r or Carriage return

Moves the cursor to the beginning of the current line

19
New cards

{ and }

the function definition is placed inside these characters

20
New cards

Member Variables

These are places inside thr curly braces when defining a structure

21
New cards

Placeholders

used within output statements to specify the position and format of variable values. They are represented by format specifiers, enclosed in { and }

22
New cards

numeric position

Placeholders are identified by their (___________) within the curly braces

23
New cards

control the formatting

Format specifiers are used to (______________) of the displayed values

24
New cards

{0:d} or {0:D}

Format the 1st argument as a decimal (integer) number

25
New cards

{1:f} or {1:F}

Format the 2nd argument as a floating-point number

26
New cards

{2:c} or {2:C}

Format the 3rd argument as a currency value

27
New cards

{3:s} or {3:S}

Format the 4th argument as a string

28
New cards

Console.ReadLine()

is used to accept a string input from the user

29
New cards

int.Parse()

used to convert the input string into an integer

30
New cards

float.Parse()

used to convert the input string into a float

31
New cards

while loop

repeats a code block as long as specified condition is true----condition is evaluated BEFORE each iteration of the loop

32
New cards

do-while loop

allows you to repeat a code block at least once, and then continue repeating it as long as a specified condition is true------the condition is checked AFTER each iteration

33
New cards

for loop

allows you to repeat a code block a specific number of times----provides a concise and structured way to control loop iterations

34
New cards

syntax of while loop

while(condition) { //statements}

35
New cards

syntax of do-while loop

do{ //statements}while(condition);

36
New cards

syntax of for loop

for(initialization; condition; increment/decrement){ //statements}

37
New cards

initialization

initializes the loop control variable

38
New cards

condition

evaluated before each iteration

39
New cards

increment/ decrement

modifies the loop control variable; commonly used for incrementing and decrementing loop counter

40
New cards

Nested Loops

a powerful way to perform repetitive tasks that require multiple iterations

41
New cards

outer loop

for control and execution of inner loop

42
New cards

inner loop

iterations of the outer loop

43
New cards

break

prematurely terminates the execution of the loop

44
New cards

continue

used to skip the current iteration of a loop and move to the next iteration

45
New cards

array

a fundamental data structure in C# that allows you to store a COLLECTION of elements of the SAME type

46
New cards

Array traversal

process of accessing array elements one-by-one, allowing you to perform operation on individual elements or analyze the entire array

47
New cards

One-Dimensional Array

the simplest form of arrays and provides a convenient way to store and manipulate collections of data

48
New cards

arrayName.Length()

returns the value of the array's length/size

49
New cards

Two-Dimensional Array

Array containing multiple rows and columns, forming a grid-like structure

50
New cards

arrayName.GetLength(0);

returns the value of the array's length/size for rows

51
New cards

arrayName.GetLength(1);

returns the value of the array's length/size for columns

52
New cards

Function

encapsulates reusable codes / promotes the Don't Repeat Yourself (DRY) principle

53
New cards

return type, name, and parameters

A function is defined with a (_____), (_____), and (________) enclosed in parentheses

54
New cards

TRUE

TRUE OR FALSE: A function is called by specifying its name and passing the arguments if required

55
New cards

access_modifier

Specifies the accessibility of the function. It can be public, or private,or protected

56
New cards

return_type

Data type of the value the function returns. Use void if the function doesn't return any value

57
New cards

function_name

A unique name for the function, following the C# naming conventions

58
New cards

parameter_list

List of input parameters (if any) that the function expects. If there are no parameters, leave the parentheses empty

59
New cards

Function Body

Block of code inside the function where the task is performed

60
New cards

return value

If the function has a non-void return type, it must return a value of that type using the return statement

61
New cards

Actual Parameters

values passed on to the function when it is called

62
New cards

Formal Parameters

placeholders defined in the method declaration or definition

63
New cards

Passing by Value

C# passes parameters by value by default

64
New cards

TRUE

TRUE OR FALSE: Any changes made to the formal parameters within the method do NOT affect the original values of the actual parameters

65
New cards

Passing by Reference

allows methods to modify the original values of the actual parameters directly

66
New cards

ref

To pass by reference in C#, the (___) keyword is used

67
New cards

TRUE

TRUE OR FALSE: By passing a variable by reference to a method, any changes made to the formal parameters within the method will AFFECT the original values of the actual parameters

68
New cards

return Keyword

used to exit a method and provide a value to the caller

69
New cards

void

used if methods do not need to return any value

70
New cards

Recursive Functions

A function that CALLS ITSELF to solve a smaller instance of the same problem

71
New cards

Base Case

The simplest form of the problem that can be directly solved

72
New cards

Recursive Case

Where the function calls itself with a reduced version of the original problem until it reaches the base case

73
New cards

Structures

A fundamental concept in the C# programming language that allow you to define and manipulate COMPOSITE data types

74
New cards

Structures

They are used to group related data items of different types into a single unit

75
New cards

structure name ---- variable name

To create an instance, you use the (__________) followed by the (___________) and optionally initialize the members

76
New cards

dot (.) operator

used in accessing structure members

77
New cards

Classes

serve as essential blueprints for creating objects, which are instances of those classes

78
New cards

Fields

represent the STATE or CHARACTERISTICS of an object.

79
New cards

Methods

define the BEHAVIOR of the objects.

80
New cards

FALSE - Fields

TRUE OR FALSE: Methods They are defined within the class and store the object's data.

81
New cards

FALSE - Methods

TRUE OR FALSE: Fields allow you to perform actions or calculations related to the object's state

82
New cards

Methods

a block of code that performs a specific task and is designed to be reusable

83
New cards

Methods

typically associated with objects and are called on instances of classes.

84
New cards

Parameters

are accepted by methods, serves asits inputs.

85
New cards

Method Overloading

allows you to define multiple methods with the SAME NAME in the SAME CLASS, but with DIFFERENT PARAMETER lists.

86
New cards

Method Overloading

The methods must have either DIFFERENT TYPES or a DIFFERENT NUMBER of parameters.

87
New cards

Method Overriding

It occurs when a subclass provides a specific implementation for a method already defined by its superclass.

88
New cards

Method Overriding

both the method and method signature must be the same.

89
New cards

ACCESS MODIFIERS

determine the visibility and accessibility of methods.

90
New cards

public

The method is accessible from any class.

91
New cards

protected

The method is accessible within its class, subclasses, and other classes in the same assembly.

92
New cards

internal

The method is accessible within its class and other classes in the same assembly (assembly-private).

93
New cards

private

The method is only accessible within its class.

94
New cards

constructor

a special method used for initial values or perform setup tasks for the object.

95
New cards

constructor

They have the same name as the class they belong to and automatically called when an object of the class is created.

96
New cards

automatically ---- new

The constructor is called (____) when you create an object using the (___) keyword.

97
New cards

class

The constructor's name must be the same as the (___) name.

98
New cards

default constructor

C# automatically provides a (____________) if a constructor is not explicitly defined.

99
New cards

PARAMETERIZED CONSTRUCTOR

These are constructors accepting parameters.

100
New cards

CONSTRUCTOR OVERLOADING

This allows you to define multiple constructors within the same class, each taking a different set of parameters.