Quiz Space

January 2025 term · Introduction to Linux and Programming · CS1102

Intro to Linux End Term: 13 April 2025, Set QEF3 (January 2025 term)

The IIT Madras BS Introduction to Linux and Programming (Intro to Linux) End Term paper sat on 13 Apr 2025, in the January 2025 term, set QEF3: 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
9
MSQ
5
Numerical
2

Updated

Official paper: IIT M ES FOUNDATION AN EXAM QEF3 13 Apr 2025 · No negative marking.

Question 1

+7 marksOne correct option

file1.txt and file2.txt contains ID, Name of persons. Which of the following command Sort and merge the two files such that:
o The output should contain all the IDs from both files.
o The records should be listed in ascending order of ID.
o If an ID appears in both files, merge the records into one

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

Correct answer

  • C

Question 2

+7 marksOne correct option
awk
{
for (i = 1; i <= NF; i++) {
count[$i]++
}
}
END {
n = asorti(count, rcount)
for (i = 1; i <= n; i++) {
print rcount[i], count[rcount[i]]
}
}

What is the primary purpose of this AWK script?

  1. A

    To sort contents of file.

  2. B

    To count the frequency of each word in a file.

  3. C

    To count the number of lines in a file.

  4. D

    To count number of words in a file.

Show answer

Correct answer

  • B

    To count the frequency of each word in a file.

Question 3

+7 marksOne correct option

what does the following script do choose most prominent answer

bash
#!/bin/bash
exclude_commands=("sudo" "history")
get_top_commands() {
cat ~/.bash_history | \
sed 's/^[^a-zA-Z0-9]*//' | \
awk '{print $1}' | \
grep -vE "^(${exclude_commands[@]})$" | \
sort | \
uniq -c | \
sort -nr | \
head -n 5
}
get_top_commands
  1. A

    Finds the first 5 commands from user’s Bash History

  2. B

    Count the frequency of top 5 words in the user’s Bash history.

  3. C

    Find the top 5 unique words from bash history in an alphabetical order

  4. D

    Finds the top 5 most frequently used commands from a user's Bash history

Show answer

Correct answer

  • D

    Finds the top 5 most frequently used commands from a user's Bash history

Question 4

+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 adding the write permission?

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

Correct answer

  • A

Question 5

+6 marksOne correct option

Match the following commands in emacs with their purpose

1. C-x C-sa. Cut paste
2. C-x C-fb. Exit Emacs
3. C-x C-cc. Save file
4. C-k C-yd. Open file
  1. A

    1-a, 2-b, 3-c, 4-d

  2. B

    1-d, 2-c, 3-b, 4-a

  3. C

    1-b, 2-a, 3-d, 4-c

  4. D

    1-c, 2-d, 3-b, 4-a

Show answer

Correct answer

  • D

    1-c, 2-d, 3-b, 4-a

Question 6

+6 marksOne correct option

Match the commands with similar functionality

1. netstata) ip
2. Ifconfigb) mtr
3. digc) ss
4. pingd) nslookup
  1. A

    1-b,2-a,3-c,4-d

  2. B

    1-c,2-a,3-d,4-b

  3. C

    1-a,2-b,3-c,4-d

  4. D

    1-d,2-c,3-b,4-a

Show answer

Correct answer

  • B

    1-c,2-a,3-d,4-b

Question 7

+6 marksOne correct option
  1. A

    Convert upper case letters to lower case

  2. B

    Display all words in alphabetical order by removing duplicates

  3. C

    Count unique words in a file

  4. D

    Find duplicates words in a file

Show answer

Correct answer

  • B

    Display all words in alphabetical order by removing duplicates

Question 8

+6 marksOne correct option
  1. A

    1-a, 2-b, 3-c, 4-d

  2. B

    1-c, 2-d, 3-a, 4-b

  3. C

    1-c, 2-b, 3-a, 4-d

  4. D

    1-a, 2-c, 3-b, 4-d

Show answer

Correct answer

  • B

    1-c, 2-d, 3-a, 4-b

Question 9

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

Correct answer

  • B

Question 10

+6 marksOne or more correct options

If value of the variable ‘n’ is defined as 5, which of the following options will display values from 1 to n when the script is run in bash?

Select all that apply.

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

Correct answers

  • B
  • C

Question 11

+6 marksOne or more correct options

Which of the following grep commands finds the lines where at least one word appears three or more times?

Select all that apply.

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

Correct answers

  • B
  • D

Question 12

+6 marksOne or more correct options

You need to troubleshoot a network issue where a remote host’s IP is not resolving. You want to test if the DNS server is responding properly. Which of the following commands would you use? Let us consider 8.8.8.8 is the IP address of Google's public DNS server. And example.com is just a placeholder for any domain name you might want to test or troubleshoot.

Select all that apply.

  1. A

    dig @8.8.8.8 example.com

  2. B

    nslookup example.com 8.8.8.8

  3. C

    ifconfig example.com

  4. D

    tracepath 8.8.8.8

Show answer

Correct answers

  • A

    dig @8.8.8.8 example.com

  • B

    nslookup example.com 8.8.8.8

Question 13

+6 marksOne or more correct options

Which of the following extended regular expressions will match a phone number in the format 333-232-3403 or (333) 232 3403?

Select all that apply.

  1. A

    [0-9]{3}-\s[0-9]{3}-\s[0-9]{4}

  2. B

    \(?[0-9]{3}\)?[- ]?[0-9]{3}[- ]?[0-9]{4}

  3. C

    \(?[0-9]{3}\)?\s-[0-9]{3}\s-[0-9]{4}

  4. D

    \(?[0-9]{3}\)?[- ][0-9]{3}[- ][0-9]{4}

Show answer

Correct answers

  • B

    \(?[0-9]{3}\)?[- ]?[0-9]{3}[- ]?[0-9]{4}

  • D

    \(?[0-9]{3}\)?[- ][0-9]{3}[- ][0-9]{4}

Question 14

+7 marksOne or more correct options

Which of the following commands display the last day of the current month?

Select all that apply.

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

Correct answers

  • A
  • B

Question 15

+6 marksNumerical answer
Show answer

Correct answer: 8

Question 16

+6 marksNumerical answer
Show answer

Correct answer: 44