Python Questions and Answers – While and For Loops – 2 Continued
5. What is the output of the following?
a) no output
b) i i i i i i …
c) a a a a a a …
d) a b c d e f
View Answer
b) i i i i i i …
c) a a a a a a …
d) a b c d e f
View Answer
6. What is the output of the following?
a) no output
b) i i i i i i …
c) a a a a a a …
d) a b c d e f
View Answer
b) i i i i i i …
c) a a a a a a …
d) a b c d e f
View Answer
7. What is the output of the following?
a) i i i i i i
b) a a a a a a
c) a a a a a
d) none of the mentiornedmentiorned
8. What is the output of the following?
b) a a a a a a
c) a a a a a
d) none of the mentiornedmentiorned
8. What is the output of the following?
a) a a a a a
b) a a a a a a
c) a a a a a a …
d) a
View Answer
b) a a a a a a
c) a a a a a a …
d) a
View Answer
Answer: c
Explanation: String x is not being altered and i is in x[:-1].
Explanation: String x is not being altered and i is in x[:-1].
9. What is the output of the following?
a) a a a a a a
b) a
c) no output
d) error
View Answer
b) a
c) no output
d) error
View Answer
Answer: b
Explanation: The string x is being shortened by one charater in each iteration.
Explanation: The string x is being shortened by one charater in each iteration.
10. What is the output of the following?
a) a a a a a a
b) a
c) no output
d) error
View Answer
b) a
c) no output
d) error
View Answer
Answer: c
Explanation: i is not in x[1:].
Explanation: i is not in x[1:].
No comments:
Post a Comment