Ask Question
9 August, 22:49

Q: If a program is invoked with "python program. py - r input. dat output. dat", what are the elements of argv?

There are four choices:

A. argv[0]: "-r input. dat output. dat"

B. argv[1]: "-r"

argv[2]: "input. dat"

argv[3]: "output. dat"

C. argv[0]: "program. py"

argv[1]: "-r"

argv[2]: "input. dat"

argv[3]: "output. dat"

D. argv[0]: "-r"

argv[1]: "input. dat"

argv[2]: "output. dat"

+1
Answers (1)
  1. 10 August, 00:32
    0
    C

    Explanation:

    C. argv[0]: "program. py"

    argv[1]: "-r"

    argv[2]: "input. dat"

    argv[3]: "output. dat"

    is the right answer. as 0 argument is always the script. We can find this by importing sys and using the command sys. argv. And like len (sys. argv) will give total number of arguments.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Q: If a program is invoked with "python program. py - r input. dat output. dat", what are the elements of argv? There are four choices: A. ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers