programming variables Flashcards
(32 cards)
What is a variable in programming?
A named location in a computer’s memory that can store a value which may change.
What is a variable in programming?
A named location in a computer’s memory that can store a value which may change.
What is required when declaring a variable in C#?
A name for the variable and a specification of the data type.
What is required when declaring a variable in C#?
A name for the variable and a specification of the data type.
What is the syntax used to declare a string variable in C#?
string name = “Alice”;
What is the syntax used to declare a string variable in C#?
string name = “Alice”;
What character is required to end a line in C#?
;
What character is required to end a line in C#?
;
True or False: Variable names in C# are case sensitive.
True
True or False: Variable names in C# are case sensitive.
True
What are the rules for naming a variable in C#?
- Use consistent capitalization
- Don’t include spaces
- Don’t start with a digit
What are the rules for naming a variable in C#?
- Use consistent capitalization
- Don’t include spaces
- Don’t start with a digit
Fill in the blank: A variable must be ______ before it can be used.
declared
Fill in the blank: A variable must be ______ before it can be used.
declared
What are five common data types in C#?
- String
- Character
- Integer
- Double
- Boolean
What are five common data types in C#?
- String
- Character
- Integer
- Double
- Boolean
What data type is used for whole numbers in C#?
int
What data type is used for whole numbers in C#?
int
What is the process of assigning a value to a variable called?
initialising
What is the process of assigning a value to a variable called?
initialising
What method is used to output text to the console in C#?
Console.WriteLine()
What method is used to output text to the console in C#?
Console.WriteLine()
What method is used to input text from the console in C#?
Console.ReadLine()
What method is used to input text from the console in C#?
Console.ReadLine()