Essentials
Accenture PrimermediumEssentialsSoftware Fundamentals

Accenture Essentials Practice Question

Select the appropriate code snippet for the given problem statement provided as pseudocode.

Problem Statement : 

Dinner Plan 

Five friends plan to go out for dinner. They plan to order equal number of dishes. Each row specifies individual cost. Find the total amount each person needs to pay.  

Assume the values for this matrix for 3 dishes are 

12 23 18 

45 32 60 

42 39 23 

54 42 60 

25 84 30 

The output will be 

Amount to be paid by person 1 is 53 

Amount to be paid by person 2 is 137 

Amount to be paid by person 3 is 104 

Amount to be paid by person 4 is 156 

Amount to be paid by person 3 is 139 

Explanation : Output is the sum of each row 

  

Code: 

BEGIN 

DECLARE variable arr[5][20], n, sum=0 

___________________ 

   FOR j IN 0 to n-1 DO 

READ arr[i][j] 

END FOR 

END FOR 

FOR i IN 0 TO 4 DO 

SET sum = 0 

FOR j IN 0 TO n-1 DO 

sum = sum + arr[i][j] 

END FOR 

PRINT "Amount to be paid by person "+(i+1)+" is "+sum 

END FOR 

END

Answer options

A
FOR i IN 0 to 4 DO
B
Bubble Sort
C
Merge Sort
D
Quick Sort

Correct answer: FOR i IN 0 to 4 DO

Explanation

The correct answer is: FOR i IN 0 to 4 DO.

Related Accenture Essentials questions

Practice more Accenture Essentials questions

PrimerDumps has 1400+ primer questions, 2026 mocks and coding hands-on — all free.