#1
What is the purpose of the 'for' loop in programming?
To iterate over a sequence of values
ExplanationIteration over a sequence
#2
In which programming construct are 'while' loops commonly used?
Performing repetitive tasks
ExplanationRepetitive task execution
#3
What does the term 'iteration' refer to in programming?
A process of repeating a set of instructions
ExplanationRepeated instruction execution
#4
In Python, what is the purpose of the 'range()' function in a 'for' loop?
To generate a sequence of numbers
ExplanationSequence number generation
#5
In JavaScript, what is the purpose of the 'do-while' loop?
To ensure a block of code is executed at least once
ExplanationMandatory code execution
#6
What is the concept of 'loop control variables' in programming?
Variables used to control the execution of loops
ExplanationLoop execution control
#7
What is the purpose of the 'break' statement in a loop?
To exit the loop prematurely
ExplanationPremature loop exit
#8
What is variable scope in programming?
The visibility of a variable within a program
ExplanationVariable visibility
#9
What is the significance of the 'continue' statement in a loop?
To skip the remaining code in the loop and move to the next iteration
ExplanationSkipping loop code
#10
Explain the concept of 'global' and 'local' variables in programming.
Global variables are accessible throughout the entire program, while local variables are limited to a specific function or block.
ExplanationVariable accessibility differentiation
#11
Explain the difference between 'post-test' and 'pre-test' loops.
'post-test' loops check the condition after the loop body is executed, while 'pre-test' loops check before
ExplanationCondition checking position differentiation
#12
What is the purpose of the 'foreach' loop in languages like PHP?
To iterate over a sequence of values, like arrays
ExplanationArray iteration
#13
What is the difference between 'for' and 'while' loops?
'for' loops are used for iteration, while 'while' loops are used for conditional statements
ExplanationLoop type differentiation
#14
What is an 'iterator' in programming languages like Python?
An object that can be iterated (looped) over
ExplanationIterable object
#15
In Java, what is the difference between 'break' and 'return' statements?
'break' is used to exit a loop, while 'return' is used to exit a function or method
ExplanationLoop and function termination differentiation
#16
What is the purpose of the 'yield' statement in Python?
To generate values in a generator function
ExplanationValue generation in generator functions
#17
What is the significance of the 'volatile' keyword in C programming?
To indicate that a variable's value may change at any time without any action being taken by the code
ExplanationVariable volatility indication
#18
What is the purpose of the 'finally' block in a try-catch-finally statement in Java?
To specify code that will be executed regardless of whether an exception is thrown or not
ExplanationException handling final code