Michael Jardine
Quiz von , erstellt am more than 1 year ago

Week 02: Variables, Expressions Lecture 04: Expressions and command-line arguments - Using the command-line: getting information in to your program - Expressions: how to do calculations

4
0
0
Michael Jardine
Erstellt von Michael Jardine vor etwa 6 Jahre
Schließen

INFO L04 (w02-2) - Expressions and command-line Arguments

Frage 1 von 5

1

If trying to import a command-line argument when none was entered ("something = sys.argv[1]"), the error produced will be:

Wähle eine der folgenden:

  • NameError

  • SyntaxError

  • IndexError

Erklärung

Frage 2 von 5

1

If trying to import a command-line argument when "import sys" hasn't been entered, the error produced will be:

Wähle eine der folgenden:

  • NameError

  • SyntaxError

  • IndexError

Erklärung

Frage 3 von 5

1

When running “python3 working.py 12.8”, sys.argv[1] is which of the following?

Wähle eine der folgenden:

  • "12.8"

  • "working.py"

  • 12.8

Erklärung

Frage 4 von 5

1

What will be the output of the following code: x = 3 y = x x = 5 print(y)

Wähle eine der folgenden:

  • 3

  • 5

  • an Error of some sort

  • y

Erklärung

Frage 5 von 5

1

What will be the output of the following code: x = 3 y = x x = 5 print('y')

Wähle eine der folgenden:

  • 3

  • 5

  • An Error of some sort

  • y

Erklärung