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?

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

2. What arithmetic operators cannot be used with strings ?

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

>>>print r"\nhello"

The output is?

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

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

>>>print 'new' 'line'

6. What is the return type of function id ?

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

8. What is the output of the following?

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

9. What is the output of the following?

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

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

>>>str="hello"

>>>str[:2]

>>>

11. What is the output of the following?

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

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

>>> str1 = 'hello'

>>> str2 = ','

>>> str3 = 'world'

>>> str1[-1:]

13. Which of these in not a core datatype?

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

>>>"a"+"bc"

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

>>>"abcd"[2:]

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

17. What is the output of the following?

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

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

>>>print '\x97\x98'

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

>>>str1="helloworld"

>>>str1[::-1]

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


 

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
error: