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 5 MCQs Shell Features

CSE105 — Creative Engineering Workshop 60 questions. Pick an option to check it.

Read the notes Subjective questions

0 of 60 answered 0 right 0 wrong , 60 left

  1. Question 1 of 60 Pattern Matching using Wildcards Easy

    Which wildcard character matches any number of characters (including zero) in a filename?

  2. Question 2 of 60 Pattern Matching using Wildcards Easy

    Which wildcard matches exactly one single character?

  3. Question 3 of 60 Pattern Matching using Wildcards Easy

    What does the pattern [abc] match?

  4. Question 4 of 60 Pattern Matching using Wildcards Easy

    Which pattern would list all files that end with .txt?

  5. Question 5 of 60 Pattern Matching using Wildcards Easy

    What does the range pattern [0-9] match?

  6. Question 6 of 60 Pattern Matching using Wildcards Easy

    Which command would list files named a, b, or c using a character set that expands into a single-character match against existing filenames on disk?

  7. Question 7 of 60 Pattern Matching using Wildcards Easy

    Wildcard expansion performed by the shell before running a command is commonly called:

  8. Question 8 of 60 Input/Output Redirection Easy

    Which operator redirects a command's standard output to a file, overwriting it?

  9. Question 9 of 60 Input/Output Redirection Easy

    Which operator appends standard output to a file without erasing existing content?

  10. Question 10 of 60 Input/Output Redirection Easy

    Which operator redirects input to a command from a file?

  11. Question 11 of 60 Input/Output Redirection Easy

    In the command sort < data.txt, where does sort get its input?

  12. Question 12 of 60 Input/Output Redirection Easy

    What is the file descriptor number for standard error (stderr)?

  13. Question 13 of 60 Input/Output Redirection Easy

    Which command uses redirection to save the output of ls into a file named list.txt, replacing the file's previous contents if it already exists and creating it otherwise?

  14. Question 14 of 60 Input/Output Redirection Easy

    What is the file descriptor number for standard input (stdin)?

  15. Question 15 of 60 Pipes and Pipe Chaining Easy

    Which symbol is used to create a pipe between two commands?

  16. Question 16 of 60 Pipes and Pipe Chaining Easy

    What does a pipe (|) do between two commands?

  17. Question 17 of 60 Pipes and Pipe Chaining Easy

    In the command ls | wc -l, what does wc -l receive?

  18. Question 18 of 60 Pipes and Pipe Chaining Easy

    What is meant by pipe chaining?

  19. Question 19 of 60 Pipes and Pipe Chaining Easy

    In the chained command cat file.txt | grep "error" | wc -l, what is the final result?

  20. Question 20 of 60 Pipes and Pipe Chaining Easy

    In a pipe chain, the standard output of one command becomes the __ of the next command that reads it, allowing data to move through the whole sequence without temporary files:

  21. Question 21 of 60 Pattern Matching using Wildcards Medium

    In a directory containing the files file1.txt, file2.txt, file10.txt, and fileA.txt, which command lists only the files whose name ends in a single digit followed by .txt?

  22. Question 22 of 60 Pattern Matching using Wildcards Medium

    What does the pattern [!aeiou]* match when used with ls?

  23. Question 23 of 60 Pattern Matching using Wildcards Medium

    Which wildcard pattern matches files named report, reportA, and reportABC but not report1?

  24. Question 24 of 60 Pattern Matching using Wildcards Medium

    The * wildcard in the shell matches which of the following?

  25. Question 25 of 60 Pattern Matching using Wildcards Medium

    Given files a.c, b.c, a.h, b.h, which command copies all .c and .h files to the backup directory in a single command?

  26. Question 26 of 60 Pattern Matching using Wildcards Medium

    What happens if you run ls *.log in a directory that contains no files ending in .log (assuming default bash behavior)?

  27. Question 27 of 60 Pattern Matching using Wildcards Medium

    Which pattern matches three-character filenames where the middle character is a digit?

  28. Question 28 of 60 Pattern Matching using Wildcards Medium

    In brace expansion, what files does touch file{1,2,3}.txt create?

  29. Question 29 of 60 Input/Output Redirection Medium

    What is the difference between command > file and command >> file?

  30. Question 30 of 60 Input/Output Redirection Medium

    Which command redirects only the error messages of program into errors.log while letting normal output appear on screen?

  31. Question 31 of 60 Input/Output Redirection Medium

    What does the command sort < data.txt > sorted.txt do?

  32. Question 32 of 60 Input/Output Redirection Medium

    Which command sends both standard output and standard error of build.sh into all.log?

  33. Question 33 of 60 Input/Output Redirection Medium

    What is the effect of redirecting a command's output to /dev/null, as in command > /dev/null?

  34. Question 34 of 60 Input/Output Redirection Medium

    A here-document is used to feed inline text to a command. Which syntax correctly begins one that passes text to cat until the word END?

  35. Question 35 of 60 Input/Output Redirection Medium

    Why does cat file1 > file1 typically result in an empty file1?

  36. Question 36 of 60 Pipes and Pipe Chaining Medium

    What does the command ls -l | grep "^d" accomplish?

  37. Question 37 of 60 Pipes and Pipe Chaining Medium

    In the pipeline cat access.log | grep "404" | wc -l, what value is produced?

  38. Question 38 of 60 Pipes and Pipe Chaining Medium

    Which pipeline displays the five largest files (by size) in the current long listing?

  39. Question 39 of 60 Pipes and Pipe Chaining Medium

    What does a pipe (|) connect between two commands?

  40. Question 40 of 60 Pipes and Pipe Chaining Medium

    You want to view a sorted list of unique usernames from users.txt. Which pipeline is correct?

  41. Question 41 of 60 Pattern Matching using Wildcards Hard

    In a directory containing files a.txt, ab.txt, abc.txt, and .hidden, what does the pattern ls [a-c]?.txt match?

  42. Question 42 of 60 Pattern Matching using Wildcards Hard

    What is the effect of the pattern rm *[!0-9]* in a directory?

  43. Question 43 of 60 Pattern Matching using Wildcards Hard

    Assuming no matching files exist and default Bash options, what happens when you run echo *.xyz in an empty-of-matches directory?

  44. Question 44 of 60 Pattern Matching using Wildcards Hard

    Which files does the pattern file[[:digit:]][[:alpha:]] match?

  45. Question 45 of 60 Pattern Matching using Wildcards Hard

    With shopt -s extglob enabled in Bash, what does the pattern !(*.txt|*.log) match?

  46. Question 46 of 60 Input/Output Redirection Hard

    What is the key difference between command 2>&1 > file and command > file 2>&1?

  47. Question 47 of 60 Input/Output Redirection Hard

    What does the command command > file 2>&1 accomplish, and why is order important?

  48. Question 48 of 60 Input/Output Redirection Hard

    Given exec 3< data.txt, what has been accomplished?

  49. Question 49 of 60 Input/Output Redirection Hard

    What is the difference between cat < file and cat file?

  50. Question 50 of 60 Input/Output Redirection Hard

    What does the here-string command tr 'a-z' 'A-Z' <<< "hello" produce?

  51. Question 51 of 60 Input/Output Redirection Hard

    In Bash, what is the effect of command &> file compared to command 2> file?

  52. Question 52 of 60 Input/Output Redirection Hard

    What is the consequence of running > file (a redirection with no command) in Bash?

  53. Question 53 of 60 Input/Output Redirection Hard

    Why might sort file > file result in an empty or corrupted file?

  54. Question 54 of 60 Pipes and Pipe Chaining Hard

    In the pipeline cmd1 | cmd2, from where does cmd2 read its input and where does cmd1 send its output?

  55. Question 55 of 60 Pipes and Pipe Chaining Hard

    In most shells, in what process context do the commands of a pipeline a | b | c execute?

  56. Question 56 of 60 Pipes and Pipe Chaining Hard

    What does grep error log.txt | wc -l count?

  57. Question 57 of 60 Pipes and Pipe Chaining Hard

    With set -o pipefail enabled, what is the exit status of the pipeline false | true | true?

  58. Question 58 of 60 Pipes and Pipe Chaining Hard

    Why does echo hello | read var; echo "$var" print an empty line in Bash (without lastpipe)?

  59. Question 59 of 60 Pipes and Pipe Chaining Hard

    What is the purpose of tee in the pipeline make 2>&1 | tee build.log | grep -i warning?

  60. Question 60 of 60 Pipes and Pipe Chaining Hard

    Why does cat file | grep pattern produce the same result as grep pattern file, and what is the common criticism of the first form?

That's unit 5

Answer a few questions and your score shows up here.