Essentials
Accenture PrimermediumEssentialsSoftware Fundamentals

Accenture Essentials Practice Question

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

Problem Statement : 
Strong number 

Check if a given number is a strong number. 145 is a strong number because 1!+4!+5! = 145.  

  

Sample Input : 

145 

Sample Output : 

Strong number 

  

Code: 

BEGIN 

DECLARE variables number, sum, temp, remainder, fact 

READ number 

SET sum=0, temp=number 

__________________ 

remainder = number % 10 

SET fact = 1 

FOR i IN 1 to remainder DO 

fact = fact *i 

END FOR 

sum = sum+ fact 

number = number / 10 

END WHILE 

IF sum==temp THEN 

PRINT "Strong number" 

ELSE 

PRINT "Not a Strong number" 

END IF 

END

Answer options

A
WHILE number != 0
B
Incorrect pseudocode with wrong initialization/order
C
Incorrect pseudocode with missing loop or condition
D
Incorrect pseudocode with wrong output statement

Correct answer: WHILE number != 0

Explanation

The correct answer is: WHILE number != 0.

Related Accenture Essentials questions

Practice more Accenture Essentials questions

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