TEST CASES – Remove All Nodes With Even Values

0
760

TEST TO REMOVE ALL NODES WITH EVEN VALUES

Given a function as “removeAllNodesWithEvenValues” to remove all nodes with even values

Provide a set of test cases to test this function.

Function Signature : BOOL removeAllNodesWithEvenValues(node ** llist)

llist – Head node singly linked list of integers

BOOL – enum BOOL {TRUE,FALSE};

node – typedef struct node{ int data; node *next} *pnode;

Interviewer would like to observe interviewee’s approach while deducing the test cases of a sample problem.

Sample answer from a professional point of view

TEST ENVIRONMENT

API Name: BOOL removeAllNodesWithEvenValues(node ** llist)

OS: Windows-Vista

Target Platform: MachineX86 (/MACHINE: X86)/32-bit

Language Used: C Language/ Visual C++ 2005 (Compiler)

Integers range on 32 bit machine: 2147483647 to -2147483648

 

TEST CASES

<Error Test Cases>

PARAMETER CHECKS

INPUT     : Passing head node of the linked as NULL

Expected OUTPUT: Function should print the message:” Invalid Parameter” and return False as result

INPUT     : Link list with Out-of-the-range integers value e.g.( If +ive then > 2147483647 and if –ive then < -2147483648).

Expected OUTPUT: If value will be given as 2147483649, then it will be rollover to count 2 in –ive side, which will be as -2147483649

UNIT TEST CASES

Number of Node = 1

INPUT     : 1->NULL

EXPECTED OUTPUT: 1->NULL

Number of Node = 2

INPUT     : 2->4->NULL

EXPECTED OUTPUT: NULL

Number of Node = 4

INPUT     : 1->2->4->6->NULL

EXPECTED OUTPUT: 1->NULL

Number of Node = 4

INPUT     : 2->4->6->8->10->12->1->3->5->NULL

EXPECTED OUTPUT: 1->3->5->NULL

Number of Node = 6

INPUT     : 1->3->6->8->10->1->3->5->NULL

EXPECTED OUTPUT: 1-3->1->3->5->NULL

Number of Node = 4

INPUT     : 2->2->2->2->NULL

EXPECTED OUTPUT: NULL

Number of Node = 4

INPUT     : 1->1->1->1->NULL

EXPECTED OUTPUT: 1->1->1->1->NULL

 

SPECIAL TEST CASES

Automation of the test cases: run a script, which is automatically creating a link list have random number of elements (1 to n), with possible integer range, later this script showing the input linked list and output link list.

Stress Test: running the above script for certain number of hours.

Performance Test: test the performance of this API based on the given linked list (number of elements) and time require to process to remove the even values.

SHARE
Previous articleTEST CASES - Note That Is Constructed Using Words
Next articleTEST CASES : Remove The Nth Node
Since last 15 years in different geographical locations, Sumit prepared hiring format for several hiring managers/teams to hire the balanced talents and interviewed talents on the various stages of their selection process. He also interviewed by hundreds of companies in different geographical locations.His best conclusion for hiring teams and candidate is to prepare in advance. Here ‘advance’ means keep your interview book ready and continue to update it even you are not going to interview candidates or applying for any job in next six months.