Computer Science, asked by Anshtiwari08, 1 month ago

Question1

a)State two differences between pure and impure functions?

b) State the difference between the functions length and length() ?

c)Give the prototype of a function which receives a character ch and an integer n and returns true or false.

d)if int n[]=(1,2,3,5,7,9,13,16); What are the values of x and y?

x=Math.pow(n[4],n[2]);

y=Math.sqrt(n[5] +n[7]);

e) Rewrite the following program segment using if-else statement

comm. (sale>=50000)?sale *10/100: 0;​

Answers

Answered by samiksha6846
1

Answer:

Pure functions take objects and/or primitive data types as arguments but does not modify the objects. Impure functions change the state of received objects. Pure functions doesn't have side effects. Impure functions have side effects.

Answered by Anonymous
2

Answer:

Pure functions take objects and/or primitive data types as arguments but does not modify the objects. Impure functions change the state of received objects. Pure functions doesn't have side effects. Impure functions have side effects

length() : length() method is a final variable which is applicable for string objects. The length() method returns the number of characters present in the string. 1. The length variable is applicable to an array but not for string objects whereas the length() method is applicable for string bjects but not for arrays

Explanation:

kya yarr ek question mai itne sare questions daal ke pts save kar rhe ho kya

kuch samaj nhi aa rha kon kon se subject ka hai

Similar questions