3.2 Programming Flashcards
What is a variable?
.A named place in memory to store information
.The value of the variable can change while the programme is running
What is a constant?
. A named place in memory to store information
. The information stored does not change while the programme is running
Why declare a constant instead of a variable?
. Tells the programmer the constant should not change
. So the constant does not accidentally change
what are the naming conventions?
camelCase and snake_case
. What is an output statement?
. How is an output statement written in Visual Basic and Pseudo code?
. What appears on the screen
. In Visual Basic, you use console.writeline(“type the statement in here”)
. In Pseudo code, you use the OUTPUT statement
. What is an input statement?
. How is an input statement written in Visual Basic and Pseudo code?
. Input statements can be used to assign variables
. In visual Basic, you use name = console.readline()
In Pseudo code, you use name <— User Input
What is the difference between assignment in Visual Basic and Pseudo code?
Visual Basic uses an equal sign whereas, Pseudo code uses a arrow pointing to the left
What is casting?
Casting is when you change the data type of a variable / constant
What is concatenation?
Concatenation is joining two strings together
Why is casting useful?
So you can convert integers to strings to use string handling or turn strings to integers to do math
What is commenting?
Commenting is adding non-executable information to the programme
Why is commenting useful?
It tells the programmer what the code is doing
What is a data type?
A form of data like a String, Float, Integer, Boolean, Character
How can commenting be used as a debugging tool?
You can comment out certain parts of code to see what needs to be added or removed
Why is it important to name variables and constants?
So you know what the function of that variable is
What is decleration?
. Decleration is allocating a certain amount of memory to a variable or constant
. It also shows what data type should be stored into the variable / constant
What is selection?
Preforming a logical test first to see what code to execute first
What is iteration?
Repeating code
What is definite iteration?
code that is repeated a certain amount of time
What is indefinite iteration?
Where the code is repeated until a condition(s) is met
What is nested iteration
A loop inside a loop
What is the difference between While and Repeat Until?
. While checks the condition at the start
. Repeat Until checks the condition at the end
What does this vb command do DIM?
Declares a variable
What does this vb command do CONST?
Declares a constant
What does console.readline() do?
Used to get the user input
What does console.writeline do?
Output
What is the difference between console.write and console.writeline?
. Console.writeline presses enter afterwards whereas console.write doesn’t
. Console.write is used for when you want to get a user input and, it looks better
What is string handling?
To check and manipulate strings
What are the 2 methods of putting variable/constants in your console.writline
. Interpolation
. Console.writeline($”this is the sum of both numbers {num1 + num2} “)
. Braces
. Console.writeline(“this is the sum of the two numbers {0}”, num1 + num2)