ADITYA CODING CLUB
Aditya College of Engineering, Madanapalle
Python Programming Test- 11
1.Test Contains 10 Questions
2. All Questions are asked from Exception concept
3. Each Question Carries 1 Mark
Roll Number *
Type your Full Roll Number( Eg: 208P1A0565)
Name *
Type your Name
DEPARTMENT *
Year *
Required
Section *
1. How many except statements can a try-except block have? *
1 point
2. When will the else part of try-except-else be executed? *
1 point
3. Is the following Python code valid?
          try:
                 # Do something
         except:
                 # Do something
         finally:
                 # Do something
*
1 point
4. When is the finally block executed?
    
*
1 point
5.  What will be the output of the following Python code?
     #generator def f(x): yield x+1 g=f(8) print(next(g))
*
1 point
6.  What will be the output of the following Python code?
def f(x): yield x+1 print("test") yield x+2 g=f(9)
*
1 point
7. Can one block of except statements handle multiple exception? *
1 point
8. What will be output for the folllowing code?
try:
  f = open(""demofile.txt"")
  f.write(""Lorum Ipsum"")
except:
  print(""Something went wrong when writing to the file"")
finally:
  f.close()
*
1 point
9.  What will be the output of the following Python code?
def a(): try: f(x, 4) finally: print('after f') print('after f?') a()
*
1 point
10. What will be the output of the following Python code?
g = (i for i in range(5)) type(g)
*
1 point
Submit
Clear form
Never submit passwords through Google Forms.
This content is neither created nor endorsed by Google. Report Abuse - Terms of Service - Privacy Policy