My Report

Python Basic Online Test – 3


Correct Answer: 2 points | Wrong: -1 point
Grades: A* (100% score) | A (80%-99%) | B (60%-80%) | C (40%-60%) | D (0%-40%)
advertisement

1. What error occurs when you execute the following Python code snippet?

apple = mango

2. Given a function that does not return any value, What value is thrown by default when executed in shell.

3. What data type is the object below?

L = [1, 23, 'hello', 1]

4. What will be the output of the following Python code?

>>>str="hello"
>>>str[:2]
>>>

5. What is the average value of the following Python code snippet?

>>>grade1 = 80
>>>grade2 = 90
>>>average = (grade1 + grade2) / 2

6. What is the return value of trunc()?

7. Which of the following results in a SyntaxError?

8. Which of the following will run without errors?

9. Select all options that print.

hello-how-are-you

10. Which of these in not a core data type?

11. In order to store values in terms of key and value we use what core data type.

12. In python we do not specify types, it is directly interpreted by the compiler, so consider the following operation to be performed.

>>>x = 13 ? 2

objective is to make sure x has a integer value, select all that apply (python 3.xx)

13. The following is displayed by a print function call. Select all of the function calls that result in this output.

tom
dick
harry

14. What is the return type of function id?

15. What will be the output of the following Python code snippet?

def example(a):
    a = a + '2'
     a = a*2
    return a
>>>example("hello")

 

Start practicing “1000 MCQs on Python”, and once you are ready, you can take tests on all topics by attempting our “Python Test Series”.

Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.