Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
1K views19 pages

50 ISTQB Sample Problems & Solutions

The document contains 23 sample problems related to software testing techniques like equivalence partitioning, boundary value analysis, decision coverage, statement coverage, and cyclomatic complexity. The problems provide code snippets or logic diagrams and ask testers to identify the number of test cases needed to achieve various coverage criteria or to select appropriate test input values based on the given requirements and constraints.

Uploaded by

Irma Infante
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views19 pages

50 ISTQB Sample Problems & Solutions

The document contains 23 sample problems related to software testing techniques like equivalence partitioning, boundary value analysis, decision coverage, statement coverage, and cyclomatic complexity. The problems provide code snippets or logic diagrams and ask testers to identify the number of test cases needed to achieve various coverage criteria or to select appropriate test input values based on the given requirements and constraints.

Uploaded by

Irma Infante
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

50 Sample ISTQB Problems

 
1. If the temperature falls below 18 degrees, the heating is switched ON. When the
temperature reaches 21 degrees, the heating is switched OFF. What is the minimum
set of test input values to cover all valid equivalence partitions?
                          
1. 15, 19, 25
2. 17, 18, 20
3. 18, 20, 22
4. 16, 26,0
                         
    2.   For the following program, how many test cases are needed to achieve 100% decision
coverage?    
                 If (p=q)
                   {
                       s=s+1;
                        If (s<5)
                           {
                                t=10;
                             }
                     }
               Else if (p>q)
                          {
                                t=5;
                            }
    
a.       3
b.      6
c.       5
d.      4
 
 
3.   Assume postal rates for ‘light letters’ are :
$0.25 up to 10g;
$0.35 up to 50g;
$0.45 up to 75g;
$0.55 up to 100g.
Which test inputs (in grams) would be selected using boundary value analysis?
 
a)      0, 9 , 19, 49, 50, 74, 75, 99, 100
b)      10, 50, 75, 100, 250, 1000
c)      0, 1, 10, 11, 50, 51, 75, 76, 100, 101
d)     25, 26, 36, 36, 45, 46, 55, 56
 
 
4.  Look at the following figure:
 
 
 Three tests have been run:
Test 1: Gold card holder who gets upgrade to business class.
Test 2: Non-gold card holder who stays in economy.
Test 3: A person who is bumped from the flight.
 
What is the statement coverage of these three tests?
a.       60%
b.      70%
c.       80%
d.      90%
 
 
5.  An employee has $4000 of salary tax free. The next $1500 is taxed at 10%. The
       next $28000 is taxed at 22%. Any further amount is taxed at 40%.
Which of these groups of numbers will fall in the same equivalence class?
 
 
 
 
Answers:
a)      $4800, $14000, $28000
b)      $5200, $5500, $28000
c)      $28001, $32000, $35000
d)     $5800, $28000, $32000.
 
 
6.  For the state diagram shown, which test cases below covers every valid
                 transition?
 
 
 
 
            a)      SS- S1- S2- S4- S1- S3- ES
b)      SS- S1- S2- S3- S4- S3- S4- ES
c)      SS- S1- S2- S4- S1- S3- S4- S1- S3- ES
d)     SS- S1- S4- S2- S1- S3- ES
 
 
7.  How many test cases are needed to achieve 100% statement coverage?
 
If ((temp<0) or (temp>100))
   {
        Alert (“Danger”);  
         If ((speed>100) and (load<=50)
            {
                Speed = 50;
              }
     }
Else
       {
          Check = false;
      }
 
a)      5
b)      4
c)      2
d)     3
 
 
8. Which set of test data demonstrates equivalence partitioning to check whether a
        customer is teenager or not?
     
a)      10,15,19
b)      13,19,25
c)      13,16,19
d)     8,17,26
 
 
9. Based on the error guessing test design technique, which of the following will an
       tester MOST LIKELY test in calendar software?
 
i.                    First two letters of the month, e.g. MA can represent March or
May.
ii.                  First letter of the day, e.g. T can mean Tuesday or Thursday.
iii.                Leap year.
iv.                Number of days of the month.
v.                  Three-digit days and months.
 
a)      i, ii, iv, v
b)      iii, iv
c)      i, ii, iii, iv
d)     i, ii, v
 
10. For the state transition diagram shown below, which test suite will check for an 
      invalid transition?
 

 
 
a)      S0- S1- S2- S3- S1- S4
b)      S0- S1- S4- S1- S2- S3
c)      S0- S1- S3- S1- S2- S1
d)     S0- S1- S2- S3- S1- S2
 
 
11.  An input field takes the year of birth between 1900 and 2004. Which set of test cases
demonstrates three –value Boundary value analysis?
 
a)      0, 1900, 2004, 2005, 1903, 1904
b)      1900,2008,2009,2010,1901, 2005
c)      1899, 1900, 2004, 2005, 2006, 2007
d)     1899, 1900, 1901, 2003, 2004, 2005
 
12. For the program below, the cyclomatic complexity will be:
 
         If z >x
         Then statement 1;
         Else if x>=y
         Then statement 2;
          End
 
a)      3
b)      2
c)      4
d)     5
 
 
13.  One of the fields in a customer online form accepts the numeric values between
       18 and 25. Amongst the options given, identify the invalid equivalence class.
 
a)      17
b)      19
c)      20
d)     21
 
 
14. Order numbers on a stock system can range from 10000 to 99999. What are the test
       inputs for valid equivalence class and valid boundary value analysis?
 
a)      9999,50000,100000
b)      10000, 99999, 100000
c)      1000, 50000, 99999
d)     10000, 50000, 99999
 
 
15. One of the fields on a form accepts alphabets in lower and upper case. Identify the    
      invalid equivalence class value.
 
a)      CLASS
b)      Class
c)      cLAsS
d)     cl0sS
 
16. In the following program, how many minimum test cases are required for 100%?
          statement coverage and 100% branch coverage?
 
           READ A
           READ B
           IF A+B >100
           THEN PRINT “LARGE”
            ENDIF
            IF A > 50
            THEN PRINT “P LARGE”
             ENDIF
 
 
a)      Statement coverage 2, branch coverage 2.
b)      Statement coverage 1, branch coverage 3.
c)      Statement coverage 1, branch coverage 2.
d)     Statement coverage 4, branch coverage 2.
 
 
17. For the program below, how many test cases are required in order to achieve 100%
statement coverage and 100% branch coverage?
 
If a = 2 then
Display_message x;
If b = 5 then
Display_message y;
Else
Display_message z;
Else
Display message z;
 
a)      Statement coverage 4, branch coverage 3.
b)      Statement coverage 2, branch coverage 3.
c)      Statement coverage 3, branch coverage 3.
d)     Statement coverage 3, branch coverage 2.
 
 
18. A program selects the values in the range 10 and 21. Rest all values are rejected.
          Which of the following covers all of the boundary values?
 
a)      9,10,21,22
b)      10,11,21,22
c)      9,11,15,25
d)     8, 10, 19, 21
 
 
 
19.     Using the same data as in Example 20, determine the test input values that cover
           all of the equivalence classes.
 
a)      8,15,22
b)      9, 10, 11
c)      10, 21,26
d)     3, 10, 21
 
 
20.  A person’s age must be between 1 and 99. Identify the test inputs that cover all 
           boundary values.
 
a)      0, 1, 99, 100
b)      0, 3, 99, 104
c)      1, 4, 78, 99
d)     1, 99, 100, 98.
 
 
21. Calculate the cyclomatic complexity for the program below:
          If A =200
          THEN
             IF B >C
             THEN
                            A=B
                        ELSE    A=C
                        ENDIF
            ENDIF 
 
a)      3
b)      4
c)      2
d)     1
 
22.    Consider the following scenario:
Pick up and read the newspaper. Look at what is on the television. If there is a
program you are interested in then watch the program. Otherwise continue reading the
newspaper. If there is crossword in the newspaper then complete the crossword.
What are the minimum number of test cases required to achieve 100 % statement
coverage (SC) and 100% decision coverage (BC).
 
 
a)      SC = 1 , DC = 2
b)      SC = 1, DC = 1
c)      SC = 1 , DC = 3
d)     SC = 2, DC = 2
e)      SC = 2 , DC = 3
f)       SC = 3 , DC = 3
 
 
 
 
 
 
 
 
23. For the program below, calculate the test cases needed to achieve 100% branch
          coverage? 
 
          If (a > b)        
              {
                 a = a +1;
                }
         Else b = b + 1;
        
          While (a > b)
                    {
                         y= x * y;
                          x= x + 1;
                      }
                 
  
a)      4
b)      3
c)      2
d)     1
 
24. For a 40 questions examination, a candidate should score minimum of 25 marks for
      passing and need a minimum of 32 marks to get distinction. The maximum he can  
      score is 40.   What are the test inputs that fall under the same equivalence class?
 
a)      24, 32, 33
b)      20, 27, 33
c)      25, 32, 20
d)     32, 37, 40
 
 
25. Which set of test data demonstrates three- value boundary values to check whether a
        customer is teenager or not?
 
a)      12,13,14,18,19,20
b)      12 ,13, 19, 20, 24
c)      10, 11, 13, 20, 21
d)     12, 13, 14, 15, 20
 
 
26. If you are less than 18, then you are too young to get insured. If your age is between
      18 and 30 then, you will receive a 20% discount. Anyone, above 30 is not eligible for
      the discount. Which of the following test inputs cover all the equivalence classes?
 
a)      19,18, 30
b)      16, 18, 28
c)      15, 27, 32
d)     17, 31, 35
 
 
27. One of the fields on a form accepts the ‘username’ as an alphanumeric value.
       Identify the test inputs that cover valid Equivalence class.
 
a)      BlAnKet
b)      Blanket
c)      BlaNkEt
d)     Bla07et
 
 
28. How many test cases are needed to achieve 100% condition coverage?
 
If ((temp<0) or (temp>100))
   {
        Alert (“Danger”);  
         If ((speed>100) and (load<=50)
            {
                Speed = 50;
              }
     }
Else
       {
          Check = false;
      }
 
 
a)      4
b)      3
c)      5
d)     2
 
29. Using the state diagram below, which test suite will uncover invalid state
      transition for the employee status reporting software?
 
 

 
 
a)      S1- S2- S5- S2- S3- S7
b)      S1- S2- S4- S2- S5- S6
c)      S1- S2- S6- S2- S4- S7
d)     S1- S2- S4- S2- S6- S-2
 
 
30. For the program below, the cyclomatic complexity will be:
               
                  If (age <30)
                    {
                        Display_message “you are too young”;
                      }
                 Else if (30<=age <=100)
                            {
                                Display_message “you are old”;
                              }
                 Else
                       {
                            Display_message “you are too old”; 
                        }
 
a)      3
b)      4
c)      5
d)     2
 
31. An employee has £4000 of salary tax free. The next £1500 is taxed at 10%
The next £28000 is taxed at 22%
Any further amount is taxed at 40%
To the nearest whole pound, which of these is a valid Boundary Value Analysis test case?
a)       £1500
b)       £32001
c)       £33501
d)       £28000
 
 
32.    For the program below, how many minimum test cases are needed to achieve
100% statement coverage (SC) and 100% branch coverage (BC)?
 
             IF A > B THEN
             C = A – B
             ELSE
             C = A + B
             ENDIF
             Read D
             IF C = D Then
             Print "Error"
             ENDIF
 
 
a)      1 test for statement coverage, 3 for branch coverage
b)       2 tests for statement coverage, 2 for branch coverage
c)       2 tests for statement coverage. 3 for branch coverage
d)      3 tests for statement coverage, 3 for branch coverage
e)       3 tests for statement coverage, 2 for branch coverage
 
 
33.    For the program below, the cyclomatic complexity will be:
 

 
a)      2
b)      3
c)      4
d)     1
 
 
 
34.    For the program below, how many test cases are needed to achieve 100%
statement coverage?
 
                  If fuel tank is empty
                        If petrol engine
                             Fill the tank with petrol
                        Else
                            Fill the tank with petrol
                        Endif
                  Else
                  Endif
 
 
a)      2
b)      4
c)      3
d)     1
 
 
35.    If you take the train before 9:30 am or in the afternoon after 4:00 pm until 7:30
pm, you must pay full fare. A saver ticket is available for trains between 9:30 am and
4:00 pm and after 7:30 pm. What are the test inputs that cover all the valid and
invalid boundary values?
 
a)      9:29 am , 9:30 am, 4:00 pm, 4:01 pm, 7:30 pm , 7:31 pm
b)      7:00 am, 9:30 am, 9:31 am, 4:00 pm, 7:00 pm , 7:35 pm
c)      9:30 am, 9:31 am, 9:32 am, 7:30 pm, 7:31 pm, 7:32 am
d)     4:00 pm , 7:00 pm, 4:01 pm, 7:30 pm, 8:00 am, 8:00 pm
 
 
36.    Postal rates for ‘light letters’ are 30p up to 20g, 40p up to 50g plus an extra 30p
for each additional 20g up to 110g. Which test inputs would be selected using
equivalence partitioning?
 
a)      4, 24, 58, 79, 100, 158
b)      5, 51, 57, 74, 90, 110
c)      21, 22, 50, 51, 90, 91
d)     1, 91, 110, 111, 20, 90
 
 
 
 
 
 
37.    Consider the following decision table :
 
Conditions Rule 1 Rule2 Rule 3 Rule 4
Over 25? F T T T
Clean driving X F T T
record?
 
On business X X F T
trip?
Actions        
Supply car F F T T
rental
Premium F F F T
charge
 
Given this decision table for car rental, what is the expected result for the following test
cases?
 
Test 1: A 30-year old tourist with bad driving record
Test 2: A 20-year old tourist with clean driving record.
Test 3:  A 50-year old on business and with a clean driving record.
 
 
a)      Test 1: Don’t supply car; Test 2: Supply car with premium charge;
             Test 3: Supply car with premium charge.
b)      Test 1: Don’t supply a car; Test 2: Don’t supply a car Test 3: Supply a car with
premium charge.
c)      Test 1: Supply a car with no premium charge; Test 2: Supply a car with a
premium charge; Teat 3: Supply a car with no premium charge.
d)     Test 1: Don’t supply a car; Test2: Supply a car with no premium charge;
            Test 3: Don’t supply a car.
 
 
38.    For the program below, how many test cases are needed to achieve 100%
statement (SC) and 100% decision coverage (DC)?
 
                    If X > Y
                       If X > Z
                          Add X to A
                       Else
                           Add X to B
                        Endif
                   Else
                        Add X to C
                   Endif
           
a)      SC = 1 ; DC = 3
b)      SC = 2 ; DC = 2
c)      SC = 3 ; DC = 3
d)     SC = 3 ; DC = 2
 
 
39.    The number of links/edges in a graph are 8, the number of nodes are 7, and the
       number of disconnected parts of the graph is none. From the information given,  
      Calculate the cyclomatic complexity.
 
a)      4
b)      5
c)      3
d)     2
 
                        
 
40.    Consider the following decision table.
 
Conditions Rule1 Rule2 Rule3
Delta sky miles T T F
member?
Silver/gold/platinu T F F
m medallion?
Actions      
Offer upgrade Y N N
Offer Free snacks Y Y N
Offer Y N N
complimentary
lunch/dinner?
                
Given this decision table, what is the expected result for the following test cases?
TC 1: A sky mile platinum member.
TC2: A sky mile member with no silver/gold/platinum status
TC3: A non-sky mile member  
 
a)      TC1 : offer upgrade, offer free snacks and a free lunch/dinner ;
            TC2: Don’t offer upgrade, offer free snacks, don’t offer free
                     Lunch/dinner;
TC3: Don’t offer upgrade, free snacks and free lunch/dinner.
 
b)       TC1 : Don’t offer upgrade, offer free snacks and a free lunch/dinner ;
            TC2: Don’t offer upgrade, offer free snacks, don’t offer free
                     Lunch/dinner;
TC3 Offer upgrade, free snacks and don’t offer free lunch/dinner.
 
c)        TC1 : Offer upgrade, don’t free snacks and a free lunch/dinner ;
              TC2: Don’t offer upgrade, don’t offer free snacks, offer free
                     Lunch/dinner;
TC3: Don’t offer upgrade, free snacks and free lunch/dinner.
 
d)     TC1 :  Don’t offer upgrade, offer free snacks and a free lunch/dinner ;
            TC2: Don’t offer upgrade, offer free snacks, and offer free
                     Lunch/dinner;
TC3: Offer upgrade, free snacks and free lunch/dinner.
 
 
41.    For the program below, calculate the number of test cases required to achieve
100% statement (SC) and decision coverage (DC)?
 
                If age<18
                   Display_message ‘You are not eligible for getting the permanent license’
                Else
                   Display_message ‘You are eligible for getting permanent license’
                Endif
 
a)      SC = 1 ; DC = 2
b)      SC = 2 ; DC = 1
c)      SC = 2 ; DC = 2
d)     SC = 1 ; DC = 1
 
 
 
42.  One of the fields in a customer online form accepts the numeric values between
      18 and 25. Amongst the options given, identify the valid equivalence and valid
       Boundary classes.
 
a)      13, 18, 25
b)      20, 18, 21
c)      20, 18, 25
d)     20, 24, 25
 
 
43. A person’s age must be between 1 and 99. Identify the test inputs that cover all the
equivalence classes.
 
a)      1, 99, 100
b)      -2, 1, 98
c)      -1, 87, 110
d)     -10, 99, 98
 
 
44. For a 50 questions examination, a candidate should score minimum of 30 marks for
passing and need a minimum of 45 marks to get distinction. The maximum he can score
is 50.   What are the test inputs that cover all the boundary values?
 
a)      29, 30, 44, 45
b)      30, 31, 44, 45
c)      28, 29, 45, 46
d)     30, 33, 43, 40
 
45. Consider the following decision table.
 
Conditions Rule 1 Rule 2 Rule 3 Rule 4
US Resident? F T T T
Age between X T F T
18 and 60
Married? X T X F
Actions        
Issue N Y N Y
membership
Offer 10% N N N Y
discount
 
Given this decision table, what is the expected result for the following test
cases?
TC1: A 35-year old married man staying in Chicago, US
TC2: A 62-year old married woman and staying in Mumbai, India
TC3: A 30-year old bachelor residing in Atlanta, US.
 
a)      TC1: issue membership and offer 10% discount;
            TC2: don’t issue membership and offer 10% discount;
           TC3: don’t offer membership and 10% discount as well.
 
b)      TC1: issue membership but, don’t offer 10% discount;
TC2: Don’t issue membership and 10% discount as well;
TC3: issue membership and 10% as well.
 
c)      TC1: issue membership but, don’t offer 10% discount;
TC2: issue membership and 10% discount; TC3: Don’t
issue membership but, may get 10% discount.
 
d)     TC1:  issue membership and 10% discount; TC2: Don’t
issue membership but, offer 10%discount; TC3: May be
issued a membership but, definitely will not get a 10%
discount.
46.    For the program below, how many test cased are needed in order to achieve
100% statement coverage?
 
                       While A >=100
                       If A <10
                      A = A ^2
                      Endif
                      A ++
                      Endwhile    
 
a)      1
b)      3
c)      2
d)     4
 
 
47.    For the program below, calculate the number of test cases needed to achieve
100% statement (SC) and 100% decision coverage (DC).
 
                           Do
                                If X <10
                                X = X *4
                                Endif
                                X = X +1
                          Until X >40  
 
a)      SC = 1 ; DC = 1
b)      SC = 2 ; DC = 2
c)      SC = 1; DC = 2
d)     SC = 2 ; DC = 1
 
 
48.    A savings account in a bank earns a different rate of interest depending upon the
      balance in the account.  A balance in the range between $0.00 and $100.00 has   
      3% interest rate, a balance over $100.00 and up to $1000.00 has a 5% interest   
      rate, and all balance above $1000.00 gets an 8% interest rate. Determine the test
      inputs that cover all the valid and invalid equivalence classes.
 
a)      -$3.00, $89.00, $988.00, $1010.00
b)      -$1.00, $0.00, $100.00, $101.00
c)      $10.00, $100.00, $1000.00, $999.00
                               d)     $1000.00, $999.00, $10.00, -$2.00 
 
 
 
49.    In the Example 48, determine the test inputs that cover all the boundary
values?
 
a)      $0.00, $1.00, $100.00, $102.00, $103.00, $1001.00
b)      -$1.00, $0.00, $100.00, $101.00, $1000.00, $1001.00
c)      -$2.00, $0.00, $1.00, $100.00, $101.00, $102.00, $1000.00
d)     -$10.00, $0.00, $99.00, $102.00, $999.00, $1000.00
 
 
50.    From the flowchart below, calculate the cyclomatic complexity.          
 

 
 
 
 
a)      1
b)      2
c)      3
d)     4
 
 
 
 
51.    Postal rates for “light letters” are 25p up to 10g, 35p up to 50g plus an extra
10p for each additional 25g up to 100g. Which test inputs (in grams) would be
selected using equivalence partitioning?              
                 
a)      8, 42, 82, 102
b)      4, 15, 65, 92, 159
c)      10, 50, 75, 100
d)     5, 20, 40, 60, 80
 
 
52.    Analyze the following  procedure:
 
       System: “What type of ticket do you require, single or return?”
                         IF the customer wants ‘return’
       System: “What rate, Standard or Cheap-day?”
                  IF the customer replies ‘Cheap-day’
       System: “The cheap-day rate is $11:20”
                        ELSE
        System: “The standard rate is $19:50”
                         ENDIF
                        ELSE
        System: “One way ticket rate is $9:75”
                         ENDIF
 
            Now decide the minimum number of tests that are needed to ensure that all the 
            questions have been asked, all combinations have occurred and all
            Replies given.
              
                          a) 3
                          b) 4
                          c) 5
                          d) 6
 
 
 
 
Answers:
 
Question Answer Question Answer
Number Number
1 a 27 d
2 d 28 c
3 c 29 b
4 c 30 a
5 d 31 c
6 c 32 b
7 c 33 b
8 d 34 c
9 c 35 a
10 c 36 a
11 d 37 b
12 a 38 c
13 a 39 c
14 d 40 a
15 d 41 c
16 b 42 c
17 c 43 c
18 a 44 a
19 a 45 b
20 a 46 a
21 a 47 a
22 e 48 a
23 c 49 b
24 d 50 b
25 a 51 b
26 c 52 a
 
 

You might also like