Question

In: Computer Science

Select any static source code analysis tool. Utilizing your Selection Sort code introduce three different data...

Select any static source code analysis tool. Utilizing your Selection Sort code introduce three different data flow anomalies typically caught by a static analysis tool. Execute the tool on your code. Please submit the following:

  1. description of the tool used and the types of analysis it provides
  2. source listing of your code
  3. a printout or screen shot showing the analysis performed
  4. your evaluation of the tool’s usefulness

THE CODE FOR THE SELECTION SORT ALGORITHM IN C# IS BELOW

using System;

namespace SelectionSortAlgorithm
{
public class SelectionSort
{
//sortData method
public static void sortData(int[] dataSet)
{
//variable declaration / used in sorting the array
int sortedElements, lowestValue;

//After every iteration, the unsorted array reduces by 1 element, then iterates
for (int i = 0; i < dataSet.Length - 1; i++)
{
//initialize variable / used for lowest value element in loop
lowestValue = i;
//As array is being sorted, add 1 element to sorted array
for (int j = i + 1; j < dataSet.Length; j++)
{
if (dataSet[j] < dataSet[lowestValue])
{
//initialized variable for lowest value of element in sorted array
lowestValue = j;
}
}
//The sortedElements are equal to the data set sorted starting with lowest value elements
sortedElements = dataSet[lowestValue];
//The data set sorted with lowest value first is equal to sorted data set
dataSet[lowestValue] = dataSet[i];
//Sorted data set is equal to all sorted elements {2, 3, 27, 68, 99}
dataSet[i] = sortedElements;
}
}
//main method
public static void Main(string[] args)
{
//unsorted array
int[] dataSet = new int[5] { 2, 99, 27, 68, 3 };

//sortData method called for sorting the above unsorted array
sortData(dataSet);

//iterating the sorted array
for (int i = 0; i < dataSet.Length; i++)
{
//writing the sorted array to the console
Console.WriteLine(dataSet[i]);
}
}//end method

}//end class

}//end program

Solutions

Expert Solution

The Best Static Source Code Analysis Tool For C# : -

SonarSource delivers what is probably the best static code analyzer you can find on the market for C#. Based on Microsoft Roslyn compiler front-end, it uses the most advanced techniques (pattern matching, dataflow analysis) to analyze code and find code smells, bugs and security vulnerabilities. It was built on the following principles: depth, accuracy and speed.

SonarC# has a great coverage of well-established quality standards. The SonarC# capability is available in Visual Studio for developers (SonarLint) as well as throughout the development chain for automated code review with self-hosted SonarQube or on-line SonarCloud.

Samples of Issues Detected : -

1.Always false condition

2.Dead store

3.Dereference of null pointer

4.I/O function call injection

#NOTE: - Hope You Get Knowlegde About Static Source Code Analysis Tool For C#...These Are Samples Provided By, You Can Also Run Your Code On This Open Source Platform And See What Are The Anamolies Your Code Is Facing.....Happy Coading : - )


Related Solutions

In this project you will implement and experiment with three different sorting algorithms: Insertion Sort, Selection...
In this project you will implement and experiment with three different sorting algorithms: Insertion Sort, Selection sort and Bubble Sort. The objective of this project is to understand the relation between the theoretical asymptotic complexities (Big-O) computed in class and the actual running times for different kinds of input. The enclosed source file main.cpp contains a program that reads two inputs: a letter specifying which sorting algorithm to use (I for InsertionSort , S for SelectionSort and B for BubbleSort),...
Code: C++ Write a very general sort method that can sort any type of data arrays/lists....
Code: C++ Write a very general sort method that can sort any type of data arrays/lists. For example, can sort a list of integers in ascending order, a list of integers in descending order, a list of doubles, a list of student objects (with names and scores) in ascending order of names, or in descending order of scores, … You can use any pre-defined sort function or can code your own. Use your favorite language for implementation. If your language...
In the selection process, a right-holder can apply three different ways to select an organizer: please...
In the selection process, a right-holder can apply three different ways to select an organizer: please list and briefly explain them.
Install the Analysis Tool Pak on your computer. Find any dataset online in the public domain....
Install the Analysis Tool Pak on your computer. Find any dataset online in the public domain. Copy around 15-20 into Excel, and then create a randomized data set. Paste it here.
Install the Analysis Tool Pak on your computer. Find any dataset online in the public domain....
Install the Analysis Tool Pak on your computer. Find any dataset online in the public domain. Copy around 15-20 into Excel, and then create a randomized data set. Paste it here. A Gallup pool indicated that 29% of Americans spent more money in recent months than they used to. But the majority (58%) still said they enjoy saving money more than spending it. The results are based on telephone interviews conducted in April with a random sample of 1,016 adults,...
Define a class template called genericStack for storing any data type in a static stack. Your...
Define a class template called genericStack for storing any data type in a static stack. Your class template must include a constructor, a destructor, push, pop, peek, isFull, and isEmpty functions (no display function is required). Write a simple main function in your program that demonstrates the class template with a stack of strings.
Select any two nurse theorists of your choice with different views about theory. Assess the following...
Select any two nurse theorists of your choice with different views about theory. Assess the following in your presentation: 1) Describe an overview of each theorist’s theory. 2) Compare and contrast the areas of similarity, and of greatest difference between the theorists. 3) Compare the impact that each theorist/theory has had on nursing. 4) Describe how these theories are currently be used in practice and whether on theory is utilized more and why, 5) Identify two questions that you would...
a) Reflect on at least three different new techniques or tools from Data Analysis and Business...
a) Reflect on at least three different new techniques or tools from Data Analysis and Business Analytics course that you could use in the future. b)Describe each one and how they could be practically implemented or used.
Writing Project #1 Select a claim about any topic of your choice and provide three reasons...
Writing Project #1 Select a claim about any topic of your choice and provide three reasons for that claim. After presenting your argument in a narrative way, reconstruct it at the end of your work by clearly indicating its premises and conclusion with numbers and a conclusion indicator. The conditions for receiving points for this work are as follows: The Writing Project has a main claim about a topic of the student’s choice and provides three reasons for that claim....
The kinesiological analysis of any MULTI JOINT (involving different muscle groups) MOVEMENT. Skill: describe three components...
The kinesiological analysis of any MULTI JOINT (involving different muscle groups) MOVEMENT. Skill: describe three components IN DETAIL (i.e. prep phase, action phase, and Follow-through phase) Be sure to classify as simultaneous or sequential* IN DETAIL Anatomical/performance factors: Describe Five to six components IN DETAIL(at least THREE-FOUR joints should be considered). This includes the analysis of how joints, muscles, and neuromuscular mechanisms work to create movement IN DETAIL. Potential injuries: describe a minimum of three components IN DETAIL. This includes...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT