C# For Coding Flashcards

(83 cards)

1
Q

Console.WriteLine()

A

A command that PRINTS text to a console. Whatever is in the parentheses will be written in the game. (“Hello World”);

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

What is a string?

A

A piece of text in C#.

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

Console.ReadLine()

A

CAPTURES user input to the console.

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

Comments

A

Lines of code that are ignored by your computer. They are intended to be read by developers. // and /* */ for longer explanations.

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

~

A

Tilde.

Til-duh

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

ASCII art

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

Data Types

A

Languages like C-sharp tell a computer about the type of data in its program using data types.

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

Statically Typed

A

C-sharp will check that we use the correct types before the program even runs. It helps write scalable code with fewer bugs.

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

Int

A

Whole integer number

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

Bool

A

Or Boolean. Represents the logical idea of true or false.

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

Variable

A

Basically like a box in our computer memory where we can store values used in our code.

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

var

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

Error codes in C#

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

What do variables consist of?

A

Underscores, letters and digits.

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

What is a reserved keyword?

A

Words that the language already uses. If you name a variable “string” you risk creating errors in your code.

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

Data type conversions:

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

Converting Data Types:

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

Explicit type casting, converting.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Which would throw an error?
26
Conversions
27
Double
Uses double the memory (8bytes) and offers about double the precision(around 15 decimal digits) compared to float. (64 bits of memory)
28
Float
Uses 4 bytes and has about 7 decimal digits of precision. (32bits memory)
29
Double and Decimal: How to enter them in code.
30
Arithmetic Operators
Addition, subtraction, multiplication, division.
31
Using different data types:
32
Truncated
Shortened in duration or extent. Decimals are sometimes truncated if they go on forever.
33
Order of Operations:
34
Operator Shortcuts:
35
Decrement shortcut
-=3 instead
36
Multiplication & Division Shortcuts:
*=3 will multiply the variables value by three and reassign the result to the variable. /=3 will do the same as above except divide it.
37
Compound assignment operators:
+= -= *= /=
38
Modulo
39
Modulo example
40
Modulo can check to see if answer is odd, or even.
41
Methods:
42
43
Absolute Value
44
Method Example
45
Public class:
Can be accessed from anywhere by name.
46
Void class
Doesn’t return anything after it’s done.
47
Static
Means it doesn’t move. It stays there forever until the process terminates. There can be only one static instance of something and that that’s why you access it without an instance of class, but rather buy the type name directly.
48
49
General info Public, Void, Static.
50
String Interpolation in C#
51
Operator Shortcuts
52
Built in Math Methods
53
54
Name the bracket: () <> [] {}
Round bracket or parentheses Angled brackets Square brackets Curly brackets or braces.
55
Strings
56
Escape Character Sequences
57
Escape Character Sequence example:
58
Prepend
Add something at the beginning of something else.
59
Strings (Length)
60
Strings (IndexOf)
61
Substring
62
Substring I don’t understand where ‘decade’ comes from.
63
64
Bracket Notation
65
ToUpper ToLower
66
Strings Cheatsheet
67
Continued
68
Continued
69
Continued
70
Continued
71
Equality and Inequality Operators
72
Comparison Operators
73
Logical Operators
74
Truth Table
75
If statements
76
If-Else statements
77
Else If
78
Switch Statements
79
Switch statement continued
80
Ternary Operators
81
Difference between Console.Write() and Console.WriteLine()?
Console.Write() Allows user input to be on the same line where the user request is made. Console.WriteLine() Would put user input on the line below.
82
If using double quotes in a string
Write a \ to separate the two quotes in the sentence. Example: Console.WriteLine("A voice behind the door speaks. It says, \"Answer this riddle: ");
83
How to make quotations print in the console:
Console.WriteLine("\"Poor people have it. Rich people need it. If you eat it, you die. What is it?\"");