ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 118 - CTFL4 discussion

Report
Export

Consider the following code

int premium=2500;

if (age<30)

{

premium = premium +1500:

}

Which options suits for a correct combination of Boundary value and expected result. Assume first number as boundary followed by expected result.

A.
29, 1500 30. 2500
Answers
A.
29, 1500 30. 2500
B.
29. 4000 30. 2500
Answers
B.
29. 4000 30. 2500
C.
29, 2500 30. 1500
Answers
C.
29, 2500 30. 1500
D.
30, 1500 31,2500
Answers
D.
30, 1500 31,2500
Suggested answer: B

Explanation:

In the given code snippet, the premium is increased by 1500 if the age is less than 30. Therefore, at the boundary value of age 29, the premium should be 2500 + 1500 = 4000, and at age 30, the premium should remain at its initial value of 2500, as the condition is no longer met. Option B correctly reflects this with 29, 4000 and 30, 2500 as the boundary value and the expected results, respectively.

asked 18/09/2024
Meghan Crofford
39 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first