Function Basics MCQs: 12 Solved Questions on Domain, Range and Function Counting

Solve 12 function basics MCQs step by step, from identifying domains and ranges to counting total and partial functions and testing image identities.

KnowledgeGate Team

Exam prep & CS education

Updated 25 Oct 20268 min read

A function uses every domain element exactly once, but its range may be smaller than its co-domain. Total functions from m inputs to n outputs number n^m; under the inclusive definition used here, partial functions number (n+1)^m. Use Function MCQs: 11 Solved on Domain, Range & Counting for the canonical broad practice set. Five PYQs recur here so you can connect range, total counts, the 97-function constraint, nested power-set counting and image identities to one model; the seven additional questions test the definition, square-root range, range cardinality and partial functions.

Calibrate function, domain, co-domain and range with one mapping

A function from A to B assigns every element of A to exactly one element of B. Different inputs may share an output unless injectivity is required. Some elements of B may remain unused unless surjectivity is required. This distinction is foundational in GATE CS Exam Preparation, because a relation can look like a mapping without satisfying the function rule.

Take A = {1,2,3}, B = {a,b,c,d} and f = {(1,b),(2,d),(3,b)}. It is a valid function because every element of A appears exactly once as a first coordinate. Its domain is {1,2,3}, its co-domain is {a,b,c,d}, and its range is {b,d}. The repeated image b is allowed. The unused values a and c stay in the co-domain but not in the range.

Now compare R = {(1,a),(1,c),(2,b)}. Input 1 has two outputs, while input 3 has none. Both facts prevent R from being a function from A to B.

Arrow diagram comparing a valid function from A to B with an invalid relation where input 1 has two outputs and input 3 has none.

A function as a restricted relation

Question 1

What is a function in Discrete Mathematics?

  • A. A binary relation where each first element is related to a unique second element

  • B. A binary relation where each first element is related to many second elements

  • C. A binary relation where each second element is related to many first elements

  • D. A binary relation where each second element is related to a unique first element

Answer: A.

Unique means exactly one output per admitted first element. B breaks single-valuedness. C and D constrain second elements, describing many-to-one or injective behaviour rather than the basic rule. In f, each first coordinate has one partner although b appears twice.

Question 2

What is a function in terms of a relation?

  • A. A relation where every element of the domain is related to exactly one element of the codomain

  • B. A relation where some elements of the domain are related to more than one element of the codomain

  • C. A relation where every element of the domain is related to at least one element of the codomain

  • D. A relation where some elements of the domain are not related to any element of the codomain

Answer: A.

Exactly one combines existence and uniqueness. Existence rules out D; uniqueness rules out B. C guarantees existence but may allow two outputs for one input. In R, input 1 breaks uniqueness and input 3 breaks existence.

The input set and the attained output set

Question 3

The domain of a function is:

  • A. The set of all possible output values

  • B. The set of all possible input values

  • C. The set of all possible pairs of input and output values

  • D. The set of all possible functions that can be formed

Answer: B.

The first coordinates of f are 1, 2 and 3, so its domain is {1,2,3}. A describes the range, C the ordered-pair graph, and D neither a component nor an image.

Question 4

The range of a function is:

  • A. The set of all possible output values

  • B. The set of all possible input values

  • C. The set of all possible pairs of input and output values

  • D. The set of all possible functions that can be formed

Answer: A.

Possible means actually attained. The co-domain is B = {a,b,c,d}, but only b and d occur, so the range is {b,d}. Practise the notation in Set Theory and Relations MCQs: 12 Solved (GATE).

Ranges and their cardinalities

Question 5

What is the range of the following function?

{(4,8),(9,2),(-3,-4)}

  • A. {4,9,-3}

  • B. {8}

  • C. {(4,8),(9,2),(-3,-4)}

  • D. {8,2,-4}

Answer: D.

In each (input, output) pair, the second coordinates are 8, 2 and -4, giving {8,2,-4}. A is the domain, B omits two outputs, and C is the graph. This question appeared in the UPLT 2018 paper. The canonical set uses this PYQ as an ordered-pair read; here it separates attained range from the co-domain in the opening mapping.

Question 6

What is the range of the function y=√x ?

  • A. (-∞,∞)

  • B. (0,∞)

  • C. [0,∞)

  • D. (-1,1)

Answer: C.

For real inputs, √x requires x ≥ 0 and is never negative. Since x=0 gives y=0, the endpoint is included. Also, x=1 gives 1 and x=9 gives 3. Every y ≥ 0 is attained by choosing x=y², proving the range [0,∞).

Question 7

The cardinality of a function's range:

  • A. Must be equal to the cardinality of its domain

  • B. Can be less than or equal to the cardinality of its domain

  • C. Can be greater than or equal to the cardinality of its domain

  • D. Is unrelated to the cardinality of its domain

Answer: B.

Every range element needs an input witness. For g:{1,2,3,4}->{p,q,r}, let g(1)=p, g(2)=q, g(3)=p, g(4)=p. The sizes are 4 and 2 because the range is {p,q}. Equality occurs for h(1)=p, h(2)=q, h(3)=r on three inputs.

Total and partial functions by independent choices

Question 8

The number of functions from an m element set to an n element set is

  • A. m+n

  • B. m^n

  • C. n^m

  • D. m*n

Answer: C.

Each of the m inputs independently chooses one of n outputs, giving n × n × ... × n = n^m with m factors. For A={1,2} and B={a,b,c}, three choices for each input give 3 × 3 = 3² = 9. The base counts outputs and the exponent inputs. This question appeared in GATE 1998. The canonical set uses this PYQ as a standalone total count; here it is paired with Q9 to expose the extra undefined choice.

Question 9

f:A→B is a partial function if Domain(f)⊆A. Number of such partial functions when ∣A∣=m and ∣B∣=n is

  • A. n^m

  • B. m^n

  • C. (n+1)^m

  • D. (m+1)^n

Answer: C.

Each input chooses one of n images or undefined, so it has n+1 choices. With A={1,2} and B={a,b,c}, the four states {a,b,c,undefined} give 4²=16. Of these, 3²=9 are total, so 16-9=7 leave an input undefined.

Decision tree counting 9 total functions and 16 partial functions from a two-element set to a three-element set.

Power sets and the function-count formula

Question 10

Let X, Y, Z be sets of sizes x, y and z respectively. Let W = X x Y. Let E be the set of all subsets of W. The number of functions from Z to E is:

  • A. z^(2xy)

  • B. z x 2^(xy)

  • C. z^(2x + y)

  • D. 2^(xyz)

Answer: D.

W = X × Y has xy elements, so its power set E has 2^(xy). Functions from Z to E number (2^(xy))^z = 2^(xyz). For x=4, y=2, z=2, |W|=4×2=8, |E|=2^8=256, and 256²=65536=2^16. This question appeared in GATE 2006. The canonical set uses inside-out counting; here the same PYQ extends the n^m rule from Q8 through a power set.

Question 11

Suppose X and Y are sets and |X| and |Y| are their respective cardinalities. It is given that there are exactly 97 functions from X to Y. From this one can conclude that

  • A. |X|=1,|Y|=97

  • B. |X|=97,|Y|=1

  • C. |X|=97,|Y|=97

  • D. None of the above

Answer: A.

Let |X|=m and |Y|=n, so n^m=97. Since 97 is prime, its only positive-integer power form is 97^1. Thus m=1, n=97. B gives 1^97=1; C gives 97^97. This question appeared in GATE 1996. The canonical set tests the base and exponent; here the count is solved in reverse from n^m=97.

Image identities and a many-to-one counterexample

Question 12

Let f: A → B be a function, and let E and F be subsets of A. Consider the following statements about images.

S1: f(E ∪ F) = f(E) ∪ f(F)

S2: f(E ∩ F) = f(E) ∩ f(F)

Which of the following is true about S1 and S2?

  • A. Only S1 is correct

  • B. Only S2 is correct

  • C. Both S1 and S2 are correct

  • D. Neither S1 nor S2 is correct

Answer: A.

S1 is always true. If y ∈ f(E ∪ F), some x ∈ E ∪ F maps to y. Then x ∈ E or x ∈ F, so y ∈ f(E) ∪ f(F). The reverse inclusion follows by the same membership test. For intersections, only f(E ∩ F) ⊆ f(E) ∩ f(F) is guaranteed.

For S2, take A={1,2,3}, B={u,v} and f(1)=u, f(2)=v, f(3)=u. Choose E={1,2} and F={2,3}, so E ∩ F={2} and f(E ∩ F)={v}. But f(E)={u,v} and f(F)={u,v}, giving f(E) ∩ f(F)={u,v}. The extra element u arrives because inputs 1 and 3 share it, so equality fails for this many-to-one function even though E and F overlap. This question appeared in GATE 2001. The canonical set uses disjoint subsets; the overlapping subsets here isolate the many-to-one cause.

Four checks for function questions

Use four checks. First, confirm that every input has exactly one output. Second, read first coordinates for the domain and attained second coordinates for the range. Third, use n^m for total functions and (n+1)^m for partial functions. Fourth, challenge a set-image equality with a small many-to-one counterexample.

For the complete concept sequence, continue with GATE Guidance by Sanchit Sir. For NET Computer Science preparation, use NTA-UGC-NET Paper - 2. Then redraw both worked diagrams and recompute 3²=9, 4²=16, and (2^(4×2))²=65536 without looking at the explanations. Say what the base and exponent count each time. If one result differs, trace the choices input by input before marking another option.