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