in IS&Software Engineering retagged by
944 views
0 votes
0 votes
void swap(float* A1, float* A2)
{
    float temp;
    if (*A1 = = *A2) return;
    temp = *A1;
    *A1 = *A2;
    *A2 = temp;
    return;
}

The program volume for the above module using Halstead's method is

  1. 60
  2. 63
  3. 66
  4. 69
in IS&Software Engineering retagged by
944 views

1 Answer

3 votes
3 votes
Operator Frequency
if 1
* 6
== 1
return 2
= 3

Number of unique operators (n1) = 5

Number of operators (N1) = 13

Operand Frequency
temp 2
A1 3
A2 3

Number of unique operands (n2) = 3

Number of operands (N2) = 8
 

N = N1+N2 = 8 + 13 = 21

n = n1+n2 = 5 + 3 = 8

Program Volume (V) = N log2 n

= 21 log28

= 21*3 = 63

[float, ; and () are not considered as operators here while many places they are also considered]

by

3 Comments

why float, ; and () are not considered ??? and what other operator should i not consider ??

1
1

Even I have no idea. See the below slide by NPTEL- go to last page and there is an example given. In it float, ;, () and {} are all considered as operators- even "" "" also. But if we do that here, we won't be getting any answer in option. 

http://nptel.ac.in/courses/106105087/pdf/m11L27.pdf

0
0
sir,

* is a unique operator here but number of * here are 6.

why you took 6 ?
0
0
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true