uiz Space

January 2025 term · System Commands · BSSE2001

System Commands End Term: 13 April 2025 (January 2025 term)

The IIT Madras BS System Commands (System Commands) End Term paper sat on 13 Apr 2025, in the January 2025 term: 16 questions for 100 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
16
Marks
100
Duration
180 min
MCQ
13
MSQ
1
Numerical
2

Updated

Official paper: IIT M DIPLOMA FN EXAM QDD1 13 Apr 2025 · No negative marking.

Question 1

+7 marksOne correct option

What will be the output of the command

bash
sort -n file1.txt file2.txt | awk '!seen[$1]++ {print $1, $2, $3}'

given the following content of file1.txt and file2.txt?

file1.txtfile2.txt
101 John Doe102 Michael Johnson
103 Jane Smith103 Jane Smith
105 Emma Brown106 Lily Evans
107 William Harris107 William Harris
109 Oliver Lewis110 Sophia Turner
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 2

+7 marksOne correct option

Schedule the script /home/user/backup.sh to meet the following requirements
1. The job should run at the 2nd minute of every hour, but only during weekdays (Monday to Friday).
2. Additionally, the job must not run during the first and last days of each month.
3. It should execute a script located at /home/user/backup.sh and log the output to
/var/log/backup.log (append mode).
Which of the following exact crontab entry is used to schedule this job.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 3

+7 marksOne correct option
awk
#!/usr/bin/awk -f
{
for (i = 1; i <= NF; i++) {
word = tolower($i)
gsub(/[^a-z]/, "", word)
if (word != "")
freq[word]++
}
}
END {
for (word in freq) {
printf "%-15s %d\n", word, freq[word]
}
}

What is the primary purpose of this AWK script?

  1. A

    To convert contents of file to lowercase.

  2. B

    To count the frequency of each word in a text file.

  3. C

    To count the number of lines in a file.

  4. D

    To replace all non-alphabetic characters in a file.

Show answer

Correct answer

  • B

    To count the frequency of each word in a text file.

Question 4

+7 marksOne correct option
  1. A

    Deletes all .log files in /home.

  2. B

    Lists all .log files in /sample/logs.

  3. C

    Finds all .log files and backs them up.

  4. D

    Renames .log files to .bak in /home.

Show answer

Correct answer

  • C

    Finds all .log files and backs them up.

Question 5

+6 marksOne correct option

Select a single sed command to achieve the following.
a) Find all lines that start with the word "error".
b) Replace the word "error" with "warning" only on those lines.
c) Append " - needs review" to the end of those same lines.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 6

+6 marksOne correct option

Consider current_permissions contain the present permissions of a file. Which of the following shell script statement calculate the new permissions by removing the read permission?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 7

+6 marksOne correct option

Select a command to find all established suspicious TCP connections on port 80 using netstat

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 8

+6 marksOne correct option

Which of the following vi command is used to replace the word 'apple' with 'orange' only in lines 10 to 20 of a file, and appear at the beginning or end of the line, without case sensitive and without user interaction.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 9

+6 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 10

+6 marksOne correct option
  1. A

    Display the today’s date

  2. B

    Nothing is printed

  3. C

    list all the lines of file1 that do not match file2

  4. D

    0

Show answer

Correct answer

  • B

    Nothing is printed

Question 11

+6 marksOne correct option
  1. A

    Deletes the first two fields in the CSV file.

  2. B

    Swaps the first and second fields of the CSV file.

  3. C

    Adds a new field to the CSV file.

  4. D

    Replaces all commas in the CSV file with spaces.

Show answer

Correct answer

  • B

    Swaps the first and second fields of the CSV file.

Question 12

+6 marksOne correct option
  1. A

    Compresses the /remove directory into a tarball, excluding the /sample subdirectory, and names it backup.tar.gz.

  2. B

    Deletes the /sample subdirectory before creating a compressed tarball of /remove.

  3. C

    Extracts the contents of backup.tar.gz to /remove, excluding the /sample directory.

  4. D

    Lists the contents of /remove, ignoring the /sample subdirectory.

Show answer

Correct answer

  • A

    Compresses the /remove directory into a tarball, excluding the /sample subdirectory, and names it backup.tar.gz.

Question 13

+6 marksOne correct option

You are working in a team with multiple developers using Git. One of your colleagues has created a feature branch from main, but over time, the main branch has received several commits. Your colleague is now attempting to merge the feature branch into main, but a conflict arises in a file that was modified both in the main branch and in the feature branch.
How would you resolve the conflict, ensuring that the feature branch is up-to-date with the latest changes from main and that no work is lost? Additionally, how would you ensure that this situation is prevented in the future?

  1. A

    a. Merge the feature branch into main without updating main. Resolve conflicts directly in the merge commit.
    b. Regularly merge main into the feature branch to avoid future conflicts.

  2. B

    a. Switch to the feature branch and run git pull origin feature-branch. b. Resolve the conflict directly in main, then push the changes.

  3. C

    a. Ensure main is up-to-date by pulling the latest changes.
    b. Switch to the feature branch and merge main into it.
    c. Resolve the conflicts, commit the changes, and push the feature branch.
    d. Merge the feature branch into main via a pull request.
    e. Prevent future conflicts by encouraging regular updates between branches.

  4. D

    a. Merge the feature branch into main without resolving conflicts. b. Use git reset to undo any conflicts and continue with the merge.

Show answer

Correct answer

  • C

    a. Ensure main is up-to-date by pulling the latest changes.
    b. Switch to the feature branch and merge main into it.
    c. Resolve the conflicts, commit the changes, and push the feature branch.
    d. Merge the feature branch into main via a pull request.
    e. Prevent future conflicts by encouraging regular updates between branches.

Question 14

+6 marksOne or more correct options

Select all that apply.

  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answers

  • B
  • E

Question 15

+6 marksNumerical answer
Show answer

Correct answer: 3

Question 16

+6 marksNumerical answer
Show answer

Correct answer: 149