CS FundamentalsVery hardProduct company interview · GATE level

A program has 12 distinct operators, 20 distinct operands, 90 total operator occurrences and 70 total operand occurrences. Using Halstead's measures (volume V = N x log2 n, difficulty D = (n1/2) x (N2/n2), effort E = D x V), what are V, D and E?

  1. A. V = 800, D = 21, E = 16,800
  2. B. V = 800, D = 27, E = 21,600
  3. C. V = 640, D = 21, E = 13,440
  4. D. V = 160, D = 21, E = 3,360

Correct answer: A. V = 800, D = 21, E = 16,800

Vocabulary n = 12 + 20 = 32 and length N = 90 + 70 = 160, so V = 160 x log2 32 = 160 x 5 = 800 bits. D = (12/2) x (70/20) = 6 x 3.5 = 21. E = 21 x 800 = 16,800. Using N1 instead of N2 in the difficulty gives (12/2) x (90/20) = 27; 640 would need a vocabulary of 16 (log2 16 = 4); 160 is just the length.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic