Codecademy C# Flashcards Preview

NLP Coding > Codecademy C# > Flashcards

Flashcards in Codecademy C# Deck (74)
Loading flashcards...
1
Q

Command to print text to a console

A

Console.WriteLine(“”)

2
Q

Command to read text a user types into the console

A

Console.ReadLine()

3
Q

Command to run interactive code

A

dotnet run

4
Q

One line comments

A

after //

5
Q

Multi-line comments

A

between /* and */

6
Q

Whole integer number data type

A

int

7
Q

A piece of text data type

A

string

8
Q

Data type which represents the logical idea of true or false

A

bool

9
Q

Decimal number data types

A

double

10
Q

Single characters data type

A

char

11
Q

Assign variable command

A

data type __________ = “__________”;

12
Q

Assign variable example

A

string countryName = “Netherlands”

13
Q

Good practice style for naming variables

A

camelCase

14
Q

camelCase example

A

string iAmAVariable

15
Q

Implicit conversion definition

A

Happens automatically if no data will be lost in the conversion

16
Q

Explicit conversion definition

A

Requires a cast operator to convert a data type into another one

17
Q

Explicit method for converting to string

A

Convert.ToString()

18
Q

Explicit method for converting to double

A

Convert.ToDouble()

19
Q

Character after decimal to show that it’s a decimal

A

m

20
Q

Character after decimal to show that it’s a decimal example

A

decimal variableName = 489872.76m

21
Q

Command to increment by one

A

++

22
Q

Command to decrease by one

A
  • -
23
Q

Modulo definition

A

Returns a remainder

24
Q

Modulo operator

A

%

25
Q

Command too find the absolute value of a number

A

Math.Abs()

26
Q

Command to find the square root of a number

A

Math.Sqrt()

27
Q

Command to round a given double or decimal down to the nearest whole number

A

Math.Floor()

28
Q

Command to return the smaller of two numbers

A

Math.Min()

29
Q

Not a number abbreviation

A

NaN

30
Q

Command to raise an exponent

A

Math.Pow( , )

31
Q

Command to round a double or decimal up

A

Math.Ceiling()

32
Q

Command to find the larger of two numbers

A

Math.Max()

33
Q

Character to escape a character

A

\

34
Q

Command to print the following text on a new line

A

\n

35
Q

String concatenation symbol

A

+

36
Q

String interpolation definition

A

A method for inserting variable values in the middle of a string

37
Q

String interpolation command

A

$“{}”

38
Q

String interpolation example

A

$”Your favorite musician is {yourFaveMusician}.”

39
Q

Command to find how many characters exist in a string

A

.Length

40
Q

Command to find the position of a specific character or substring in a string

A

.IndexOf()

41
Q

Command to grab part of a string and return a new string

A

.Substring()

42
Q

Command to change the case of strings to uppercase

A

.ToUpper()

43
Q

Command to change the case of a string to lowercase

A

.ToLower()

44
Q

Equals operator

A

==

45
Q

Inequality operator

A

!=

46
Q

Less than operator

A
47
Q

Greater than operator

A

>

48
Q

Less than or equal to operator

A

<=

49
Q

Greater than or equal to operator

A

> =

50
Q

AND operator

A

&&

51
Q

OR operator

A

||

52
Q

NOT operator

A

!

53
Q

Clause to write a conditional

A

if

54
Q

Clause to be executed if the if condition is false

A

else

55
Q

Conditional statement to use to check for multiple conditions

A

else if

56
Q

Statement which allows for compact control structures by evaluating a single expression and executing code blocks based on a matched case

A

switch

57
Q

Specifies different potential values

A

case

58
Q

Case to run if none of the conditions are met

A

default

59
Q

Ternary operator

A

?

60
Q

Ternary operator example

A

string color = “blue”

string result = (color == “blue”) ? “blue” : “NOT blue”;

61
Q

PascalCase definition

A

First letter of each word in a compound word is capitalized

62
Q

PascalCase example

A

YourMethodName

63
Q

Operator for defining an optional parameter

A

=

64
Q

Defining an optional parameter example

A

static void YourMethodName(string punctuation = “.”)

65
Q

Named arguments command

A

YourMethodName(argumentName: argumentValue);

66
Q

Named arguments example

A

YourMethodName(d: 4);

67
Q

Int16 storage capacity

A

-32,768 to +32,767

68
Q

Int32 storage capacity

A

-2,147,483,648 to +2,147,483,647

69
Q

Int64 storage capacity

A

-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807

70
Q

Method overload definition

A

Having multiple versions of the same method but with different parameters

71
Q

Method overload example

A

Math.Round(Double, Int32) vs Math.Round(Double)

72
Q

Return type to be used if a method returns nothing

A

void

73
Q

Return type to be used if a method returns nothing example

A

static void DecoratePlanet()

74
Q

Return type to be used if a method returns a string example

A

static string DecoratePlanet()