Error Identification and Basic C# Operators

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/26

flashcard set

Earn XP

Description and Tags

Flashcards covering error identification, variable declarations, case sensitivity, and common operators (arithmetic, assignment, relational, and logical) from the provided notes.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

27 Terms

1
New cards

What is the purpose of Console.WriteLine in C#?

To print text to the console.

2
New cards

What data type is declared for a variable storing a person's name, such as 'Nia'?

string

3
New cards

In the context of the variable string name = "Nia";, what is the string literal value?

Nia

4
New cards

Why is int age = "Twenty"; an error?

An int variable cannot be assigned a string; this is a type mismatch.

5
New cards

Why might Console.WriteLine(Name) cause an error when a variable named 'name' is defined?

C# is case-sensitive; 'Name' is different from 'name'.

6
New cards

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.

7
New cards

Is it valid in C# to use a variable before declaring it in the same scope?

No.

8
New cards

Which operator represents addition?

  • (Addition)
9
New cards

Which operator represents subtraction?

  • (Subtraction)
10
New cards

Which operator represents multiplication?

  • (Multiplication)
11
New cards

Which operator represents division?

/ (Division)

12
New cards

Which operator represents modulus?

% (Modulus)

13
New cards

What does the assignment operator '=' do?

Assigns a value to a variable.

14
New cards

What does '+=' do?

Adds and assigns (x += 3 means x = x + 3).

15
New cards

What does '-=' do?

Subtracts and assigns.

16
New cards

What does '*=' do?

Multiplies and assigns.

17
New cards

What does '/=' do?

Divides and assigns.

18
New cards

What does '%=' do?

Modulus and assigns.

19
New cards

What does '==' mean?

Equal to.

20
New cards

What does '!=' mean?

Not equal to.

21
New cards

What does '>' mean?

Greater than.

22
New cards

What does '<' mean?

Less than.

23
New cards

What does '>=' mean?

Greater than or equal to.

24
New cards

What does '<=' mean?

Less than or equal to.

25
New cards

What does '&&' stand for?

Logical AND.

26
New cards

What does '||' stand for?

Logical OR.

27
New cards

What does '

Logical NOT.