Question: 1- : A data type in which the values are made up of components, or elements, that are themselves values is known as an object
1- : A data type in which the values are made up of components, or elements, that are themselves values is known as an object data type.
Select one:
True
False
2- Given any real numbers a and b, exactly one of the following relations holds: a < b, a > b, or a = b. Thus when you can establish that two of the relations are false, you can assume the remaining one is true.
This principle is known as:
Select one:
a. trichotomy
b. abstraction
c. the distributive property
d. the transitive property
3- Given the following code what will the output be?
def find(strng, ch):
index = 0
while index < len(strng):
if strng[index] == ch:
return index
index += 1
return -1
print (find("the doctor is in", '*'))
Select one:
a. -1
b. 0
c. 12
d. 13
4- Given the following code, what will the output be?
import string
index = "Ability is a poor man's wealth".find("w")
print(index)
Select one:
a. 24
b. 0
c. 23
d. -1
5- : A parameter written in a function header with an assignment to a default value which it will receive if no corresponding argument is given for it in the function call is called an optional parameter.
Select one:
True
False
6- What output will the following code produce?
print ("%s %d %f" % (5, 5, 5))
Select one:
a. 5 5 5.000000
b. 5 5 5
c. 5 5.000000
d. 0 5 5.0
7- : To create a new object that has the same value as an existing object is know as creating an alias.
Select one:
True
False
8- What output will the following code produce?
mylist = [ [2,4,1], [1,2,3], [2,3,5] ]
a=0
b=0
total = 0
while a <= 2:
while b < 2:
total += mylist[a][b]
b += 1
a += 1
b = 0
print (total)
Select one:
a. 14
b. 23
c. 0
d. 13
9- : The following code:
for fruit in ["banana", "apple", "quince"]:
print (fruit)
will produce the following output:
banana apple quince
Select one:
True
False
10- Given the following code, what will the output be?
mylist = ["now", "four", "is", "score", "the", "and seven", "time", "years", "for"]
a=0
while a < 7:
print (mylist[a],)
a += 2
Select one:
a. now is the time
b. now is the time for
c. for score and seven years
d. now four is score the and seven time years for
11- The output of the following code will be:
fruit = "banana"
letter = fruit[1]
print (letter)
Select one:
a. b
b. a
c. n
d. banana
12- A variable that has a data type of "str" cannot be a compound data type.
Select one:
True
False
13- Traversal can only be accomplished with the "while" loop.
Select one:
True
False
14- Strings are easily changed with string slices.
Select one:
True
False
15- The elements of a list are immutable.
Select one:
True
False
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
