1/18
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
What is the purpose of an identifier in programming?
To reference a program component such as a stored value, method, interface, or class by assigning a custom-named label.
What are the two types of data values that an identifier can store?
A constant or a variable.
What is a constant in programming?
A data item whose value does not change within a program, such as the mathematical value of Pi or a player's name.
What are named constants?
Constants that are assigned a meaningful name to refer to a fixed value in a program.
What are the benefits of using constants in programming?
They improve code readability and allow for easier updates if the value changes.
What is a variable in programming?
An identifier whose value can change during the program's execution, such as user input or game scores.
What types of data can variables store?
Strings of text, numerical values, or any other type of data.
What is the disadvantage of not using variables in programming?
You would need to hard code all names and values, which is not considered best practice.
What are containers in programming?
Special identifiers that can reference multiple elements, making it more efficient than creating individual variables.
What are the two types of containers used to specify multiple elements?
Arrays and vectors.
What is an array?
A container that stores a fixed number of elements of the same type in sequential order, starting from index zero.
How do you declare an array?
Specify the data type, then the name of the array, followed by the maximum size in square braces.
What is a vector in programming?
A dynamic container that can automatically resize itself as elements are added or removed.
What is the main difference between arrays and vectors?
Arrays have a fixed size, while vectors have a dynamic size.
Why do vectors take up more memory than arrays?
Because they are dynamic and not stored in sequential memory locations, which can slow down access times.
What is the syntax for declaring a vector?
Specify the container type first, then the data type in angle brackets, followed by the name of the vector.
What is the index starting point for arrays?
Zero.
What happens to the size of a vector when elements are added or removed?
The size of the vector automatically adjusts.
What is a key takeaway from the video on programming concepts?
Identifiers can be constants or variables, arrays have fixed sizes, and vectors have dynamic sizes.