GoConqr has a new look! Let us know what you think.

Quiz

Final Exam

_ 54 questions

Take the quiz

Questions in this quiz (54)

  1. 1def fun (n):
    for i in range (n):
    yield s
    for x in fun (3) :
    print (x, end-")
    1. A2***
    2. B****
    3. C******
    4. D*
  2. 2What is the name of the directory/folder created by Python used to store pye files?
    1. A__pycfiles__
    2. B__cache__
    3. C__pycache__
    4. D___pyc___
  3. 3What is the expected output of the following code, located in the file module.py?
    print(__name__)
    1. A__module.py__
    2. B__main__
    3. Cmodule.py
    4. Dmain
  4. 4What is the expected behavior of the following snippet?
    try:
    raise Exception
    except:
    print ("c")
    except BaseException:
    print ("a")
    except Exception:
    print ("b")
    1. AThe code will output c
    2. BThe code will cause an error
    3. CThe code will output a
    4. DThe code will output b
  5. 5What is the expected output of the following code?

    from datetime import timedelta
    delta - timedelta (weeks - 1, days - 7, hours - 11)
    print (delta)
    1. A14 days, 11:00:00
    2. B1 week, 7 days, 11 hours
    3. C7 days, 11:00:00
    4. D2 weeks, 11:00:00
  6. 6OWhat is the expected output of the following snippet?

    class X:
    pass
    class Y (X) :
    pass
    class 2(Y):
    pass
    x-=X()
    z=Z
    print (isinstance (x, 2), isinstance (z, X))
    1. ATrue False
    2. BFalse True
    3. CFalse False
    4. DTrue True
  7. 7What is the expected output of the following piece of code?
    х, у, z = 3, 2, 1
    z, Y, x-=x, Y, z
    print (x, y. 2)
    1. A1 2 2
    2. B2 1 3
    3. C3 2 1
    4. D1 2 3
  8. 8What is the expected behavior of the following code?
    x="\"
    print (len (x))
    1. AThe code will cause an error
    2. BThe code will ouput a2
    3. CThe code will output 3
    4. DThe code will output 1
  9. 9OWhat is the expected output of the following code?

    import calendar
    c= calendar.calendar (calendar. UNDAY)
    for weekday in c.iterweekdays (:
    print (weekday, end=" ")
    1. A6 0 1 2 3 4 5
    2. B$u
    3. CSu Mo Tu We Th Fr Sa
    4. D7 1 2 3 4 5 6
  10. 10Which line properly invokes the function defined as below?
    def fun (a, b, c=0):
    # function body
    1. Afun(0)
    2. Bfun(b=0, =0)
    3. Cfun(1, c=2)
    4. Dfun(a=1, b=0, c=0)

Information

Description
Quiz on Final Exam, created by _ _ on 27/01/2022.
Author
_ _
Language
English
Views
24
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?