Question 1 of 25
Hints left: 3
Q1
What is the output of the code: string = "Python" print(string[-2])
Q2
What will be the output of the following Python code? i = 5 while True: if i%0O11 == 0: break print(i) i += 1
Q3
What is the output of the following code: word = "Python" print(word[2])
Q4
What does the len() function do when applied to a string?
Q5
Which character is used to access individual elements of a string by index in Python?
Q6
What will be the output of the following Python code? i = 1 while True: if i%0O7 == 0: break print(i) i += 1
Q7
What will be the output of the following Python code? i = 0 while i < 5: print(i) i += 1 if i == 3: break else: print(0)
Q8
Which of the following is the correct way to create a string in Python?
Q9
What will be the output of the following Python code? x = "abcdef" i = "a" while i in x: print('i', end = " ")
Q10
What will be the output of the following Python code? x = "abcdef" i = "a" while i in x: print(i, end = " ")
Q11
What is the output of the following code: string = "Python" print(string.capitalize())
Q12
In Python, which escape sequence is used to represent a newline character?
Q13
Which of the following methods is used to find the index of the first occurrence of a substring in a string?
Q14
What will be the output of the following Python code? x = "abcdef" i = "a" while i in x[:-1]: print(i, end = " ")
Q15
What will be the output of the following Python code? i = 5 while True: if i%0O9 == 0: break print(i) i += 1
Q16
What will be the output of the following Python code? i = 2 while True: if i%3 == 0: break print(i) i += 2
Q17
What will be the output of the following Python code? x = ['ab', 'cd'] for i in x: x.append(i.upper()) print(x)
Q18
What will be the output of the following Python code? x = ['ab', 'cd'] for i in x: i.upper() print(x)
Q19
What will be the output of the following Python code? i = 1 while True: if i%3 == 0: break print(i) i + = 1
Q20
What will be the output of the following Python code? i = 1 while False: if i%2 == 0: break print(i) i += 2
Q21
What is the purpose of the str() function in Python?
Q22
What will be the output of the following Python code? True = False while True: print(True) break
Q23
What will be the output of the following Python code? i = 1 while True: if i%2 == 0: break print(i) i += 2
Q24
What will be the output of the following code: string = "Python" print(string[1:4])
Q25
What will be the output of the following Python code? i = 0 while i < 3: print(i) i += 1 else: print(0)