ЁЯУв Too many exams? DonтАЩt know which one suits you best? Book Your Free Expert ЁЯСЙ call Now!


    Question

    A program needs to process elements from a `Queue` until

    it becomes empty. Which control flow structure is most suitable for this task?┬а
    A `for` loop with a fixed counter. Correct Answer Incorrect Answer
    B `if-else` statement. Correct Answer Incorrect Answer
    C `while` loop checking if the queue is not empty. Correct Answer Incorrect Answer
    D `switch-case` statement based on the first element. Correct Answer Incorrect Answer

    Solution

    A `while` loop is ideal for processing elements from a queue because the number of elements is dynamic and unknown beforehand. The loop continues as long as the condition (queue not empty) is true.

    Practice Next
    More IT DBMS Questions
    ask-question