Chief Eazy
1 year ago

In programming, what is a loop used for?

A. repeating a block of code

B. storing data

C. performing mathematical operation

D. making questions

Answer: Option A

Solution (By Examveda Team)

The question asks about the purpose of a "loop" in programming.
Let's look at each option:

Option A: repeating a block of code - This is correct!
Loops are specifically designed to execute a set of instructions multiple times.

Option B: storing data - This is typically done using variables or data structures like lists or arrays, not loops.

Option C: performing mathematical operations - While loops can *include* mathematical operations, that's not their primary purpose. The operations themselves are done using operators like +, -, *, /.

Option D: making questions - "Making questions" is related to user input and conditional statements(if, else).

Therefore, the correct answer is A.

This Question Belongs to User Ask Question >> Miscellaneous

Join The Discussion

Related User Ask Questions