Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Exam CTFL topic 1 question 7 discussion

Actual exam question from iSQI's CTFL
Question #: 7
Topic #: 1
[All CTFL Questions]

Consider the following pseudo code
1. Begin
2. Read Gender
3. __Print "Dear"
4. If Gender = female
5. Print ("Ms")
6. Else
7. __Print ( "Mr")
8. Endif
9. End
How many test cases are needed to achieve 100 per cent decision coverage?

  • A. 1
  • B. 2
  • C. 3
  • D. 4
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
SivajiTheBoss
1 month ago
Tip: un nested : 2 testcases (irrespective of count of If)
upvoted 1 times
...
subwaysandwich
8 months, 1 week ago
Selected Answer: B
Ans: B. Decision coverage = minimum number of test cases to cover all branches. In this case, there is only one if-else statement, which means that 2 test cases are required. Note that if they asked for 100% statement coverage, it would still be 2, because the "Dear" statement would be covered by both test cases.
upvoted 1 times
...
subwaysandwich
8 months, 1 week ago
Selected Answer: C
Ans: C. 3 tests are needed to check for "Dear", "Ms." and "Mr."
upvoted 1 times
subwaysandwich
8 months, 1 week ago
Please ignore this. I have revised my answer to B. See my other comment.
upvoted 1 times
...
...
Arcino12
1 year, 7 months ago
1. Verify that "Dear" is displayed 2. Verify that "Ms." is displayed if gender is Female 3. Verify that "Mr." is displayed if gender is Male
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...