MENU

Chapter 10 Functions Solutions

Question - 1 : -
What is sys.argv?

Answer - 1 : -

A list containing the program name and all the command-line arguments to a program.

Question - 2 : -
What can you do with the eval function?

Answer - 2 : -

Eval(s) evaluates an expression contained in a string s and returns the resulting object.

Question - 3 : -
What does sys.argv[1:] mean?

Answer - 3 : -

A list of the command-line arguments.

Question - 4 : -
What type of errors does the exception type NameError correspond to?

Answer - 4 : -

A variable that is not initialized (defined), perhaps a variable/function that is misspelled.

Question - 5 : -
Why we use ceil(x) function?

Answer - 5 : -

It returns the ceiling of x as a float, the smallest integer value greater than or equal to x.

Question - 6 : -
Why we use floor(x) function?

Answer - 6 : -

It returns the floor of x as a float, the largest integer value less than or equal to x.

Question - 7 : -
What value will be return by log10(x) ?

Answer - 7 : -

Returns the base-10 logarithm of x. This is usually more accurate than log(x,10).

Question - 8 : -
What value will be return by cos(x)?

Answer - 8 : -

Returns the cosine of x radians.

Question - 9 : -
Define tan(x) function in python.

Answer - 9 : -

Tan(x) function return the tangent of x radians.

Question - 10 : -
What gets printed? Assuming python version 2.x print type(l/2)

Answer - 10 : -


Free - Previous Years Question Papers
Any questions? Ask us!
×