Intro to Programming - CS3 Flashcards
What are the arithmetic operators?
+, -, *, /
What are the relational operators and what is their result?
, <=, >=, =, <>
Results in True or False
What are the logical operators and what is their result?
AND, OR, NOT
Results in True or False
What is operator precedence?
First arithmetic, then relational, then logical
A=True, B=False
What is A OR B?
What is A AND B?
True
False
Expression
Any legal combo that represents a value (could be one or more constants, variables, operators, and/or functions)
Arithmetic expression
An expression with numbers, variables, and/or arithmetic operators
Relational expression
Two arithmetic expressions with a relational operator
Result is TRUE or FALSE
Logical expression
Has logical operator (and, or, not)
AND/OR need TWO operands
NOT needs only one
Structured Programming
Breaking a program into logical sections, using only three types of control structures
Control Structures in Structured Programming
Sequence
Selection
Iteration
Sequence control structure
One statement simply follows another in sequence; steps are executed in order.
Selection control structure
Program selects a path based on conditional statement
IF-THEN or
IF-THEN-ELSE
Iteration control structure
Looping or repeating control structure - statements execute repeatedly While Loop (WHILE condition is true, execute) For Loop (counter-controlled loop, execute specific number of times)
What is a keyword?
A word that has a special meaning to the compiler
What are each of these words?
Dim score as string
score = Textbox1.Text
Dim _ as > keywords to declare variable score > name of variable string > data type = > assignment you are assigning the TEXT property of the Textbox1 CONTROL to the variable score
And
Both operands must be true for the expression to be true, otherwise it is false
Or
One or both operands must be true for the expression to be true, otherwise it is false
Not
Reverses the logical value of the expression
Variable naming rules
- Can only have letters, digits, and underscores
- Cannot start with a number
- Cannot use a keyword
Literal data
Any data in a program that explicitly identifies itself
Symbolic constant
Defining a constant
Const float Pi = 3.14