Python Mcqs Test Online

Python Mcqs Test

Total Questions: 20
Time Allowed: 10 Minutes
Total Marks: 20
How to Attempt Test: Please choose the right Option in MCQ-type question.
Test Helpful For: Computer Test
Competitive exam
Forces test
Fpsc
Entry test
Recruitment test

Python Mcqs Test Practice Online

 0%

Page 1 of 1

1. What is the output of the following?

x = 'abcd'
for i in range(x):
print(i)

2. Which of these in not a core datatype?

3. What is the output when following statement is executed ?

>>>"abcd"[2:]

4. What arithmetic operators cannot be used with strings ?

5. What is the output of the following?

x = 'abcd'
for i in x:
print(i.upper())

6. Following set of commands are executed in shell, what will be the output?

>>>str="hello"

>>>str[:2]

>>>

7. What is the output of the following?

x = 'abcd'
for i in range(len(x)):
print(x)
x = 'a'

8. What is the output of the following?

print("xyyzxyzxzxyy".count('yy'))

9. What is the output of the following?

x = 'abcd'
for i in x:
print(i)
x.upper()

10. What is the return type of function id ?

11. What error occurs when you execute?
apple = mango

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

13. What is the output when following code is executed ?

>>> str1 = 'hello'

>>> str2 = ','

>>> str3 = 'world'

>>> str1[-1:]

14. What is the output when following code is executed ?

>>>str1="helloworld"

>>>str1[::-1]

15. The output of executing string.ascii_letters can also be achieved by?

16. What is the output when following statement is executed ?

>>>"a"+"bc"

17. What is the output when following statement is executed ?

>>>print '\x97\x98'

18. What is the output when following code is executed ?

>>>print r"\nhello"

The output is?

19. Print 0xA + 0xB + 0xC ?

20. What is the output when following statement is executed ?

>>>print 'new' 'line'


 

You Can Learn and Gain more Knowledge through our Online Quiz and Testing system Just Search your desired Preparation subject at Gotest.

Maan Ali

Hey there! I'm Maan Ali, your online test prep pal. Join me in the adventure of acing exams with ease. I'll share tricks, practice tests, and all you need to rock your studies. Let's make learning fun and success a sure thing!

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button