Answered You can buy a ready-made answer or pick a professional tutor to order an original one.
Quiz in 20 minutes: 1) hich of the following will be output by the following code? word = 'more' index = 0 while index < len(word): print(word[index]) index = index + 1 a- o r e b- m o r c
Quiz in 20 minutes:
1) hich of the following will be output by the following code?
word = 'more'index = 0while index < len(word): print(word[index]) index = index + 1
a- ore
b- mor
c- more
d- It would generate an IndexError
2) hat would be output by the following statements?
color1 = 'RED'color2 = 'orange'print(color1.lower().startswith('R'), color2.upper().startswith('O'))
a- False False
b- True False
c- False True
d- True True
3) Which of the following is the correct program to count the number of occurrences of the letter l in the string 'yellow'?
a- color = 'yellow'count = 0for 'l' in color: count = count + 1print(count)
b- color = 'yellow'count = 0for letter in color: if letter == 'l': count = count + 1print(count)
c- color = 'yellow'count = 0for letter l in color: if l == 'l': count = count + 1print(count)
d- color = 'yellow'count = 0for letter in color: if color[i] == 'l': count = count + 1print(count)
4) What would be output by the following statements?
city = 'new york'print('New' in city, 'York' in city)
a- False True
b- True True
c- True False
d- False False
5) What would be output by the following statements?
word = 'welcome'print(word[:6])
a- e
b- welcome
c- me
d- welcom
6) Which of the following conditions checks whether the variables alpha, beta and gamma, which contain strings, are in alphabetic order?
a- alpha < beta < gamma
b- not(alpha < beta or beta < gamma)
c- alpha in beta and beta in gamma
d- alpha < beta or beta < gamma
7) Which of the following would be output by this code?
word = 'string'print(word[-2])
a- s
b- t
c- It would generate an IndexError
d- n
8) Assuming the variable animal initially contains the string 'rat', which of the following is the correct way to change animal to become 'cat'?
a- animal[0] = 'c'
b- animal = 'c' + animal[0:]
c- animal[1] = 'c'
d- animal = 'c' + animal[1:]
9) Which of the following will be output by this program?
word = 'ladder'count = 0for letter in word: if letter >= 'a': count = count + 1print(count)
a- 5
b- 2
c- 4
d- 6
10) Which of the following is the correct sequence of statements to output the string 'aONE' after changing the first letter to upper case and the remaining letters to lower case?
a- perfect = 'aONE'print(perfect.capitalize().lower())
b- erfect = 'aONE'print(perfect.lower(1).upper(2, 3))
c- perfect = 'aONE'print(perfect.capitalize())
d- perfect = 'aONE'print(perfect.togglecase())
- @
- 1198 orders completed
- ANSWER
-
Tutor has posted answer for $10.00. See answer's preview
****** ********