ITPEC FE Subject B April 2026 Question 15

From the answer group below, select the correct combination of answers to be inserted into A and B in the description.

Bag of Words is a representation of text that describes the occurrence of words in a document. It is a feature extraction method in text mining. From a document collection (or corpus), a feature vector for each document can be created by considering the count of each word in that document.

The following are two documents that construct a text corpus:

document-I: John likes to watch movies. Mary likes movies too.

document-II: Mary also likes to watch football games.

Here, the word sequence, defined by the unique words (ignoring case and punctuation) in the documents, is as follows:

{John, Mary, likes, to, watch, movies, too, also, football, games}

Now, feature vectors for document-I and document-II can be created using the unique words.

Feature Vector for document-I = {1, 1, 2, 1, 1, 2, 1, 0, 0, 0}

Feature Vector for document-II = {0, 1, 1, 1, 1, 0, 0, 1, 1, 1}

Again, two new text documents and the corresponding word sequence are given below:

document-III: He is a good boy. An honest boy is good.

document-IV: He is an honest boy. The good boy is honest.

Here, the word sequence for those two documents is {He, is, a, an, good, boy, honest, the}. Then, the Feature Vectors for document-III and document-IV will be A and B, respectively.

Answer group

OptionAB

Explanation

A: {1, 2, 1, 1, 2, 2, 1, 0}, B: {1, 2, 0, 1, 1, 2, 2, 1} — count every occurrence of each word of the sequence, ignoring case.

The word sequence is {He, is, a, an, good, boy, honest, the}.

Worddocument-IIIdocument-IV
He11
is22
a10
an11
good21
boy22
honest12
the01

In document-III, "is" appears in "He is" and "boy is good"; "good" and "boy" each appear in both sentences. In document-IV, "is" appears twice, "boy" twice, and "honest" in "an honest boy" and "is honest". "An" and "The" count as "an" and "the" because case is ignored.

Answer (i)

Why not others:

  • •(a), (b) and (c) — blank A gives "is" a count of 1 in document-III, missing "boy is good"
  • •(d), (e) and (f) — blank A gives "good" and "boy" a count of 1 in document-III, though each appears twice
  • •(g) — blank B gives "is" a count of 1 in document-IV, missing "boy is honest"
  • •(h) — blank B gives "boy" and "honest" a count of 1 in document-IV, though each appears twice

Key rule: A Bag of Words vector counts every occurrence, not mere presence, and its positions follow the shared word sequence, so a word missing from a document still takes its slot with a 0.

Math & Data Science · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.