Unix Shell Scripting Loops MCQs

Shell Scripting Loops MCQs : This section focuses on "Loops" in Shell Progamming in Unix. These Multiple Choice Questions (MCQ) should be practiced to improve the unix skills required for various interviews (campus interviews, walk-in interviews, company interviews), placements, entrance exams and other competitive examinations.

1. Which of the following loops is not available in shell?

A. The for loop
B. The until loop
C. The select loop
D. The foreach loop

View Answer

2. The _______ loop executes the given commands until the given condition remains true.

A. For loop
B. While loop
C. until loop
D. Both B and C

View Answer

3. Which of the following statements that are used to control shell loops?

A. break
B. continue
C. Both A and B
D. None of the above

View Answer

4. A loop may continue forever if the required condition is not met is known as ____________.

A. finite loop
B. infinite loop
C. simple loop
D. definate loop

View Answer

5. Which of the following statement is used to terminate the execution of the entire loop?

A. continue
B. terminate
C. this
D. break

View Answer

6. What is the syntax of break command that can also be used to exit from a nested loop?

A. break
B. break loop
C. break n
D. break n+i

View Answer

7. Which of the following statement is supported in unix shell?

A. case
B. Switch
C. switch...case
D. case...esac

View Answer

8. Continue statment cannot be used in which loop?

A. For loop
B. until loop
C. while loop
D. case...esac

View Answer

9. Which of the following statement causes the current iteration of the loop to exit, rather than the entire loop?

A. Continue
B. break
C. return
D. goto

View Answer

10. What is the syntax of continue statement?

A. continue
B. continue n
C. continue this
D. All of the above

View Answer


* You must be logged in to add comment.