Matching questions
1-303 of 303
Click a definition to match it with a term
Which ONE of the following statements about Python dictionaries is false?
Dictionaries are unordered collections.
A dictionary's key can be an integer.
The values of a dictionary can be accessed using keys.
Correct Answer
The keys of a dictionary can be accessed using values.
Dictionaries are mutable.
Give this one a try later!
, The keys of a dictionary can be accessed using values.
What is the output of a logical and operation in Python if one of the operands is
False?
It could be either True or False.
Not enough information is provided to answer the question.
It must be True.
It must be False.
Give this one a try later!
It must be False.
What is the final value of x after the given valid Python code has finished executing?
x = 1 + 2 * 3.0
Question 6 options:
9
7.0
9.0
7
8
Give this one a try later!
7.0
A fictional country has 3 denominations of money: gold, silver and copper coins.
1 gold coin = 20 silver coins
1 silver coin = 4 copper coins
,Given a total number of copper coins (given in the variable copper), we want the
computer to tell us how many gold coins (gold), silver coins (silver) and copper coins
(copper) are needed to make change while minimizing the number of coins.
Incomplete code is given below. Choose the option below that correctly completes
the code segments marked A and B.
copper = 1000 # or any other positive integer
gold = copper // A
copper = copper % A
silver = copper // B
copper = copper % B
Question 10 options:
Replace A with 80, replace B with 20.
Replace A with 80, replace B with 4.
Replace A with 4, replace B with 20.
None of these is correct.
Replace A with 20, replace B with 4.
Give this one a try later!
Replace A with 80, replace B with 4.
If an if-statement contains another if-statement, we would say that ___________.
Question 24 options:
we have a mutli-way if-statement
we will probably encounter a run-time error
there is a semantic error in the code
we have nested if-statements
Give this one a try later!
we have nested if-statements
, Which of the following refers to the rules of a programming language that
programmers must follow when writing code?
Question 9 options:
semantics
ligatures
algorithms
syntax
Give this one a try later!
syntax
Suppose product is the name of a variable containing a string. Select all of the
options below that would access the rightmost character of the variable.
Question 54 options:
product[len(product)-1:]
product[len(product)-1]
product[len(product)]
product[-1]
Give this one a try later!
product[len(product)-1:]
product[len(product)-1]
product[-1]
We want to write the function buy(num_pizzas, pizza_cost, budget) which returns how
much money we have leftover after buying some pizzas. The maximum number of
pizzas we might buy is num_pizzas, the cost of a single pizza is pizza_cost, and the
starting amount of money is budget. We can buy only whole pizzas, not fractions or
portions of a pizza. We will buy as many pizzas as we can, up to the limit num_pizzas.
1-303 of 303
Click a definition to match it with a term
Which ONE of the following statements about Python dictionaries is false?
Dictionaries are unordered collections.
A dictionary's key can be an integer.
The values of a dictionary can be accessed using keys.
Correct Answer
The keys of a dictionary can be accessed using values.
Dictionaries are mutable.
Give this one a try later!
, The keys of a dictionary can be accessed using values.
What is the output of a logical and operation in Python if one of the operands is
False?
It could be either True or False.
Not enough information is provided to answer the question.
It must be True.
It must be False.
Give this one a try later!
It must be False.
What is the final value of x after the given valid Python code has finished executing?
x = 1 + 2 * 3.0
Question 6 options:
9
7.0
9.0
7
8
Give this one a try later!
7.0
A fictional country has 3 denominations of money: gold, silver and copper coins.
1 gold coin = 20 silver coins
1 silver coin = 4 copper coins
,Given a total number of copper coins (given in the variable copper), we want the
computer to tell us how many gold coins (gold), silver coins (silver) and copper coins
(copper) are needed to make change while minimizing the number of coins.
Incomplete code is given below. Choose the option below that correctly completes
the code segments marked A and B.
copper = 1000 # or any other positive integer
gold = copper // A
copper = copper % A
silver = copper // B
copper = copper % B
Question 10 options:
Replace A with 80, replace B with 20.
Replace A with 80, replace B with 4.
Replace A with 4, replace B with 20.
None of these is correct.
Replace A with 20, replace B with 4.
Give this one a try later!
Replace A with 80, replace B with 4.
If an if-statement contains another if-statement, we would say that ___________.
Question 24 options:
we have a mutli-way if-statement
we will probably encounter a run-time error
there is a semantic error in the code
we have nested if-statements
Give this one a try later!
we have nested if-statements
, Which of the following refers to the rules of a programming language that
programmers must follow when writing code?
Question 9 options:
semantics
ligatures
algorithms
syntax
Give this one a try later!
syntax
Suppose product is the name of a variable containing a string. Select all of the
options below that would access the rightmost character of the variable.
Question 54 options:
product[len(product)-1:]
product[len(product)-1]
product[len(product)]
product[-1]
Give this one a try later!
product[len(product)-1:]
product[len(product)-1]
product[-1]
We want to write the function buy(num_pizzas, pizza_cost, budget) which returns how
much money we have leftover after buying some pizzas. The maximum number of
pizzas we might buy is num_pizzas, the cost of a single pizza is pizza_cost, and the
starting amount of money is budget. We can buy only whole pizzas, not fractions or
portions of a pizza. We will buy as many pizzas as we can, up to the limit num_pizzas.