InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
If f:R → R and f(x) = x2 + 2x – 1, then state the type of function f. |
|
Answer» f: R → R f(x) = x2 + 2x – 1 Domain={… -2, -1. 0. 1, …} Co-domain={… -1, -2, -1, 2,…} Here, for two different elements -2 and 0 of domain, their Images are same In co-domain. Therefore function f is many-one function. |
|
| 2. |
If f:A → N, A = {500, 1000, 1300, 1400}, f(x) = \(\sqrt{5600−4x}\), XER then find the value of f(x) for x = 1000. Also, for which value of x, f(x) = 20? |
|
Answer» f(x)= \(\sqrt{5600−4x}\) Putting x = 1000, f(4)= \(\sqrt{5600−4(1000)}\) = \(\sqrt{5600−4000}\) = \(\sqrt{1600}\) =40 f(x) = 20 ∴ 20 = \(\sqrt{5600−4x}\) ∴ 400 = 5600 – 4x 4x = 5200 (20)2 = 5600 – 4x ∴ 4x = 5600 – 400 ∴ x = 1300 Hence, when x = 1300. then f(x) = 20. |
|
| 3. |
If f(x) = \(\frac{2x−4}{x+7}\) is a real function then for which value of x the image is zero? |
|
Answer» f(x) = \(\frac{2x−4}{x+7}\) Image = 0. Therefore, put f(x) = 0 0 = \(\frac{2x−4}{x+7}\) ∴ 0 = 2x – 4 ∴ 4 = 2x Therefore, x = 2, the Image is zero. |
|
| 4. |
For a real function, f(x) = 6x3 – 5x + 15, find the value of f (O). |
|
Answer» f(x) = 6x3 – 5x + 15 ∴f(0) = 6 × 0 – 50 + 15 = 0 – 1 + 15 = 14 ∴f(0)=14 |
|
| 5. |
If f (x) = 2x2 + 1/x, x ∈ R; obtain the value of f(3) + f(-3). |
|
Answer» f(x) = 2x2 + 1 / x ∴ f(3) + f( – 3) = 2 (3)2 + 1 / 3 + 2 (- 3)2 + 1 / (−3) = (2 × 9) + 1 / 3 + (2 × 9) – 1 / 3 = 18 + 18 = 36 |
|
| 6. |
What is the type of function f: A → B, wherein, for two different values of domain their functional values are same?(a) One-one function(b) Many-one function(c) One-many function(d) Many-many function |
|
Answer» Correct option is (b) Many-one function |
|
| 7. |
If f(x) = \(\frac{x^2−4}{x−2}\) where x ∈ Z – {2} then find the value of f(0) + f(1) – f(-2). |
|
Answer» f(x) = \(\frac{x^2−4}{x−2}=\frac{(x+2)(x−2)}{x−2}\) = x + 2 ∴ f(0) + f(1) – f(-2) = (0 + 2 + (1 + 2) – (-2 + 2) = 2 + 3 – 0 = 5 |
|
| 8. |
Which of the following statements is true for the relation g : X → Y, X = {- 1, 0}; Y = {2, 4}; g (x) = 4 – 2x ?(a) g is called a function.(b) g is not a function.(c) X is called function.(d) Y is called function. |
|
Answer» Correct option is (b) g is not a function |
|
| 9. |
If the domain of a function f: A → N ∪ {0}; f(x) = \(\sqrt{x^2−16}\) is A = {4, 5}, then find its range. |
|
Answer» f(x) = \(\sqrt{x^2−16}\); Domain = {4, 5} Range Rf = {f(x) | x ∈ Domain} = {f(4), f(5)} Now, f(x) =\(\sqrt{x^2−16}\) ∴ f( 4) = \(\sqrt{(4)^2−16}\) = \(\sqrt{16-16}\) = 0 f(5) = \(\sqrt{(5)^2−16}\) = \(\sqrt{25-16}\) = \(\sqrt{9}\) = 3 (∵ x is positive.} Hence, Range Rf = {0, 3} |
|
| 10. |
g: N → N, ‘subtract 2 from the elements of the domain’. Can this rule be called a function? |
|
Answer» g : N → N, i.e., N = {1, 2, 3, …}; N = {1, 2, 3,…}. Therefore, ‘subtract 2 from the elements of the domain’ this rule cannot be called a function. |
|
| 11. |
Which of the following statement is true?(a) f: {1, 2, 3, 4} → {3, 4, 5}, the rule ‘add 2 to the elements of domain’ is not a function.(b) f: A → B, A = {-2, -1, 0, 1, 2}; B = {0, 1, 2, 3, 4}; f(x) = x2 is not a function.(c) g : P → Q, P = {-1, 0, 1}; Q = {\(-\frac{1}{3}\), -1, 3}; g (x) = \(\frac{x+2}{x−2}\). then g is called function.(d) g : {2, 3, 4, 5} → {-1, 0, 1) and g(x) = 4x – 3 is a function. |
|
Answer» Correct option is (a) f: {1, 2, 3, 4} → {3, 4, 5}, the rule ‘add 2 to the elements of domain’ is not a function. |
|
| 12. |
k:X → Y, X = {t| t ∈ Z, -3 < t ≤ 3};Y = {a| a ∈ N, 1 ≤ a ≤ 20}; k(t) = t2 + 2.State the type of function k. |
|
Answer» k:X → Y Domain X={t| t ∈ Z, -3 ≤ t ≤ 3) = {-3, -2, -1, 0, 1, 2, 3} k (t) = t2 + 2 ∴ k(- 3) = (-3)2 + 2 = 9 + 2 = 11, k (3) = (3)2 + 2=11, k (- 2) = (- 2)2 + 2 = 4 + 2 = 6, k (2) = (2)2 + 2 = 6, k(- 1) = (- 1)2 + 2 = 1 + 2 = 3,k (1) = (1)2 + 2 = 3, k (0) = 0 + 2 = 2 Co-domain Y = {a|a ∈ N ⇒ 1, a ≤ 20} = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, …, 18, 19, 20} Here, for two different elements (-3, 3) of domain, their images in co-domain are k (- 3) = k (3) = 11. Therefore, function k is many one function. |
|
| 13. |
h : A → B, A = {1, 2, 3},B = {3, 4, 5, 6, 7, 8}, h (x) = x + 5.State the type of function h. |
|
Answer» h : A → B A = {1, 2, 3} and h (x) = x + 5 ∴ h (1) = 1 + 5 = 6, h (2) = 2 + 5 = 7, h (3) = 3 + 5 = 8 B = {3, 4, 5, 6, 7, 8} For the elements 1, 2, 3 of domain h (1) ≠ h (2) ≠ h (3). Therefore, function ft is one-one function. |
|
| 14. |
If the function f and g are given by `f={(1,2),(3,5),(4,1)} and g={(2,3),(5,1),(1,3)},`find range of f and g. Also write down `fog` and `gof"`as set of ordered pairs. |
|
Answer» `f = {(1,2),(3,5),(4,1)}` and `g = {(2,3),(5,1),(1,3)}` `:.` Range of `f = {2,5,1}` `:.` Range of `g = {3,1}` Now, `fog(2) = f(g(2)) = f(3) = 5` `fog(5) = f(1) = 2` `fog(1) = f(3) = 5` `:. fog = {(2,5),(5,2),(1,5)}` Now, `gof(1) = g(f(1) )= g(2) = 3` `gof(3) = g(5) = 1` `gof(4) = g(1) = 3` `:. gof = {(1,3),(3,1),(4,3)}.` |
|
| 15. |
If `f(x)=sqrtx(x > 0) and g(x)=x^2-1` are two real functions, find `fog and gof` is `fog=gof ?` |
|
Answer» `f(x) = sqrtx and g(x) = x^2-1` `:. fog = f(g(x)) = f(x^2-1) = sqrt(x^2-1)` `=>gof = g(f(x)) = g(sqrtx) = x -1` `:. fof != gof.` |
|
| 16. |
Find `fog(2)`and `gof(1)`when: `f: R rarr R ;f(x)=x^2+8`and `g: R rarr R ;g(x)=3x^3+1.` |
|
Answer» `f(x) = x^2+8` `g(x) = 3x^3+1` Now, `fog(2) = f(g(2)) = f(3(2^3)+1) = f(25) =25^2+8 = 625+8 = 633` `gof(1) = g(f(1)) = g(1^2+8) = g(9) = 3(9)^3+1 = 2187+1 = 2188`. |
|
| 17. |
If the function `fa n dg`are given by `f={(1,2),(3,5),(4,1)}a n dg="("(2,3),(5,1),(1,3)"}",`find range of `fa n dg`. Also, write down `foga n dgof`as sets of ordered pairs. |
|
Answer» `f = {(1,2),(3,5),(4,1)}` and `g = {(2,3),(5,1),(1,3)}` `:.` Range of `f = {2,5,1}` `:.` Range of `g = {3,1}` Now, `fog(2) = f(g(2)) = f(3) = 5` `fog(5) = f(1) = 2` `fog(1) = f(3) = 5` `:. fog = {(2,5),(5,2),(1,5)}` Now, `gof(1) = g(f(1) )= g(2) = 3` `gof(3) = g(5) = 1` `gof(4) = g(1) = 3` `:. gof = {(1,3),(3,1),(4,3)}.` |
|
| 18. |
Which function definition, doesn’t modify the arguments passed to them?(a) Pure function(b) Impure function(c) Object(d) Interface |
|
Answer» (a) Pure function |
|
| 19. |
Define a function of real variable. |
|
Answer» If f: A → B. where A∈R then f is called a function of real variable. |
|
| 20. |
Give definition of a function. |
|
Answer» If A and B are any two non-empty sets and each element of set A is related with one and only one element of set B by some rule, relation or correspondence, then it is called a function from set A to B and. is denoted by f: A → B. |
|
| 21. |
f: N → N, f(t) = t2 + 1, t ∈ N. Determine the type of function f. |
|
Answer» f: N → N. ∴ N = {1, 2, 3, 4,…} and N = {1, 2, 3, 4, …} f(t) = t2 + 1, t ∈ N f(1)= 1 + 1 = 2, f(2) = 22 + 1 = 5 Here, for two different elements of do-main A, their images are different in co-domain. Therefore, function f is one-one function. |
|
| 22. |
If f: A → M, A = {x | x ∈ N, 1 ≤ x < 5} and M = {x | x ∈ N, 1 ≤ x ≤ 20} and f(x) = x2 + 1, then find the range of f. |
|
Answer» f: A → M A = {x | x ∈ N, 1 ≤ x < 5} = {1, 2, 3, 4} M = {x | x G N, 1 ≤ x ≤ 20} = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} f(x) = x2 + 1 Range of f Rf= {f(x) | x ∈ A} = {f(1), f(2), f(3), f(4)} Now, f(x) = x2 + 1 ∴ f(1) = (1)2 + 1 = 1 + 1 = 2 f(2) = (2)2 + 1 = 4+ 1 = 5 f(3) = (3)2 + 1 = 9 + 1 = 10 f(4) = (4)2 + 1 = 16 + 1 = 17 Hence, Range of f Rf = {2, 5, 10, 17} |
|
| 23. |
Define domain and co-domain of a function. |
|
Answer» Domain of a function: Suppose, f: A → B, the set A is called domain of the function J. It is denoted by Df. Co-domain of a function : Suppose, f: A → B, the set B is called the co-domain of the function f. |
|
| 24. |
f : Z → N, f(t) = t2 + 1, t ∈ Z. Determine the type of function f. |
|
Answer» f: Z → N. ∴ Z = {…-3,-2, -1, 0, 1, 2, 3,…} and N = {1, 2, 3, 4, …} f(t) = t2 + 1, t ∈ Z ∴ f(- 3) = 9 + 1 = 10, f(3) = 9 + 1 = 10, f(- 2) = 4 + 1 = 5 f(2) = 4 + 1 = 5 Here, for two different elements of domain A, their images are same in co-domain. Therefore, function is many-one function. |
|
| 25. |
Define range of a function. |
|
Answer» Suppose f: A → B. then a set of images or functional values of all the elements of set A is called range of function f It is denoted by f. Rf = {f(x) | x ∈ A). The range of a function may be co-domain itself or a subset of co-domain. |
|
| 26. |
g: A → N, A = {x| x ∈ N, 1 < x ≤ 4}; g(x) = x + 1. Find range of function g. |
|
Answer» A = {x | x ∈ N, 1 < x ≤ 4} A = {2, 3, 4} ⇒ Domain g [x] = x + 1 ∴ g (2) = 2 + 1 = 3, g (3) = 3 + 1 = 4, g (4) = 4 + 1 = 5 Range of function Rf = {g (x) | x ∈ A} = {g (2), g (3), g (4)} = {3, 4, 5} |
|
| 27. |
Which of the following statements is true for the range of function f: A → B?(a) f(A) = {f(x)|x ∈ A}(b) It is not a co-domain or subset of co-domain.(c) Domain itself is the range(d) f(A) = {f(x) | x ∈ B} |
|
Answer» Correct option is (a) f(A) = {f(x)|x ∈ A} |
|
| 28. |
For f:A → B, A = {10, 20, 30); B = (18, 48, 98, 128, 148); f(x) = 5x – 2; obtain domain, co-domain and range. |
|
Answer» f: A → B, A = {10, 20, 30} B = {18, 48. 98. 128. 148} f(x) = 5x – 2 Domain: A = (10, 20, 30) Co-domaln: B = {18, 48, 98, 128, 148} Range: Rf ={f(x) | x ∈ A} = {f(10), f(20), f(30)} Now,f(10) = (5 × 10) – 2 = 50—2 = 48 f(20) = (5 × 20) – 2 = 100 – 2=98 f(30) = (5 × 30) – 2 = (150 – 2) = 148 ∴ Range Rf = (48, 98, 148) |
|
| 29. |
f: A → B, A = {-3, -1, 1, 3};B = {1, 0, 9}; f(x) = x2. Is f a function? |
|
Answer» f: A → B, A = {- 3, -1, 1, 3}; B = {1, 0, 9}; f(x) = x2. Therefore, f is a function. |
|
| 30. |
Define a one-one function in notations. |
|
Answer» Suppose, f: A → B. If for any two different elements x1 and x2. f(x1) ≠ f(x2), then function f is called one-one function. |
|
| 31. |
What is the type of function f: A → B, where each value of domain A has the same image in set B?(a) Not a function(b) One-one function(c) Constant function(d) Many-one function |
|
Answer» Correct option is (c) Constant function |
|
| 32. |
Which of the following statements is true for a one-one function?(a) Only for two values of the domain, their images should be different.(b) For any two values of the domain, their images are same.(c) For any two different values of the domain, their images are different.(d) For each value of the domain, their images are same. |
|
Answer» Correct option is (c) For any two different values of the domain their images are different. |
|
| 33. |
If k : R → R, k(x) = x2 + 3x – 12; then ‘ determine the type of the function k. |
|
Answer» k : R → R ∴ Domain = {…, -3, -2, -1, 0, 1, 2, …} k (x) = x2 + 3x – 12 ∴ k (- 3) = (- 3)2 + 3 (- 3) – 12 = – 12 k (- 2) = (- 2)2 + 3 (- 2) – 12 = 4 – 6 – 12 = – 14 k (- 1) = (- 1 )2 + 3 (- 1) – 12 = 1 – 3 – 12 = -14 k(0) = 0 + 0 – 12 = – 12 k(1) = 1 + 3 – 12 = -8 k (2) = 4 + 12 – 12 = 4 ∴ Co-domain = {…, -12, -14, -14, -12, -8, 4, …} Here, for the elements – 3 and 0, – 2 and – 1 of domain, their images are same. Therefore function k is many-one function. |
|
| 34. |
Define constant function in notations. |
|
Answer» Suppose, f: A → B. If for each element x1, x2, x3,… of domain, the image is same in co-domain B, i.e.„ f(x1) = f(x2) = f(x3) = … then, function f is called constant function. |
|
| 35. |
Define many-one function in notations. |
|
Answer» Suppose, f: A → B. If for any two differents x1, x2 of domain A. f(x1) = f(x2), then function / is called many-one function. |
|
| 36. |
Let A = [–1, 1] and f : A → A be defined as f (x) = x | x | for all x ∈ A, then f (x) is(a) many-one into function (b) one-one into function (c) many-one onto function(d) one-one onto function. |
|
Answer» Answer : (d) one-one onto function \(\ f(x) =x|x| =\begin{cases}x^2, &\quad x \geq 0\\-x^2, &\quad x<0\end{cases}\) Since – 1 ≤ x ≤ 1, therefore – 1 ≤ f (x) ≤ 1 ⇒ function is one-one onto. |
|
| 37. |
Which of the following functions is an even function?(a) \(f(x) = \frac{a^x+1}{a^x -1}\) (b)\(f(x) = \frac{a^x- a^{-x}}{a^x +a^{-x}}\)(c) \(f(x) = x.\frac{a^x+1}{a^x -1}\)(d) f (x) = sin x |
|
Answer» Answer: (c) \(f(x) = x.\frac{a^x+1}{a^x -1}\) (a) \(f(x) = \frac{a^x+1}{a^x -1}\) ∴ f (– x) = \( \frac{a^{-x}+1}{a^{-x} -1}\) = \(\frac{\frac{1}{a^x}+1}{\frac{1}{a^x} -1}\) = \(\frac{1+a^x}{1-a^x}\) = \(- \frac{a^x+1}{a^x-1}\) = - f(x) Hence f is odd. (b) Similarly \(f(x) = \frac{a^x-a^{-x}}{a^x +a^{-x}}\) is an odd function. (c) \(f(x) = x.\frac{a^x+1}{a^x -1}\) ∴ \(f(-x) = (-x)\frac{a^{-x}+1}{a^{-x} -1}\) = (-x) \(\frac{1/a^x +1}{1/a^x -1}\) = (-x) \(\frac{1+a^x}{1-a^x}\) = (-x) (\(- \frac{a^x+1}{a^x-1}\)) = x\(\big(\frac{a^x+1}{a^x-1}\big)\) = f(x) ⇒ f is even. (d) f (x) = sin x f (– x) = sin (– x) = – sin x = – f (x) ⇒ f is odd. |
|
| 38. |
If the function f : N → N is defined by f (x) = \(\sqrt{x}\), then\(\frac{f(25)}{f(16)+f(1)}\) is equal to (a) \(\frac{5}{6}\)(b) \(\frac{5}{7}\)(c) \(\frac{5}{3}\)(d) 1 |
|
Answer» Answer : (d) 1 f : R → R given by f (x) = \(\sqrt{x}\) ∴ \(\frac{f(25)}{f(16)+f(1)} = \frac{5}{4+1} = \frac{5}{5}\) = 1. |
|
| 39. |
Explain with example Pure and impure functions? |
|
Answer» Pure functions: Pure functions are functions which will give exact result when the same arguments are passed. For example the mathematical function sin (0) always results 0. This means that every time you call the function with the same arguments, you will always get the same result. A function can be a pure function provided it should not have any external variable which will alter the behaviour of that variable. Let us see an example let square x return: x * x The above function square is a pure function because it will not give different results for same input. There are various theoretical advantages of having pure functions. One advantage is that if a function is pure, then if it is called several times with the same arguments, the compiler only needs to actually call the function once. Let’s see an example let i: = 0; if i < strlen (s) then – Do something which doesn’t affect s ++ i If it is compiled, strlen (s) is called each time and strlen needs to iterate over the whole of ‘s’. If the compiler is smart enough to work out that strlen is a pure function and that ‘s’ is not updated in the loop, then it can remove the redundant extra calls to strlen and make the #loop to execute only one time. From these what we can understand, strlen is a pure function because the function takes one variable as a parameter, and accesses it to find its length. This function reads external memory but does not change it, and the value returned derives from the external memory accessed. Impure functions: The variables used inside the function may cause side effects through the functions which are not passed with any arguments. In such cases the function is called impure function. When a function depends on variables or functions outside of its definition block, you can never be sure that the function will behave the same every time it’s called. For example the mathematical function random Q will give different outputs for the same function call, let Random number let a : = random( ) if a > 10 then return: a else return: 10 Flere the function Random is impure as it is not sure what will be the result when we call the function. |
|
| 40. |
Identify the statement which is wrong.(a) Definitions are expressions(b) Definitions are distinct syntactic blocks.(c) Definitions can have expressions, nested inside them. |
|
Answer» (a) Definitions are expressions |
|
| 41. |
………… binds values to names.(a) Algorithms(b) Variables(c) Interface(d) Definitions |
|
Answer» (d) Definitions |
|
| 42. |
Match the following function definitions with their terms.let rec odd xy : =1. Keyword – (i) Xy 2. Recursion – (ii) Odd3. Function name – (iii) Rec4. Parameters – (iv) let(a) 1 – (iv) 2 – (iii) 3 – (ii) 4 – (i)(b) 1 – (i) 2 – (ii) 3 – (iii) 4 – (iv)(c) 1 – (iv) 2 – (i) 3 – (ii) 4 – (iii)(d) 1 – (i) 2 – (iv) 3 – (ii) 4 – (iii) |
|
Answer» (a) 1 – (iv) 2 – (iii) 3 – (ii) 4 – (i) |
|
| 43. |
The …… defines an object’s visibility to the outside world.(a) Object(b) Interface (c) Pure function(d) Impure function |
|
Answer» The Interface defines an object’s visibility to the outside world. |
|
| 44. |
In object oriented programming language, an is a description of all functions that a class must have(a) Object(b) Class(c) Interface(d) Code |
|
Answer» (c) Interface |
|
| 45. |
Find the correct statement from the following.(a) a : = (24) has an expression(b) (24) is an expression |
|
Answer» (a) a : = (24) has an expression |
|
| 46. |
………… are the basic building blocks of a computer programs.(a) Code (b) Subroutines(c) Modules(d) Variables |
|
Answer» Subroutines are the basic building blocks of a computer programs. |
|
| 47. |
…… are expressed using statements of a programming language.(a) Algorithm(b) Procedure(c) Specification(d) Abstraction |
|
Answer» (a) Algorithm |
|
| 48. |
Define Function with respect to Programming language? |
|
Answer» A function is a unit of code that is often defined within a greater code structure. Specifically, a function contains a set of code that works on many kinds of inputs, like variants, expressions and produces a concrete output. |
|
| 49. |
In programming languages, subroutines are called as ………(a) Functions (b) Task (c) Modules (d) Code |
|
Answer» In programming languages, subroutines are called as Functions |
|
| 50. |
The class template specifies the …… to enable an object to be created and operated properly. |
|
Answer» The class template specifies the Interfaces to enable an object to be created and operated properly. |
|