Program on java functional testing

Assignment Help JAVA Programming
Reference no: EM13820079

Java functional testing

A. Java/C++/C#/C

//ASSUMPTION: the array input is sorted. Ex: int[] input={1,3,4} or int[]={2,3,3,4,5,5,5,6}, etc.

public class MyArrayProcessing {

public static int[] whatAmIdoing(int[] input){

int j = 0;
int i = 1;

if(input.length < 2){
return input;
}
while(i < input.length){
if(input[i] == input[j]){
i++;
}else{
input[++j] = input[i++];
}
}
int[] output = new int[j+1];
for(int k=0; k<output.length; k++){
output[k] = input[k];
}

return output;
}


1. Q: What is the "whatAmIdoing" method doing (input is assumed to be sorted)?

2. Q: How would you test "whatAmIDoing?" What specific functional test cases would you try?

3. Q: Implement 2 test cases from 2) in the language/scripting of your choice.




B. Java/C++/C#/C

//The reverseList method reverses a singly linked list of Node(s). For example: head -> 1 -> 5 -> 3 -> null
// should become head -> 3 -> 5 -> 1 -> null. But reverseList has a defect, and does not reverse a list properly.

public class Node{
public int data;
public Node next;
public Node(int data, Node next){
this.data = data;
this.next = next;
}
}

public class MyReverseList {
public Node reverseList (Node head)
{
if (head == NULL || head.next == NULL)
return;

Node Scnd = head.next;
Node Thrd = Scnd.next;
Scnd.next = head;
head.next = NULL;

if (Thrd == NULL)
return;

Node Crrnt = Thrd;
Node Prvus = Scnd;

while (Crrnt != NULL)
{
Node Next = Crrnt.next;
Currnt.next = Prvus;
Prvus = Crrnt;
Crrnt = Next;
}
}
}


1. Q: Please correct the defect in reverseList so it reverses a linked-list correctly.

2. Q: How would you test reverseList? What specific functional test cases would you try?

3. Q: Implement 2 test cases from 2) in the language/scripting of your choice.

Reference no: EM13820079

Questions Cloud

Discuss how an individual can use effective communication : Discuss how an individual can use effective communication techniques to overcome workplace challenges, encourage collaboration across groups, and promote effective problem solving.
Focus on how added value can be reflected in the pricing : Research how value is created in products and services. Focus on how added value can be reflected in the pricing
Analysis of the two capital investment alternatives : As a financial analyst at Glencolin International (GI) you have been asked to revisit your analysis of the two capital investment alternatives submitted by the production department of the firm. (Detailed discussion of these alternatives is in the..
What role does customer relationship management play : What role, if any, does customer relationship management play when dealing with difficult buyers like Mr. Logan? Should Marilyn do like most salespeople who "win" orders from Mr. Logan-simply cut back on product quality?
Program on java functional testing : Java functional testing
Legal questions that may be asked during the interview : Prepare an advertisement for that position that complies with federal law. Prepare 10 illegal questions that must not be asked. For each question, be sure to justify your reasoning. Prepare 10 legal questions that may be asked during the interview. F..
Compare two major competitors in the same industry : You are the assistant to the CEO of a major company. Your CEO keeps an eye on the competition, and asks you to do the following. Using ratio analysis, compare two major competitors in the same industry.
Create a business plan for a fictitious : Based on the information we have discussed in class and the research you have done, create a business plan for a fictitious "for profit" company or Franchise
What action would be necessary to prevent a cave-in : Describe four key elements with process and the safety significance of the professional engineering - Review the OSHA Standard Interpretations for Crane Operator Qualification, and include your thoughts for operator testing.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd