Python MCQs to  Test Your Knowledge

10

A. 129  B. 8  C. 121  D. None of the above

1. What will be the output of the following code snippet? print(2**3 + (5 + 6)**(1 + 1))

Check out the answer here!

A. if ele in list  B. if not ele not in list  C. Both A and B  D. None of the above

2. Find out the proper syntax to check if a particular element is present in a list.

Check out the answer here!

3. Which of the following functions converts date to corresponding time in Python?

Check out the answer here!

A. strptime()  B. strftime()  C. Both A and B  D. None of the above

4. As what datatype are the *args stored, when passed into a function?

A. List  B. Tuple  C. Dictionary  D. None of the above

Check out the answer here!

5. Which of the following blocks will always be executed whether an exception is encountered or not in a program?

Check out the answer here!

A. try  B. except  C. finally  D. None of the above

6. What keyword is used in Python to raise exceptions?

Check out the answer here!

A. raise  B. try  C. goto  D. except

7. Which of the following are valid escape sequences in Python?

Check out the answer here!

A. \n  B. \t  C. \\  D. All of the above

A. 65536  B. 33  C. 169  D. None of these

8. What will be the result of the following expression in Python 2**3 + 5 **2?

Check out the answer here!

9. Find out which modules needs to be imported to handle date time computations in Python.

Check out the answer here!

A. datetime  B. date  C. time  D. timedate

A. count()  B. upper()  C. strip()  D. All of the above

10. Which of the following are valid string manipulation functions in Python?

Check out the answer here!

Are you prepared to assess Python Programming Skills?

Demonstrate your expertise by taking our quiz. Simply click on the ""Try it now"" button to commence. Best of luck!

Enhance your Python Programming Skills with Scaler!

Sign up for Scaler's free masterclasses and events to learn about the latest trends in the IT industry and become a pro.  Don't hesitate any longer, register today!