Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (2 votes)
673 views

Assignments On Halstead'S Software Science

The document contains 5 assignments related to calculating software metrics using Halstead's technique: 1. Calculate metrics for a program with given operator and operand counts. 2. Estimate length and volume for a GCD calculation program. 3. Calculate all metrics for a sorting program. 4. Calculate all metrics for a binary search program. 5. Develop a program to automatically calculate all Halstead metrics for a given program.

Uploaded by

Amelia Lexton
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (2 votes)
673 views

Assignments On Halstead'S Software Science

The document contains 5 assignments related to calculating software metrics using Halstead's technique: 1. Calculate metrics for a program with given operator and operand counts. 2. Estimate length and volume for a GCD calculation program. 3. Calculate all metrics for a sorting program. 4. Calculate all metrics for a binary search program. 5. Develop a program to automatically calculate all Halstead metrics for a given program.

Uploaded by

Amelia Lexton
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

ASSIGNMENTS ON HALSTEAD'S SOFTWARE

SCIENCE
1. Suppose in a program, the total number of operators is 50, the
total number of operands is 30, the total number of unique
operators is 17, and the total number of unique operands is 7.
Calculate the estimated length, program volume, program level,
programming effort, and programmers time using Halstead's
technique.
2. For the following C program, estimate the Halstead's length and volume measures.
/* Program to calculate GCD of two numbers */

int compute gcd(int x,int y){

while(x!=y){

if(x<y) then

x=x-y;
else

y=y-x;

}
return x;

3. Calculate the estimated length, program volume, program level,


programming effort, and programmers time using Halstead's
technique for the following C program.

void sort ( int *a, int n ) {

int i, j, t;

if ( n < 2 )

return;

for ( i=0 ; i<n-1; i++ ){

for ( j=i+1 ; j< n ; j++ ){

if ( a[i] > a[j] ){

t=a[i];

a[i] =a[j];

a[j] = t;

}
4. Calculate the estimated length, program volume, program level, programming effort, and programmer’s
time using Halstead' technique for the following C program.

int BinSearch (char *item, char *table[], int n){

int bot = 0;

int top = n - 1;

int mid, cmp;

while (bot <= top) {

mid = (bot + top) / 2;

if (table[mid] == item)

return mid;

else if (compare(table[mid], item) < 0)

top = mid - 1;

else

bot = mid + 1;

return -1; // not found

5. Write a program in Java/Python/C# to implement Halstead's technique for calculating the estimated
length, program volume, program level, programming effort, and programmer’s time for a given program.

You might also like