MGMT 288 EXAM 1 QUESTIONS AND ANSWERS 100% CORRECT
An expression contains what? - ANSWER Values and operators
What are the three data types? - ANSWER Integer
Floating-point number
String
What do all expressions do? - ANSWER Evaluate down to a single value
Difference between an expression and an assignment statement? - ANSWER
Expression: evaluates down to a single value
Assignment statement: assigns a value to a variable
What does the variable bacon contain after the following code runs?
Bacon = 20
bacon + 1 - ANSWER Still 20; to reassign bacon, you would have to do bacon = bacon +1
What would the following two expressions evaluate down to?
'spam' + 'spamspam'
'spam' * 3 - ANSWER 'spamspamspam'
Three valid variable naming rules? - ANSWER 1. No spaces
2. Only letters, numbers, and underscores
3. Cannot begin with a number
, Functions to get integer, floating-point number, or string value? - ANSWER int(), float(),
and str()
Strings and integers can concatenate when? - ANSWER Never
Two values of Boolean data types? - ANSWER True and False
Three Boolean operators? Which are binary and which are unary? - ANSWER and, or,
not
and, or = binary
not = unary
What Boolean value do the following evaluate to?
False and True
False or True - ANSWER False
True
What are the six comparison operators? - ANSWER == equal to
!= not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to
Difference between equal to operator and assignment operator? - ANSWER equal to
An expression contains what? - ANSWER Values and operators
What are the three data types? - ANSWER Integer
Floating-point number
String
What do all expressions do? - ANSWER Evaluate down to a single value
Difference between an expression and an assignment statement? - ANSWER
Expression: evaluates down to a single value
Assignment statement: assigns a value to a variable
What does the variable bacon contain after the following code runs?
Bacon = 20
bacon + 1 - ANSWER Still 20; to reassign bacon, you would have to do bacon = bacon +1
What would the following two expressions evaluate down to?
'spam' + 'spamspam'
'spam' * 3 - ANSWER 'spamspamspam'
Three valid variable naming rules? - ANSWER 1. No spaces
2. Only letters, numbers, and underscores
3. Cannot begin with a number
, Functions to get integer, floating-point number, or string value? - ANSWER int(), float(),
and str()
Strings and integers can concatenate when? - ANSWER Never
Two values of Boolean data types? - ANSWER True and False
Three Boolean operators? Which are binary and which are unary? - ANSWER and, or,
not
and, or = binary
not = unary
What Boolean value do the following evaluate to?
False and True
False or True - ANSWER False
True
What are the six comparison operators? - ANSWER == equal to
!= not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to
Difference between equal to operator and assignment operator? - ANSWER equal to