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 3 subjective questions Bash Scripting Fundamentals

CSC104 — It Fundamentals 20 questions with model answers. Write yours first, then compare.

Read the notes Practice MCQs
  1. Question 1 of 20

    Define Bash scripting. Explain its purpose and list the basic steps required to create and execute a Bash script.

  2. Question 2 of 20

    Describe the standard structure of a Bash script and write a basic Hello World script.

  3. Question 3 of 20

    Explain how variables are declared, assigned, expanded, and removed in Bash. Distinguish between local, shell, and environment variables.

  4. Question 4 of 20

    Write and explain a Bash script that accepts a user's name and age through keyboard input and prints a formatted message.

  5. Question 5 of 20

    Explain the purpose of comments in Bash. Distinguish between a shebang, a single-line comment, and a common technique for writing multi-line comments.

  6. Question 6 of 20

    Describe positional arguments and special argument-related parameters in Bash. Write a script that displays the script name, first two arguments, argument count, and all arguments.

  7. Question 7 of 20

    Explain indexed arrays and associative arrays in Bash. Demonstrate creation, access, update, traversal, and deletion.

  8. Question 8 of 20

    What is string slicing in Bash? Explain how substrings, string length, prefix removal, and replacement are performed using parameter expansion.

  9. Question 9 of 20

    Explain Bash file conditional expressions. Write an if statement that checks whether a supplied path is a readable regular file, a directory, or a nonexistent path.

  10. Question 10 of 20

    Compare string and arithmetic conditional expressions in Bash. Give suitable examples of each.

  11. Question 11 of 20

    Define exit status in Bash. Explain how $?, exit, &&, ||, and ! use command success or failure.

  12. Question 12 of 20

    Write a Bash script using if, elif, and else to classify an integer as positive, negative, or zero. Explain the control flow.

  13. Question 13 of 20

    Explain the case statement in Bash. Write a menu-driven example and compare it with an if-elif-else statement.

  14. Question 14 of 20

    Compare for, while, and until loops in Bash. Provide an example of each and state when each form is appropriate.

  15. Question 15 of 20

    Distinguish between break and continue in Bash loops. Explain their behavior in nested loops with examples.

  16. Question 16 of 20

    Explain how functions are defined and called in Bash. Describe function arguments, local variables, output, and return status with an example.

  17. Question 17 of 20

    Describe practical methods for debugging a Bash script. Explain syntax checking, execution tracing, strict-mode options, and diagnostic output.

  18. Question 18 of 20

    Explain useful Bash shortcuts and command-line editing features that improve efficiency.

  19. Question 19 of 20

    Explain how to create custom commands and aliases in Bash. Distinguish between temporary and persistent definitions.

  20. Question 20 of 20

    Design a complete Bash script that creates a backup of a user-supplied file. The script must validate input, use a function, generate a timestamped filename, report errors, and return meaningful exit statuses.

That's unit 3

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.