1/26
Flashcards covering error identification, variable declarations, case sensitivity, and common operators (arithmetic, assignment, relational, and logical) from the provided notes.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the purpose of Console.WriteLine in C#?
To print text to the console.
What data type is declared for a variable storing a person's name, such as 'Nia'?
string
In the context of the variable string name = "Nia";, what is the string literal value?
Nia
Why is int age = "Twenty"; an error?
An int variable cannot be assigned a string; this is a type mismatch.
Why might Console.WriteLine(Name) cause an error when a variable named 'name' is defined?
C# is case-sensitive; 'Name' is different from 'name'.
What is the error in the sequence where a variable is used before being declared (username = Mike; Console.WriteLine(username); string username =
)?
Using a variable before it is declared; declare it before use.
Is it valid in C# to use a variable before declaring it in the same scope?
No.
Which operator represents addition?
Which operator represents subtraction?
Which operator represents multiplication?
Which operator represents division?
/ (Division)
Which operator represents modulus?
% (Modulus)
What does the assignment operator '=' do?
Assigns a value to a variable.
What does '+=' do?
Adds and assigns (x += 3 means x = x + 3).
What does '-=' do?
Subtracts and assigns.
What does '*=' do?
Multiplies and assigns.
What does '/=' do?
Divides and assigns.
What does '%=' do?
Modulus and assigns.
What does '==' mean?
Equal to.
What does '!=' mean?
Not equal to.
What does '>' mean?
Greater than.
What does '<' mean?
Less than.
What does '>=' mean?
Greater than or equal to.
What does '<=' mean?
Less than or equal to.
What does '&&' stand for?
Logical AND.
What does '||' stand for?
Logical OR.
What does '
Logical NOT.