Codecademy C# Flashcards

1
Q

Command to print text to a console

A

Console.WriteLine(“”)

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

Command to read text a user types into the console

A

Console.ReadLine()

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

Command to run interactive code

A

dotnet run

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

One line comments

A

after //

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

Multi-line comments

A

between /* and */

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

Whole integer number data type

A

int

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

A piece of text data type

A

string

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

Data type which represents the logical idea of true or false

A

bool

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

Decimal number data types

A

double

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

Single characters data type

A

char

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

Assign variable command

A

data type __________ = “__________”;

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

Assign variable example

A

string countryName = “Netherlands”

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

Good practice style for naming variables

A

camelCase

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

camelCase example

A

string iAmAVariable

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

Implicit conversion definition

A

Happens automatically if no data will be lost in the conversion

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

Explicit conversion definition

A

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

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

Explicit method for converting to string

A

Convert.ToString()

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

Explicit method for converting to double

A

Convert.ToDouble()

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

Character after decimal to show that it’s a decimal

A

m

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

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

A

decimal variableName = 489872.76m

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

Command to increment by one

A

++

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

Command to decrease by one

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

Modulo definition

A

Returns a remainder

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

Modulo operator

A

%

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Command too find the absolute value of a number
Math.Abs()
26
Command to find the square root of a number
Math.Sqrt()
27
Command to round a given double or decimal down to the nearest whole number
Math.Floor()
28
Command to return the smaller of two numbers
Math.Min()
29
Not a number abbreviation
NaN
30
Command to raise an exponent
Math.Pow( , )
31
Command to round a double or decimal up
Math.Ceiling()
32
Command to find the larger of two numbers
Math.Max()
33
Character to escape a character
\
34
Command to print the following text on a new line
\n
35
String concatenation symbol
+
36
String interpolation definition
A method for inserting variable values in the middle of a string
37
String interpolation command
$“{}”
38
String interpolation example
$”Your favorite musician is {yourFaveMusician}.”
39
Command to find how many characters exist in a string
.Length
40
Command to find the position of a specific character or substring in a string
.IndexOf()
41
Command to grab part of a string and return a new string
.Substring()
42
Command to change the case of strings to uppercase
.ToUpper()
43
Command to change the case of a string to lowercase
.ToLower()
44
Equals operator
==
45
Inequality operator
!=
46
Less than operator
47
Greater than operator
>
48
Less than or equal to operator
<=
49
Greater than or equal to operator
>=
50
AND operator
&&
51
OR operator
||
52
NOT operator
!
53
Clause to write a conditional
if
54
Clause to be executed if the if condition is false
else
55
Conditional statement to use to check for multiple conditions
else if
56
Statement which allows for compact control structures by evaluating a single expression and executing code blocks based on a matched case
switch
57
Specifies different potential values
case
58
Case to run if none of the conditions are met
default
59
Ternary operator
?
60
Ternary operator example
string color = “blue” | string result = (color == “blue”) ? “blue” : “NOT blue”;
61
PascalCase definition
First letter of each word in a compound word is capitalized
62
PascalCase example
YourMethodName
63
Operator for defining an optional parameter
=
64
Defining an optional parameter example
static void YourMethodName(string punctuation = “.”)
65
Named arguments command
YourMethodName(argumentName: argumentValue);
66
Named arguments example
YourMethodName(d: 4);
67
Int16 storage capacity
-32,768 to +32,767
68
Int32 storage capacity
-2,147,483,648 to +2,147,483,647
69
Int64 storage capacity
-9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
70
Method overload definition
Having multiple versions of the same method but with different parameters
71
Method overload example
Math.Round(Double, Int32) vs Math.Round(Double)
72
Return type to be used if a method returns nothing
void
73
Return type to be used if a method returns nothing example
static void DecoratePlanet()
74
Return type to be used if a method returns a string example
static string DecoratePlanet()