programming variables Flashcards

(32 cards)

1
Q

What is a variable in programming?

A

A named location in a computer’s memory that can store a value which may change.

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

What is a variable in programming?

A

A named location in a computer’s memory that can store a value which may change.

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

What is required when declaring a variable in C#?

A

A name for the variable and a specification of the data type.

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

What is required when declaring a variable in C#?

A

A name for the variable and a specification of the data type.

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

What is the syntax used to declare a string variable in C#?

A

string name = “Alice”;

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

What is the syntax used to declare a string variable in C#?

A

string name = “Alice”;

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

What character is required to end a line in C#?

A

;

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

What character is required to end a line in C#?

A

;

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

True or False: Variable names in C# are case sensitive.

A

True

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

True or False: Variable names in C# are case sensitive.

A

True

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

What are the rules for naming a variable in C#?

A
  • Use consistent capitalization
  • Don’t include spaces
  • Don’t start with a digit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the rules for naming a variable in C#?

A
  • Use consistent capitalization
  • Don’t include spaces
  • Don’t start with a digit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Fill in the blank: A variable must be ______ before it can be used.

A

declared

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

Fill in the blank: A variable must be ______ before it can be used.

A

declared

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

What are five common data types in C#?

A
  • String
  • Character
  • Integer
  • Double
  • Boolean
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are five common data types in C#?

A
  • String
  • Character
  • Integer
  • Double
  • Boolean
9
Q

What data type is used for whole numbers in C#?

9
Q

What data type is used for whole numbers in C#?

10
Q

What is the process of assigning a value to a variable called?

10
Q

What is the process of assigning a value to a variable called?

11
Q

What method is used to output text to the console in C#?

A

Console.WriteLine()

11
Q

What method is used to output text to the console in C#?

A

Console.WriteLine()

12
Q

What method is used to input text from the console in C#?

A

Console.ReadLine()

12
Q

What method is used to input text from the console in C#?

A

Console.ReadLine()

13
What is the purpose of the Convert.ToInt32() method?
To convert a string to an integer.
13
What is the purpose of the Convert.ToInt32() method?
To convert a string to an integer.
14
What is a potential algorithm for asking a user for their details?
* Declare variables for name, age, and height * Ask user for their name and store it * Ask user for their age and store it * Ask user for their height and store it * Output a sentence with the stored information
14
What is a potential algorithm for asking a user for their details?
* Declare variables for name, age, and height * Ask user for their name and store it * Ask user for their age and store it * Ask user for their height and store it * Output a sentence with the stored information
15
True or False: In C#, a variable name can start with a digit.
False
15
True or False: In C#, a variable name can start with a digit.
False
16
What is the data type used for true/false values in C#?
boolean
16
What is the data type used for true/false values in C#?
bool