Quiz Space

System Commands OPPE 1: September 2023, Set 2 (September 2023 term)

Question 1

+15 marksProgramming

Define a bash function Determinant2x2 which calculates the determinant of a 2x2 matrix. An example usage of the function is shown below. Assume that the arguments are only integers.

Example

#for following Determinant
#   a =|1  2|
#      |3  4|

$ Determinant2x2 1 2 3 4
-2

Question 2

+15 marksProgramming

Write a bash script which accepts an integer input and finds all the numbers from one to the number provided which are divisible by 3 and 5. Make sure that the script checks of the number is integer and is not less than one and exits with exit code 1 if the check fails.

Question 3

+15 marksProgramming

Write a shell script which will

  • Read usernames.txt text file with usernames and generate passwords for each username using a hash value generated using shasum command.
  • Stores the first ten characters from the output as a password and saves it into a new file user_passwords.txt.

Hint:

$ shasum --help
Usage: shasum [OPTION]... [FILE]...
Print or check SHA checksums.
With no FILE, or when FILE is -, read standard input.

  -a, --algorithm   1 (default), 224, 256, 384, 512, 512224, 512256
...

Sample Input

tisha
sumedh
avyan
navya

Desired Output

tisha:c0840f4321
sumedh:117045d067
avyan:6951b4a77f
navya:57a84ed47c

3 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the System Commands OPPE 1 Sept 2023 Set 2 paper

The IIT Madras BS System Commands (System Commands) OPPE 1 paper sat on Sept 2023, in the September 2023 term, set 2: 6 questions for 105 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeatureSystem Commands OPPE 1 Sept 2023 Set 2 at a glance
TermSeptember 2023 term
SubjectSystem Commands
Course codeBSSE2001
Questions6
Marks105
Duration180 min
Programming6
Official paperOPPE 1, Sep 2023 Set 2
Negative markingNo negative marking.
Updated

Other sets that day

Same OPPE 1, other subjects

More System Commands