50 sample istqb problems - cloud object … · web viewfor the program below, how many test cases...

25
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?

Upload: lyanh

Post on 19-Aug-2018

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

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, 252. 17, 18, 203. 18, 20, 224. 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.       3b.      6c.       5d.      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, 100b)      10, 50, 75, 100, 250, 1000c)      0, 1, 10, 11, 50, 51, 75, 76, 100, 101d)     25, 26, 36, 36, 45, 46, 55, 56  

4.  Look at the following figure:  

Page 2: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

   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, $28000b)      $5200, $5500, $28000c)      $28001, $32000, $35000d)     $5800, $28000, $32000.

  

6.  For the state diagram shown, which test cases below covers every valid                  transition?  

Page 3: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

              a)      SS- S1- S2- S4- S1- S3- ES

b)      SS- S1- S2- S3- S4- S3- S4- ESc)      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)      5b)      4c)      2d)     3

  8. Which set of test data demonstrates equivalence partitioning to check whether a         customer is teenager or not?     

a)      10,15,19b)      13,19,25c)      13,16,19d)     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?

Page 4: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

 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, vb)      iii, ivc)      i, ii, iii, ivd)     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- S4b)      S0- S1- S4- S1- S2- S3c)      S0- S1- S3- S1- S2- S1d)     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, 1904b)      1900,2008,2009,2010,1901, 2005c)      1899, 1900, 2004, 2005, 2006, 2007d)     1899, 1900, 1901, 2003, 2004, 2005

 12. For the program below, the cyclomatic complexity will be:           If z >x

Page 5: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

         Then statement 1;          Else if x>=y         Then statement 2;           End 

a)      3b)      2c)      4d)     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)      17b)      19c)      20d)     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,100000b)      10000, 99999, 100000c)      1000, 50000, 99999d)     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)      CLASSb)      Classc)      cLAsSd)     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  

Page 6: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

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 thenDisplay_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,22b)      10,11,21,22c)      9,11,15,25d)     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,22b)      9, 10, 11c)      10, 21,26d)     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, 100b)      0, 3, 99, 104c)      1, 4, 78, 99d)     1, 99, 100, 98.

Page 7: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

  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)      3b)      4c)      2d)     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 = 3d)     SC = 2, DC = 2e)      SC = 2 , DC = 3f)       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)                    {

Page 8: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

                         y= x * y;                           x= x + 1;                      }                     

a)      4b)      3c)      2d)     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, 33b)      20, 27, 33c)      25, 32, 20d)     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,20b)      12 ,13, 19, 20, 24c)      10, 11, 13, 20, 21d)     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, 30b)      16, 18, 28c)      15, 27, 32d)     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)      BlAnKetb)      Blanketc)      BlaNkEtd)     Bla07et

  28. How many test cases are needed to achieve 100% condition coverage?  

Page 9: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

If ((temp<0) or (temp>100))   {        Alert (“Danger”);            If ((speed>100) and (load<=50)            {                Speed = 50;              }     }Else        {          Check = false;      }

  

a)      4b)      3c)      5d)     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- S7b)      S1- S2- S4- S2- S5- S6c)      S1- S2- S6- S2- S4- S7d)     S1- S2- S4- S2- S6- S-2

  

Page 10: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

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)      3b)      4c)      5d)     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)       £1500b)       £32001c)       £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

 

Page 11: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

 33.    For the program below, the cyclomatic complexity will be:

 

 a)      2b)      3c)      4d)     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   

Page 12: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

a)      2b)      4c)      3d)     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 amd)     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, 158b)      5, 51, 57, 74, 90, 110c)      21, 22, 50, 51, 90, 91d)     1, 91, 110, 111, 20, 90

      

37.    Consider the following decision table :  Conditions Rule 1 Rule2 Rule 3 Rule 4Over 25? F T T TClean driving record? 

X F T T

On business trip?

X X F T

Actions        Supply car rental

F F T T

Premium charge

F F F T

 Given this decision table for car rental, what is the expected result for the following test cases? 

Page 13: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

Test 1: A 30-year old tourist with bad driving recordTest 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 = 3b)      SC = 2 ; DC = 2c)      SC = 3 ; DC = 3d)     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)      4b)      5c)      3d)     2

                           

40.    Consider the following decision table.  Conditions Rule1 Rule2 Rule3Delta sky miles member?

T T F

Page 14: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

Silver/gold/platinum medallion?

T F F

Actions      Offer upgrade Y N NOffer Free snacks Y Y NOffer complimentary lunch/dinner?

Y N N

                 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 statusTC3: 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 = 2b)      SC = 2 ; DC = 1c)      SC = 2 ; DC = 2d)     SC = 1 ; DC = 1

  

Page 15: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

 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, 25b)      20, 18, 21c)      20, 18, 25d)     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, 100b)      -2, 1, 98c)      -1, 87, 110d)     -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, 45b)      30, 31, 44, 45c)      28, 29, 45, 46d)     30, 33, 43, 40

 45. Consider the following decision table.

 Conditions Rule 1 Rule 2 Rule 3 Rule 4US Resident? F T T TAge between 18 and 60

X T F T

Married? X T X FActions        Issue membership

N Y N Y

Offer 10% discount

N N N Y

 Given this decision table, what is the expected result for the following test cases?TC1: A 35-year old married man staying in Chicago, USTC2: A 62-year old married woman and staying in Mumbai, IndiaTC3: A 30-year old bachelor residing in Atlanta, US.  

a)      TC1: issue membership and offer 10% discount;

Page 16: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

            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)      1b)      3c)      2d)     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 = 1b)      SC = 2 ; DC = 2c)      SC = 1; DC = 2d)     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   

Page 17: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

      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.00b)      -$1.00, $0.00, $100.00, $101.00c)      $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.00b)      -$1.00, $0.00, $100.00, $101.00, $1000.00, $1001.00c)      -$2.00, $0.00, $1.00, $100.00, $101.00, $102.00, $1000.00d)     -$10.00, $0.00, $99.00, $102.00, $999.00, $1000.00

  

50.    From the flowchart below, calculate the cyclomatic complexity.            

    

a)      1b)      2

Page 18: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

c)      3d)     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, 102b)      4, 15, 65, 92, 159c)      10, 50, 75, 100d)     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 Number

Answer Question Number

Answer

1 a 27 d2 d 28 c3 c 29 b4 c 30 a

Page 19: 50 Sample ISTQB Problems - Cloud Object … · Web viewFor the program below, how many test cases are required in order to achieve 100% statement coverage and 100% branch coverage?

5 d 31 c6 c 32 b7 c 33 b8 d 34 c9 c 35 a10 c 36 a11 d 37 b12 a 38 c13 a 39 c14 d 40 a15 d 41 c16 b 42 c17 c 43 c18 a 44 a19 a 45 b20 a 46 a21 a 47 a22 e 48 a23 c 49 b24 d 50 b25 a 51 b26 c 52 a