GeekInterview.com
Series: Subject: Topic:
Question: 73 of 308

Statement and decision coverage

Consider the following:
Pick up and read the newspaper
Look at what is on television
If there is a program that you are interested in watching then switch the television on and watch the program
Otherwise
Continue reading the newspaper
If there is a crossword in the newspaper then try and complete the crossword

a) SC = 1 and DC = 1
b) SC = 1 and DC = 2
c) SC = 1 and DC = 3
d) SC = 2 and DC = 2
e) SC = 2 and DC = 3

SC=Statement coverage DC=Decision coverage
Asked by: RM32306 | Member Since Feb-2008 | Asked on: Feb 6th, 2008

View all questions by RM32306

Showing Answers 1 - 8 of 8 Answers
Cryptic_sumon

Answered On : Feb 19th, 2008

View all answers by Cryptic_sumon

Statement Coverage is a traditional terget. Its deifne the coverage terget in Control flow Graph and write test cases to achive it. For example, Supose that we write and execute two test cases.

if 5=true than go to 6
//else if 5=false than go to 7

Test1: Follow paths 1-2-Exit
Test2: Follow paths 1-2-3-4-5-6-8-2-3-4-5-6-8-2-Exit.
here we can see in the test 2, we execute 2 loops and both time takes the true braches. and skips the false braches. so node number 6 is not executed so its not 100% statement coverrage


Otherhand The decision coverage is predicate nodes which always check condition for branching.  As an example we can use "if and else" "do while" and "switch " etc to coverage conditional branching to achive we need to write tests cases and execute it. 

Yes  1 User has rated as useful.
  
Login to rate this answer.
nasa_dead

Answered On : Jun 18th, 2008

View all answers by nasa_dead

sc 2 dc2

  
Login to rate this answer.
dmplakhan

Answered On : Feb 12th, 2009

View all answers by dmplakhan

sc=2 and dc=3

Yes  1 User has rated as useful.
  
Login to rate this answer.
manyamavs

Answered On : Nov 29th, 2009

View all answers by manyamavs

SC = 2 and DC = 2

  
Login to rate this answer.
georgeem

Answered On : Jun 23rd, 2010

View all answers by georgeem

d) SC = 2 and DC = 2

  
Login to rate this answer.
Chetana

Answered On : Sep 14th, 2011

SC=2 and DC=2

  
Login to rate this answer.
Balamurukan

Answered On : Oct 13th, 2011

Hi.. The answer provided was sc2 dc 3 which I feel is correct as there are two nodes
SC>>>>
1. If interesting prog on tv
2. If crossword on newspaper

DC
1. Interesting prog on tv,
I. Yes
II.No
2 Newspaper
I.Yes

Hence proved

  
Login to rate this answer.
mfsi_satyakamm

Answered On : Jan 11th, 2012

View all answers by mfsi_satyakamm

Hi,

The answer will be SC=2 & DC=3

Thanks

  
Login to rate this answer.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.