Facebook Twitter Instagram
    Facebook Twitter Instagram Pinterest Vimeo
    Hand On CodeHand On Code
    Hand On CodeHand On Code
    Home»python»Python Variables and Data Types Quiz
    python

    Python Variables and Data Types Quiz

    April 2, 2023No Comments3 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Python Data Types and Variables Test

    Learn about the many data kinds that may be stored in variables with this multiple-choice quiz on the subject. Learn more about assigning values to variables in Python with this interactive quiz.

    casting.

    • The quiz contains

      13 Questions

      . Solve

      8

      correct to pass the test.
    • Read all the given answers and click over the correct answer.

    Study Python Data Types and Variables for this test.

    1. Determine the result of the following:

    code

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

    Run

    50

    NameError

    None

    0

    2. What follows from

    False is printed if type([]) is a list

    True

    3. What does the following variable provide as an answer?

    assignment?

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

    Run

    For more, see Python Variables. Error

    76

    1

    None

    4. Inside a function, which of the following expressions should be used to set the value of the global variable ” x ” to 20?

    fun1()

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

    Run

    x = 20 on a global scale

    int x = global;

    x = 20 on a worldwide scale.

    The World x

    x = 20

    5. Get all the Strings that can be created in

    Python


    • str1 = 'str1'

    • str1 = "str1"

    • str1 = '''str'''



    • str1 = 'str1'

    • str1 = "str1""

    • str1 = '''str1''

    This means that str1 Equals str (Jessa)

    6. To make a string literal, choose the correct options.

    For example, “Ault’Kelly str1 = “Ault’Kelly”

    Ault Kelly’; str1 = “Ault”;

    string1 = “Ault’Kelly”

    7. Which data type best describes the

    following

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

    Run

    Refer

    :


    • Python Data types

    • tuples in Python

    list

    complex

    tuple

    8. Which data type best describes

    type(0xFF) number; print

    hexint

    hex

    int

    9. What does this code produce in Python 3?

    type(range(5))

    . (What format will the returned data be in)? Protip: Python’s range() function

    int

    list

    range

    None

    10. I need to know the result of

    True if print(type() is set)

    False

    11. Which data type best describes

    type(10) float print

    integer

    int

    12. Determine the result of the following:

    code?

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

    Run

    NameError

    25

    25

    25

    50

    13. What does the following code produce?

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

    False False False True

    Indeed Indeed False Indeed

    True False True False

    image

    Waiting for…

    image

    Learn Python free Python Code Python Course Free download python coursefree Courses Download Python Language Python Variables and Data Types Quiz
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleFunction Annotations in Python
    Next Article Gaussian Elimination in Python

    Related Posts

    python

    Class method vs Static method in Python

    April 7, 2023
    python

    Python Program to Count the Number of Matching Characters in a Pair of String

    April 7, 2023
    python

    Coroutine in Python

    April 7, 2023
    Add A Comment

    Leave A Reply Cancel Reply

    Facebook Twitter Instagram Pinterest
    © 2023 ThemeSphere. Designed by ThemeSphere.

    Type above and press Enter to search. Press Esc to cancel.