Following quiz provides Multiple Choice Questions (MCQs) related to Python. You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz.
Q 1 - What is the output for −
'Tutorials Point' [100:200]?
Slicing will never give us an error even if we give it too large of an index for the string. It will just return the widest matching slice it can.
Q 2 - What is output for −
b = [11,13,15,17,19,21]
b[::2] :- it iterates over the list with ‘2’ increments
Q 3 - What is output of following code −
Since there are no separators in the given string so the output is the same string.
Q 4 - Suppose we have two sets A & B, then A<B is:
If A is proper subset of B then hen all elements of A are in B but B contains at least one element that is not in B.
Q 5 - What is the output of the following code?
import math def main(): math.cos(math.pi) main() print(main())
None is printed because function does not return the value.
Q 6 - Which among them is used to create an object?
constructor is used to create an object of class.
we need to define the set by including the keyword ‘set’.
Q 8 - Select the correct code to create a check button under parent frame1 and it should be bind to v1?
Checkbutton method is used to make a checkbox. In the parameters we need to pass the values as asked in the question. Here it should bind to v1 thus variable is set to v1 and frame should be under frame1 thus frame1 mentioned in the code.
Q 9 - Select the correct code to create a button under a parent window with command processButton
Button keyword is used to make a button in Python. To set the process button in command we assign the value processButton in the command. Any text value can be given to the button which is assigned under text keyword.