Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 10 subjective questions Shell programming

CSE105 — Creative Engineering Workshop 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    Describe the general structure of a shell script. What are the essential components every shell script should contain?

  2. Question 2 of 20

    Explain the process of creating and executing a shell script with all the necessary steps and commands.

  3. Question 3 of 20

    Explain the while loop in shell scripting with its syntax and a suitable example that prints numbers from 1 to 5.

  4. Question 4 of 20

    Explain the for loop in shell scripting. Illustrate with two examples: one iterating over a list and one using a numeric range.

  5. Question 5 of 20

    What are functions in shell scripting? Explain how to define and call a function, including how to pass arguments.

  6. Question 6 of 20

    Explain arrays in shell scripting. Describe how to declare, access, and iterate over array elements with examples.

  7. Question 7 of 20

    What are Interactive Shell Scripts? Explain how the read command is used to accept user input with an example.

  8. Question 8 of 20

    Explain Command-Line Arguments in shell scripting. Describe the special variables $0, $1, $#, $@, and $* with an example.

  9. Question 9 of 20

    Describe the various operators in shell scripting. Explain arithmetic, relational, logical, and string operators with examples.

  10. Question 10 of 20

    Explain the if and if-else statements in shell scripting with syntax and examples.

  11. Question 11 of 20

    Explain the nested if and if-elif-else (nested if) constructs in shell scripting with an example that assigns grades based on marks.

  12. Question 12 of 20

    Explain the test command and the [] (square bracket) notation in shell scripting. How are they related?

  13. Question 13 of 20

    Explain the case statement in shell scripting with syntax. Write a script that displays a menu and performs actions using case.

  14. Question 14 of 20

    Distinguish between the while loop and the for loop in shell scripting. When would you prefer one over the other?

  15. Question 15 of 20

    Compare the [ ] (single bracket) and [[ ]] (double bracket) test constructs in bash. What advantages does [[ ]] offer?

  16. Question 16 of 20

    Write a shell script using a function and a loop that calculates the factorial of a number entered by the user. Explain the logic in detail.

  17. Question 17 of 20

    Write and explain a complete shell script that reads a list of numbers into an array, then finds and prints the largest and smallest elements.

  18. Question 18 of 20

    Define a shell script and explain the role of the shebang (#!) line. What happens if the shebang is omitted?

  19. Question 19 of 20

    Describe the different ways to perform arithmetic operations in shell scripts. Explain expr, $(( )), let, and bc with examples.

  20. Question 20 of 20

    Write a shell script that uses command-line arguments, a case statement, and appropriate operators to build a simple calculator that adds, subtracts, multiplies, or divides two numbers. Explain the script.

That's unit 10

Long answers stick best when they're tested again soon. Run the MCQs on this unit, then come back to the questions you found hardest.