03 . Perform Operations using Data Types and Operations 1 - EXAM Flashcards

1
Q

Which is true of variables?

Choose three answers.

a. Variables must include punctuation marks to signify new words
b. Variables must include at least one number
c. Variables are case-sensitive
d. Variables cannot begin with a number
e. Variables cannot have spaces in their names

A

c. Variables are case-sensitive
d. Variables cannot begin with a number
e. Variables cannot have spaces in their names

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which type of variable (data type) uses decimals?

Select one:

a. Integer
b. Float
c. Boolean
d. String

A

b. Float

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which comparison operator asks whether one value is equal to another?

Select one:

a. <=
b. >=
c. ==
d. =
e. /=

A

c. ==

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which symbol represents multiplication in arithmetic operators?

Select one:

a. /
b. +
c. *
d. .
e. x

A

c. *

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which first name variable is an example of camel casing?

Select one:

a. first Name
b. first.name
c. first_name
d. firstName
e. firstname

A

d. firstName

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which is the symbol that can concatenate appropriate variables in Python programming?

Select one:

a. *
b. @
c. &
d. ,
e. +

A

e. +

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which punctuation symbol should be used to combine strings and numbers in a print statement?

Select one:

a. ,
b. @
c. ()
d. &
e. +

A

a. ,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Given the following code:

north = 200
south = 300
northwins = north \> south
southwins = south \> north
print("Northwins = ", northwins, "Southwins = ", southwins)

Which type of data is displayed along with the string literals in the print statement?

Select one:

a. Float
b. String
c. Integer
d. Booleen
e. Tuple

A

d. Booleen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Given the following code:

price = 3.95
widgets = 5
print(“The price of the widget is “, price) print(“We have “ + widgets + “ in stock.”)

Which built-in function should be wrapped around the variable ‘widgets’, to cast it into a string variable?

Select one:

a. string
b. str
c. cast/str
d. stringtype

A

b. str

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Given the code below, which number will the price variable show on the last line?

price = 3.95
widgets = 5
print(“The price of the widget is “, price)
print(“We have “ + str(widgets) + “ in stock”)
print(price * widgets) print(int(price), float(widgets))

Select one:

a. 4
b. 5
c. 3.95
d. 3

A

d. 3

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Is the following statement true or false?

The term list is a data type (variable) which stores multiple values.

Select one:

a. true
b. false

A

a. true

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Given the following code, which number is item East in the displayed list?

regions = [“North”, “South”, “East”, West”]
sales = [30000, 20000, 40000, 35000]
employees = [“Alice”, “Vera”, “Flo”, “Mel”]
print(“Region: “, regions[0], “Sales: “, sales[0])

Select one:

a. 2
b. 1
c. 4
d. 3

A

a. 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Given that items on the same level/line are evaluated from left to right, what is the correct order of operations?

Select one:

a. Addition, Subtraction,
Exponents,
Parentheses,
Multiplication, Division

b. Parentheses,
Exponents,
Addition, Subtraction,
Multiplication, Division

c. Exponents,
Parentheses,
Addition, Subtraction,
Multiplication, Division

d. Parentheses,
Exponents,
Multiplication,
Division,
Addition,
Subtraction

e. Parentheses,
Exponents,
Multiplication, Division,
Addition, Subtraction

A

e. Parentheses,
Exponents,
Multiplication, Division,
Addition, Subtraction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly