Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3855750
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:49:26+00:00 2026-05-19T17:49:26+00:00

Give test cases for a code that finds a power of a number Guys

  • 0

Give test cases for a code that finds a power of a number

Guys this would seem to be the most easiest question to all the experienced members of this forum but i being a neophyte can only put up these many test cases.

1.Check both values are inputted correctly or not.

2.Check for trivial case when x=0 then for any value of n it should return 0.

3.when n=0 it should always return 1 whatever x be.

4.check for negative values of x and n.
i)If n is negative then result should be always less than or equal to x.

5.Check first for smaller values of x and n i.e for 2,2 3,4 etc.

6.Now check for larger values of n and x and see the results.

Are these test cases correct and Could anybody help me in adding more test cases.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:49:27+00:00Added an answer on May 19, 2026 at 5:49 pm

    Using Boundary Value Analysis, I would test a combination of following x and n values (asuming the inputs are integers).

    • x: Low(Integer), -3, -1, 0, 1, 3, High(Integer)
    • n: Low(Integer), -3, -1, 0, 1, 3, High(Integer)

    Resulting in 7×7 possible combinations or 49 testcases.

    Boundary value analysis is a software
    testing technique in which tests are
    designed to include representatives of
    boundary values. Values on the edge of
    an equivalence partition or at the
    smallest value on either side of an
    edge. The values could be either input
    or output ranges of a software
    component. Since these boundaries are
    common locations for errors that
    result in software faults they are
    frequently exercised in test cases.

    Testcases

    x        n
    -1              -1
    -1              -3
    -1              0
    -1              1
    -1              3
    -1              High(Integer)
    -1              Low(Integer)
    -3              -1
    -3              -3
    -3              0
    -3              1
    -3              3
    -3              High(Integer)
    -3              Low(Integer)
    0               -1
    0               -3
    0               0
    0               1
    0               3
    0               High(Integer)
    0               Low(Integer)
    1               -1
    1               -3
    1               0
    1               1
    1               3
    1               High(Integer)
    1               Low(Integer)
    3               -1
    3               -3
    3               0
    3               1
    3               3
    3               High(Integer)
    3               Low(Integer)
    High(Integer)   -1
    High(Integer)   -3
    High(Integer)   0
    High(Integer)   1
    High(Integer)   3
    High(Integer)   High(Integer)
    High(Integer)   Low(Integer)
    Low(Integer)    -1
    Low(Integer)    -3
    Low(Integer)    0
    Low(Integer)    1
    Low(Integer)    3
    Low(Integer)    High(Integer)
    Low(Integer)    Low(Integer)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This isn't so much a coding question as a how would I code question
Give a linear-time algorithm to test whether a tree has a perfect matching, that
I'm trying to write a unit test for a module that will give me
This question might be a bit sketchy because I do not have the code
Give a base class Base , I want to write a method Test, like
I just had a test on java and we had to give the definition
During hiring a .NET web developer I give the candidate a coding test. I
Both in Actionscript3 and Javascript these statements give the same result: /\S/.test(null) => true
i have redhat with gcc 4.1.1 i have compile as gcc test.c and give
Possible Duplicate: How to test the performance of an Android application? The test cases

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.