No Result
View All Result
Sunday, September 24, 2023
  • Login
Getting Placed
  • Home
  • Jobs
  • Exam
  • Admit Card
  • Result
  • Internship
  • Home
  • Jobs
  • Exam
  • Admit Card
  • Result
  • Internship
No Result
View All Result
Getting Placed
No Result
View All Result

Python MCQs on Data Type: SET 2

Abhishek by Abhishek
April 28, 2021
in Python
0
python

11. Which of the following results in a SyntaxError?

a) ‘”Once upon a time…”, she said.’

b) “He said, ‘Yes!’”

c) ‘3\’

d) ”’That’s okay”’

Check Answer
Answer: c
Explanation: Carefully look at the colons.

 

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

tom
dick
harry

a)

print(”’tom
\ndick
\nharry”’)
advertisement

b) print(”’tomdickharry”’)

c) print(‘tom\ndick\nharry’)

d)print(‘tom
dick
harry’)

Check Answer
Answer: c
Explanation: The \n adds a new line.

 

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

>>>grade1 = 80

>>>grade2 = 90

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

a) 85.0

b) 85.1

c) 95.0

d) 95.1

Check Answer

Answer: a
Explanation: Cause a decimal value of 0 to appear as output.

 

14. Select all options that print.

hello-how-are-you

a) print(‘hello’, ‘how’, ‘are’, ‘you’)

b) print(‘hello’, ‘how’, ‘are’, ‘you’ + ‘-‘ * 4)

c) print(‘hello-‘ + ‘how-are-you’)

d) print(‘hello’ + ‘-‘ + ‘how’ + ‘-‘ + ‘are’ + ‘you’)

Check Answer

Answer: c
Explanation: Execute in the shell.

 

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

a) int

b) bool

c) float

d) None

Check Answer
Answer: a
Explanation: Execute help(math.trunc) to get details.

 

16. What is the output of print 0.1 + 0.2 == 0.3?

a) True

b) False

c) Machine dependent

d) Error

Check Answer

Answer: b
Explanation: Neither of 0.1, 0.2 and 0.3 can be represented accurately in binary. The round off errors from 0.1 and 0.2 accumulate and hence there is a difference of 5.5511e-17 between (0.1 + 0.2) and 0.3.

 

17. Which of the following is not a complex number?

a) k = 2 + 3j

b) k = complex(2, 3)

c) k = 2 + 3l

d) k = 2 + 3J

Check Answer

Answer: c
Explanation: l (or L) stands for long.

 

18. What is the type of inf?

a) Boolean

b) Integer

c) Float

d) Complex

Check Answer

Answer: c
Explanation: Infinity is a special case of floating point numbers. It can be obtained by float(‘inf’).

 

19. What does ~4 evaluate to?

a) -5

b) -4

c) -3

d) +3

Check Answer
Answer: a
Explanation: ~x is equivalent to -(x+1).

 

20. What does ~~~~~~5 evaluate to?

a) +5

b) -11

c) +11

d) -5

Check Answer
Answer: a
Explanation: ~x is equivalent to -(x+1).

Page  1  2  3

Python Interview Questions (MCQs)

We have divided these Python Questions and Answers into various parts based on the topics. Open the Topic of your choice and Practice these MCQs.

Python MCQs on Variables and Operators Python MCQs on Precedence and Associativity
Python MCQs on Data Type Python MCQs on Boolean
Python MCQs on Bitwise Operators Python MCQs on Formatting and Advance Formatting
Python MCQs on Decorators Python MCQs on While and For Loops
Python MCQs on List Python MCQs on List Comprehension
Python MCQs on String Python MCQs on Tuple
Python MCQs on SET Python MCQs on Dictionary
Python MCQs on Functions Python MCQs on Argument Parsing
Python MCQs on Global and Local Variables Python MCQs on Recursion
Python MCQs on Mapping Functions Python MCQs on Modules
Python MCQs on Regular Expressions Python MCQs on Files
Python MCQs on Overloading Python MCQs on Classes and Objects
Python MCQs on Inheritance Python MCQs on Polymorphism and Encapsulation
Python MCQs on Exception Handling

 

Previous Post

Python MCQs on Tuple: SET 3

Next Post

Python MCQs on Data Type: SET 1

Abhishek

Abhishek

Next Post
python

Python MCQs on Data Type: SET 1

Leave a Reply Cancel reply

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

Follow Us on Google News
No Result
View All Result

Recent Posts

  • Mustard Oil Price: सस्ता हुआ सरसों का तेल, खरीदने वालों की लगी भीड़
  • Bhojpuri Video: पवन सिंह ने रात के अंधेरे में मोनालिसा के बदन पर फेरा हाथ, मच गया बवाल
  • Gori Nagori ने उछल-उछल कर तोड़ दिया स्टेज, लगाए ताबड़तोड़ ठुमके
  • Haryanvi Dance: भरी जवानी में Gori Nagori के लगाए लटके-झटकें, देख बूढ़ों में आया जोश
  • Gori Nagori ने स्टेज पर उछल उछल कर लगाए जोरदार ठुमके, वायरल हुआ वीडियो

Recent Comments

  • Abhishek on Win 11 Download Links

Archives

  • September 2023
  • June 2023
  • May 2023
  • April 2023
  • February 2023
  • January 2023
  • December 2022
  • November 2022
  • August 2022
  • July 2022
  • October 2021
  • July 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • April 2020
  • February 2020

Categories

  • Admit Card
  • Algorithm and Programs
  • Exam
  • Internship
  • Java
  • Jobs
  • latest
  • politics and entertainment
  • Python
  • Result
  • Trademark
  • Uncategorized

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
  • Privacy Policy
  • DMCA
  • Terms of Use
  • Sitemap

© 2020 Getting Placed

No Result
View All Result
  • Home
  • Jobs
  • Exam
  • Admit Card
  • Result
  • Internship

© 2020 Getting Placed

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms below to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In