wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MODULES,ERROR AND EXCEPTION HANDLING

Total questions: 10

Worksheet time: 20mins

Name
Class
Date
1.

a+b=c,Identify the type of error.

a)

Syntax Error

b)

Logical Error

c)

Semantics

d)

Run time Error

2.

When the grammatical rules of a programming language ,it will result in:

a)

Semantics

b)

Syntax Error

c)

Logical Error

d)

RunTime Error

3.

Trying to access a list element ,dictionary value which does not exist , results……………………………of error.

a)

Runtime error

b)

Logical Error

c)

Syntax Error

d)

Semantics Error

4.

------------------ and -------------------- statements are used to prevent an exception from terminating a program

a)

try,catch

b)

try,except,

c)

try

d)

try,else

5.

Generates a random number from 0 to 1.

a)

randomint()

b)

random()

c)

randomrange()

d)

randoint()

6.

a=20, B=10, C=a+b ;Will result in …………………………… exception.

a)

ValueError

b)

NameError

c)

TypeError

d)

Attribute Error

7.

Can we create a breakpoint using set,trace() ?

a)

Yes

b)

No

c)

Maybe

8.

Any number of except clauses can be included in a try block?

a)

No

b)

Yes

c)

Maybe

9.

What is the other name for logical error. ?

a)

Runtime Error

b)

Semantic Error.

c)

Syntax Error

d)

ValueError

10.

.-----------------function returns the most repeated value of the list/sequence passed.

a)

Mode

b)

Median

c)

Randomint()

d)

random()