Topic 8. Programming Flashcards
What are the data types?
Integer
Real
Char
String
Boolean
What type of data is an integer?
A whole number (5.-267.153489)
What type of data is a real?
A number with a decimal point (3.142,56.0,-0.75)
What type of data is a char?
A single character enclosed in single quotes (‘A’,’#’,’6’,’&’)
What type of data is a string?
Zero or more characters enclosed in double quotes (“Yes”,”Hi, John”)
What is a constant?
A named piece of memory where the value cannot be changed while a program runs.
What is a variable?
A location in memory that holds one or more values.
How do you declare a constant in pseudocode?
CONSTANT VAT <— 0.2
How do you declare a variable in pseudocode?
A variable is assigned a value in pseudocode using the <—
Write pseudocode which asks the user to enter two numbers representing the length and width of a rectangle, then calculates and prints the area
INPUT length
INPUT width
OUTPUT “Area = “, Length * Width
What are the arithmetic operators and what do they mean?
+ addition
- subtraction
/ division
* multiplication
^ raised to the power of
MOD modulus (The remainder that is left over when a number is divided by another)
DIV Quotient (Integer division divides two integers and discards any remainder)
What are the logical operators and what do they mean?
= Equal to
< Less than
<= Less than or equal
> Greater than
=> Greater than or equal
<> Not equal to
What is a boolean expression?
The expressions that evaluate a condition and result in a Boolean value i.e true or false.
What is a sequence?
Two or more statements written and executed one after the other in sequence
What is a selection statement?
A selection statement comprises an IF or CASE statement and a logical expression