Python Question Bank-10-TERM1PAPER
Python Question Bank-10-TERM1PAPER
Grade - X
I. Choose the correct answer:
1. Which of the following is a valid for loop in Python?
(a) for(i=0; i < n; i++) (b) for i in range(0,5):
(c) for i in range(0,5) (d) for i in range(5)
2. In the following example, how many times will the loop run?
i=2
while(i>0):
print(i)
i=i-1
(a) 2 (b) 3
(c) 1 (d) 0
5. Which method should I use to convert String "welcome to the world of python" to
"Welcome To The World Of Python".
(a) capitalize() (b) title()
(c) find() (d) None of the above
6. Which of the following sequences would be generated in the given line of code?
for i in range(5,0,-2):
print(i)
(a) 5 4 3 2 1 0 -1 (b) 5 4 3 2 1 0
(c) 5 3 1 (d) None of the above
13. Choose the correct function to get the ordinal number of a character in Python.
(a) ascii('a') (b) char('a')
(c) ord('a') (d) None of these
20. The character that must be at the end of the line for if, while, for blocks.
(a) : (b) ;
(c) , (d) None of these
21. Loop executed for a fixed number of times with a built-in counter.
(a) while loop (b) for loop
(c) Repeat loop (d) if else
22. Which term describes a loop that continues repeating without a terminating (ending)
condition?
(a) Conditional loop (b) Unconditional loop
(c) Sequence loop (d) Infinite loop
23. What keyword would you use to add an alternative condition to an if statement?
(a) else if (b) elseif
(c) elif (d) None of the above
41. Accessing the individual characters of a string through unique index of each character is
known as _________________.
(a) String Traversing (b) String Transferring
(c) String concatenation (d) None of these
44. _______________ keyword is used in Python to place a space after the displayed string
instead of a newline.
(a) '\t' (b) '\n'
(c) end (d) None of these
45. Predict the output for the following code:
s='My'
s1='Blog'
s2=s[:1]+s1[len(s1)-1:]
print(s2)
(a) mg (b) Mg
(c) MB (d) Yg
48. Which of the following loop is not supported by the Python programming language?
(a) for loop (b) while loop
(c) do while loop (d) None of the above
49. Which of the following loop is work on the particular range in Python?
(a) for loop (b) while loop
(c) do while loop (d) recursion
*****