Accenture Primer
Accenture DumpmediumAccenture PrimerArrays

Choose the correct pseudocode for the below problem statement.

Answer options

A
Problem Statement :
B
Find Maximum value
C
Choose a pseudo code to find the maximum values in each row of a matrix. Assume it is a 3x3 matrix.
D
Explanation : Matrix will be with index
E
(0,0) (0,1) (0,2)
F
(1,0) (1,1) (1,2)
G
(2,0) (2,1) (2,2)
H
Assume the values for this matrix are
I
12 23 18
J
45 32 60
K
42 39 23
L
The output will be
M
Max value in row 1 is 23
N
Max value in row 2 is 60
O
Max value in row 3 is 42
P
BEGIN
Q
DECLARE variable arr[3][3]
R
FOR i IN 0 to 2 DO
S
FOR j IN 0 to 2 DO
T
READ arr[i][j]
U
END FOR
V
END FOR
W
SET max = arr[i][0]
X
FOR i IN 0 TO 2 DO
Y
FOR j IN 0 TO 2 DO
Z
IF arr[i][j]>max THEN
[
max = arr[i][j]
\
END IF
]
END FOR
^
PRINT "Max value in row "+(i+1)+" is "+max
_
END FOR
`
END
a
BEGIN
b
DECLARE variable arr[3][3]
c
FOR i IN 0 to 2 DO
d
FOR j IN 0 to 2 DO
e
READ arr[i][j]
f
END FOR
g
END FOR
h
FOR i IN 0 TO 2 DO
i
SET max = arr[i][0]
j
FOR j IN 0 TO 2 DO
k
IF arr[i][j]>max THEN
l
max = arr[i][j]
m
END IF
n
END FOR
o
END FOR
p
PRINT "Max value in row "+(i+1)+" is "+max
q
END
r
BEGIN
s
DECLARE variable arr[3][3]
t
FOR i IN 0 to 2 DO
u
FOR j IN 0 to 2 DO
v
READ arr[i][j]
w
END FOR
x
END FOR
y
FOR i IN 0 TO 2 DO
z
SET max = arr[i][0]
{
FOR j IN 0 TO 2 DO
|
IF arr[i][j]>max THEN
}
max = arr[i][j]
~
END IF

END FOR
€
PRINT "Max value in row "+(i+1)+" is "+max

END FOR
‚
END
ƒ
BEGIN
„
DECLARE variable arr[3][3]
…
FOR i IN 0 to 2 DO
†
FOR j IN 0 to 2 DO
‡
END FOR
ˆ
END FOR
‰
FOR i IN 0 TO 2 DO
Š
READ arr[i][j]
‹
SET max = arr[i][0]
Œ
FOR j IN 0 TO 2 DO

IF arr[i][j]>max THEN
Ž
max = arr[i][j]

END IF

END FOR
‘
PRINT "Max value in row "+(i+1)+" is "+max
’
END FOR
“
END

Correct answer: BEGIN, DECLARE variable arr[3][3], FOR i IN 0 to 2 DO, FOR j IN 0 to 2 DO, READ arr[i][j], END FOR, END FOR, FOR i IN 0 TO 2 DO, SET max = arr[i][0], FOR j IN 0 TO 2 DO, IF arr[i][j]>max THEN, max = arr[i][j], END IF, END FOR, PRINT "Max value in row "+(i+1)+" is "+max, END FOR, END

Explanation

Block C (indices 49-65) is correct. It reads all values first (nested FOR), then for each row (outer FOR i) sets max=arr[i][0], traverses columns (inner FOR j) to find the maximum, then PRINTS the row maximum INSIDE the outer loop (after inner FOR ends, before END FOR i). Block B prints after both loops (only one output); Block A sets max outside the row loop; Block D has READ misplaced outside the inner loop.

Related Accenture Accenture Primer questions

Practice more Accenture Accenture Primer questions

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