Working With Functions || Type C || Sumita Arora || Class 12 || Computer science || Information practices || Solution




Q1. Write a function that takes amount-in-dollars and dollar-to-rupee conversion price; it then returns the amount converted to rupees. Create the function in both void and non-void forms.



Q2. Write a function to calculate volume of a box with appropriate default values for its parameters .Your function should have the following input parameters:
 (a) Length of box;
(b) Width of box;
(c) Height of box.
Test it by writing complete program to invoke it.




Q3. Write a program to have following functions:
(i)= a function that takes a number as argument and calculates cube for it .The function does not return a value .If there is no value passed to the function in function call, the function should calculate cube of 2.
(ii) = A function that takes two char arguments and returns True if both the arguments are equal otherwise False .
Test both these functions by giving appropriate function call statements.




Q4. Write a function that receives two numbers and generates a random number from that range Using this function, the main program should be able to print three numbers randomly.



Q5. Write a function that receives two string arguments and checks whether they are same-length strings (returns True in this case otherwise false).



Q6. Write a function namely nthRoot ( ) that receives two parameters x and n and returns nth root of x i.e., X**1/n . The default value of n is 2.




Q7. Write a function that takes a number n and then returns a randomly generated number having exactly n digits (not starting with zero) eg ., if n is 2 then function can randomly return a number 10-99 but 07, 02 etc. are not valid two digit numbers.



Q8. Write a function that takes two numbers and returns the number that has minimum one's digit
[For example, if numbers passed are 491 and 278, then the function will return 491 because it has got minimum one's digit out of two given numbers (491's 1 is < 278's 8)].




Q9. Write a program that generates a series using a function which takes first and last values of the series and then generates four terms that are equidistant e.g., if two numbers passed are 1 and 7 then function returns 1 3 5 7.



11 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. I want working with function type B question answer

    ReplyDelete
    Replies
    1. please wait , it is in process . it will come very soon : )

      Delete
  2. hi here working with functions is not posted mysqlrevision tour posted please update

    ReplyDelete
    Replies
    1. Thanks for telling us the problem . : )
      Now , I have fix it.

      Delete
  3. Thanks a lot.

    ReplyDelete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post