# Python Online Quiz

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]?

A - Index error.

B - ' '

C - 'Tutorials Point'

D - Syntax error

### Explanation

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]

ptint(b[::2])

A - [19,21]

B - [11,15]

C - [11,15,19]

D - [13,17,21]

### Explanation

b[::2] :- it iterates over the list with ‘2’ increments

Q 3 - What is output of following code −

```print('hijk'.partition('ab'))
```

A - ('hijk', 'cd', ' ')

B - ('hijk')

C - ('hijk', ' ', ' ')

D - Name error

### Explanation

Since there are no separators in the given string so the output is the same string.

### Explanation

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())
```

A - -1

B - None

C - Error

D - Math.pi not defined

### Explanation

None is printed because function does not return the value.

Q 6 - Which among them is used to create an object?

A - A class

B - A function

C - A method

D - A constructor

### Explanation

constructor is used to create an object of class.

Q 7 - Which options are correct to create an empty set in Python?

A - {}

B - ()

C - []

D - set()

### Explanation

we need to define the set by including the keyword ‘set’.

### Explanation

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.

### Explanation

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.