MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

ALGORITHMS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which loop is most appropriate to use if I need to continuously check for a correct password?
A
FOR loop
B
WHILE LOOP
C
Either A or B
D
None of the above
Explanation: 

Detailed explanation-1: -An infinite loop–sometimes called an endless loop–is a piece of code that lacks a functional exit so that it repeats indefinitely. In computer programming, a loop is a sequence of instructions that is continually repeated until a certain condition is reached.

Detailed explanation-2: -The while loop is used to perform an indefinite number of iterations, as long as a certain condition remains true.

Detailed explanation-3: -if statement in while loop for password checker.

Detailed explanation-4: -The while loop is used to repeat a section of code an unknown number of times until a specific condition is met.

There is 1 question to complete.