PYnative

Python Programming

  • Learn Python
  • Exercises
  • Quizzes
  • Code Editor
  • Tricks
Home » Python » Quizzes » Python Variables and Data Types Quiz

Python Variables and Data Types Quiz

Updated on: August 24, 2022 | 44 Comments

This Python Variables and Data Types Quiz provide Multiple Choice Questions(MCQ) to get familiar with different data types of variables. This online quiz will help you to improve your understanding of Python variable assignment and casting.

Also, Solve Python Basic Exercise for Beginners.

  • The quiz contains 13 Questions. Solve 8 correct to pass the test.
  • Read all the given answers and click over the correct answer.

Read Variables in Python and Python Data Types to solve this quiz.

1. What is the output of the following code

def func1():
    x = 50
    return x
func1()
print(x)
 
 
 
 

2. What is the result of print(type([]) is list)

 
 

3. What is the output of the following variable assignment?

x = 75
def myfunc():
    x = x + 1
    print(x)

myfunc()
print(x)

Refer Variables in Python.

 
 
 
 

4. Please select the correct expression to reassign a global variable “x” to 20 inside a function fun1()

x = 50
def fun1():
    # your code to assign global x = 20
fun1()
print(x) # it should print 20
 
 
 
 

5. Select all the valid String creation in Python

 
 
 

6. Select all the right ways to create a string literal Ault'Kelly

 
 
 

7. What is the data type of the following

aTuple = (1, 'Jhon', 1+3j)
print(type(aTuple[2:3]))

Refer:

  • Python Data types
  • tuples in Python
 
 
 

8. What is the data type of print(type(0xFF))

 
 
 
 

9. In Python 3, what is the output of type(range(5)). (What data type it will return).

Hint: range() in Python

 
 
 
 

10. What is the output of print(type({}) is set)

 
 

11. What is the data type of print(type(10))

 
 
 

12. What is the output of the following code?

x = 50
def fun1():
    x = 25
    print(x)
    
fun1()
print(x)
 
 
 

13. What is the output of the following code

print(bool(0), bool(3.14159), bool(-3), bool(1.0+1j))

 
 
 
 

Loading ... Loading …

Loading

Filed Under: Python, Python Basics, Python Quizzes

Did you find this page helpful? Let others know about it. Sharing helps me continue to create free Python resources.

TweetF  sharein  shareP  Pin

About Vishal

Founder of PYnative.com I am a Python developer and I love to write articles to help developers. Follow me on Twitter. All the best for your future Python endeavors!

Related Tutorial Topics:

Python Python Basics Python Quizzes

Python Exercises and Quizzes

Free coding exercises and quizzes cover Python basics, data structure, data analytics, and more.

  • 15+ Topic-specific Exercises and Quizzes
  • Each Exercise contains 10 questions
  • Each Quiz contains 12-15 MCQ
Exercises
Quizzes

Posted In

Python Python Basics Python Quizzes
TweetF  sharein  shareP  Pin

  Python Quizzes

  • Python Quizzes Home
  • Basic Quiz For Beginners
  • Variables and Data Types Quiz
  • Operators and Expression Quiz
  • Input and Output Quiz
  • Functions Quiz
  • if else and loops Quiz
  • Numbers Quiz
  • String Quiz
  • List Quiz
  • Set Quiz
  • Dictionary Quiz
  • Tuple Quiz
  • File Handling Quiz
  • Random Data Generation Quiz

All Python Topics

Python Basics Python Exercises Python Quizzes Python File Handling Python OOP Python Date and Time Python Random Python Regex Python Pandas Python Databases Python MySQL Python PostgreSQL Python SQLite Python JSON

About PYnative

PYnative.com is for Python lovers. Here, You can get Tutorials, Exercises, and Quizzes to practice and improve your Python skills.

Explore Python

  • Learn Python
  • Python Basics
  • Python Databases
  • Python Exercises
  • Python Quizzes
  • Online Python Code Editor
  • Python Tricks

Follow Us

To get New Python Tutorials, Exercises, and Quizzes

  • Twitter
  • Facebook
  • Sitemap

Legal Stuff

  • About Us
  • Contact Us

We use cookies to improve your experience. While using PYnative, you agree to have read and accepted our Terms Of Use, Cookie Policy, and Privacy Policy.

Copyright © 2018–2023 pynative.com