New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

ISTQB CTAL-TTA Exam - Topic 5 Question 43 Discussion

Actual exam question for ISTQB's CTAL-TTA exam
Question #: 43
Topic #: 5
[All CTAL-TTA Questions]

Below is pseudo-code which calculates a customer's cruise credits based on past cruise history:

PROGRAM CALC CRUISE CREDITS (CUST_ID) COUNT_CRUISES, CRUISE_CREDITS, LOYALTY_RATING: INTEGER CRUISE_LENGTH, CRUISE_ACCOM_TYPE: VAR

LOYALTY_RATING = 0

COUNT_CRUISES = 0

CRUISE_LENGTH = 0

CRUISE_ACCOM_TYPE = 0

BEGIN

READ CUSTOMER'S CRUISE HISTORY TO OBTAIN COUNT OF CRUISES

READ CRUISE_HISTORY (CUST_ID)

WHILE COUNT_CRUISES != -1 DO

READ CUSTOMER'S NEXT CRUISE

READ NEXT_CRUISE

IF CRUISE_ACCOM_TYPE = 3 THEN

CRUISE_CREDITS = CRUISE_CREDITS + 5

ELSE

IF CRUISE_ACCOM_TYPE = 2 THEN

CRUISE_CREDITS = CRUISE_CREDITS + 3

ELSE

CRUISE_CREDITS = CRUISE_CREDITS + 2

ENDIF

ENDIF

COUNT_CRUISES = COUNT_CRUISES - 1

ENDWHILE

LOYALTY_RATING = CRUISE_CREDITS / COUNT_CRUISES

WRITE ("CRUISE CREDIT TOTAL IS:")

WRITE (CRUISE_CREDITS)

END PROGRAM CALC CRUISE CREDITS

The code contains data flow anomalies on lines 14 and 27. Which examples of data flow anomalies can be found on these lines?

Show Suggested Answer Hide Answer
Suggested Answer: C

In the pseudo-code provided, we need to identify data flow anomalies, which typically occur when variables are used improperly in terms of their definition, usage, or re-definition.

Analyzing the pseudo-code step by step:

Lines 1-4 initialize variables LOYALTY_RATING, COUNT_CRUISES, CRUISE_LENGTH, and CRUISE_ACCOM_TYPE to 0.

Lines 6-7 read the customer's cruise history.

Line 8 begins a WHILE loop that continues until COUNT_CRUISES is -1.

Lines 9-10 read the next cruise.

Lines 11-19 check the CRUISE_ACCOM_TYPE and update CRUISE_CREDITS accordingly.

Line 20 decrements COUNT_CRUISES.

Line 21 ends the WHILE loop.

Line 22 calculates LOYALTY_RATING by dividing CRUISE_CREDITS by COUNT_CRUISES.

Lines 23-24 output the CRUISE_CREDITS.

Line 25 ends the program.

Data Flow Anomalies:

Line 14: CRUISE_CREDITS is re-defined before being used.

The initial problem here is that CRUISE_CREDITS should be assigned a value before it is incremented in lines 12, 15, and 17. The code does not show any prior definition (initialization) for CRUISE_CREDITS before these increments.

Line 27: LOYALTY_RATING is defined but not subsequently used.

After LOYALTY_RATING is calculated in line 22, it is not used again. This means the calculated value serves no purpose in the program as it stands.

By considering the above points, we can confirm that the correct option is C:

Line 14: CRUISE_CREDITS is re-defined before being used (it should have been initialized before the WHILE loop or just before its first usage inside the loop).

Line 27 (Line 22 in provided pseudo-code): LOYALTY_RATING is defined (calculated) but not subsequently used.

This matches the reference provided in the ISTQB sample exam answers, confirming that C is the correct answer.


ISTQB CTAL-TTA Sample Exam Questions

ISTQB Exam Structures and Rules

ISTQB CTAL-TTA Sample Exam Answers

ISTQB-CTAL-TTA Syllabus

ISTQB Exam Structure Tables

Contribute your Thoughts:

0/2000 characters
Tamesha
9 hours ago
Totally agree, that’s a classic mistake!
upvoted 0 times
...
Marguerita
6 days ago
I'm going with option B. The variable assignments seem a bit off, and that's probably the best way to describe the issues here.
upvoted 0 times
...
Vivan
11 days ago
Haha, good one! This exam is really testing our ability to spot bugs in code, not just memorize definitions.
upvoted 0 times
...
Alonzo
16 days ago
I think the question is trying to trick us. The real problem is that the code is written in pseudo-code, not a real programming language!
upvoted 0 times
...
Rebecka
21 days ago
Hmm, I'm not sure about that. Seems like there might be a few issues with the code.
upvoted 0 times
...
Stephaine
26 days ago
The correct answer is B. Line 14: Cruise_Credits is defined but not subsequently used, and Line 27: Loyalty_Rating is not assigned a value (defined) before being used.
upvoted 0 times
...
Vicki
1 month ago
I thought line 14 was fine since Cruise_Credits gets updated in the loop, but line 27 seems off because it looks like Loyalty_Rating isn't used after it's defined.
upvoted 0 times
...
Felton
1 month ago
I'm a bit confused about line 27. I feel like Loyalty_Rating should be calculated after the loop, but I can't recall if it needs to be used right away.
upvoted 0 times
...
Lenna
1 month ago
I remember something about variables needing to be defined before use, so I think option A might be correct, but I could be mixing it up with another question we practiced.
upvoted 0 times
...
Gaynell
2 months ago
I think line 14 has an issue because Cruise_Credits isn't initialized before it's used, but I'm not sure about line 27.
upvoted 0 times
...
Chana
2 months ago
This seems straightforward, but I want to double-check my understanding. I'll make sure I have a clear grasp of the data flow before selecting an answer.
upvoted 0 times
...
Desirae
2 months ago
I've seen questions like this before. The key is to pay close attention to how the variables are being initialized, updated, and referenced throughout the code.
upvoted 0 times
...
Lisandra
2 months ago
Line 14 has an issue with Cruise_Credits not being initialized.
upvoted 0 times
...
Bong
2 months ago
Okay, let me think this through step-by-step. I'll focus on lines 14 and 27 and see if I can spot the issues with the variable assignments and usage.
upvoted 0 times
...
Talia
3 months ago
I think it's option A. Cruise_Credits isn't defined first.
upvoted 0 times
...
Olen
3 months ago
Hmm, I'm a bit confused about the difference between "defined" and "used" in this context. I'll need to make sure I understand that before I can confidently answer.
upvoted 0 times
...
Floyd
3 months ago
This looks like a tricky one. I'll need to carefully read through the pseudo-code to identify the data flow anomalies.
upvoted 0 times
Franchesca
2 months ago
This is definitely tricky! I see some issues.
upvoted 0 times
...
Vallie
3 months ago
A sounds right, but we should double-check!
upvoted 0 times
...
...

Save Cancel