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