Guidewire certification · Exam InsuranceSuite-Developer

InsuranceSuite-Developer Mock Exam

Associate Certification - InsuranceSuite Developer - Mammoth Proctored Exam

Free InsuranceSuite-Developer questions on Gosu Collection Counting, each with the answer and an explanation.

20 questions · 30 minutes · free, no sign-up

Gosu Collection Counting questions

1–1 of 1 free
Question 1 Choose 1
Succeed Insurance would like to count the number of High Priority Activities that are related to a Job. Which approach follows best practices to meet this requirement?
Show answerHide answer

Correct answer: C var count = job.Activities.countWhere(\act -> act.Priority == TC_HIGH); print(String.format("Count of High Priority Activities: %s", {count}))

Explanation

Answer Option (Which option is correct) C. var count = job.Activities.countWhere(\act -> act.Priority == TC_HIGH); print(String.format("Count of High Priority Activities: %s", {count}))
Explanation:

countWhere expresses a count of elements satisfying a predicate without explicitly building a separate filtered list. In this question the predicate is the activity priority. An extra list conversion or a manual counter adds work or complexity to the same collection-level calculation.

Why the other options are incorrect:

A. var count = 0; job.Activities.each(\act -> act.Priority == TC_HIGH) { count += 1 }; print(String.format("Count of High Priority Activities: %s", {count})):
The each expression does not implement the displayed conditional counting syntax. It mixes a predicate and a following block. The shown countWhere expression states the count directly.

B. var actList = job.Activities.toList(); var count = actList.countWhere(\act -> act.Priority == TC_HIGH); print(String.format("Count of High Priority Activities: %s", {count})):
Converting to a list creates an additional collection representation. The original activity collection can be counted. That extra conversion is unnecessary here.

D. var count = 0; for (act in job.Activities) { if (act.Priority == TC_HIGH) { count += 1 } }; print(String.format("Count of High Priority Activities: %s", {count})):
A manual loop can count the matching activities. It requires an explicit mutable counter. countWhere expresses the same predicate more directly.

E. var count = 0; job.Activities.where(\act -> act.Priority == TC_HIGH) { count += 1 }; print(String.format("Count of High Priority Activities: %s", {count})):
where normally returns the filtered collection. The trailing counting block is not the shown collection-counting form. Use a count operation for the result.

References:

Gosu language project - Operators, loops, functions, and properties

Guidewire - Query-backed collections and buildBaseQuery

That's the last free question in Gosu Collection Counting

You've seen the free 30% (1 of 1 questions). Full access unlocks every question and full-length InsuranceSuite-Developer mock exams, a different mock on every attempt.

Unlock full mock exam
Full mock exam

Sit the InsuranceSuite-Developer exam before exam day

Full-length mocks with the same number of questions and the same time limit as the real InsuranceSuite-Developer exam. Every attempt draws a new set of questions from the full bank, so you can keep going until you pass comfortably.

Get full InsuranceSuite-Developer mock exam
  • —questions per mock
  • —time limit
  • 150questions in the bank
  • Newmock on every attempt